0.0
The project is in a healthy, maintained state
Add pool usage statistics within your log files.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.0
>= 12.3.3
~> 3.0
~> 1.28
< 0.18

Runtime

>= 3.12, < 7.0
>= 5.0
 Project Readme

Puma Pool Usage

Tests Code Climate Test Coverage

A Puma plugin that interprets usage statistics for the percentage of your resources under load. Uses Rails to log this statistic. Inspired by Tomas Ruzicka and Heroku's pool usage statistics.

Look at this neat log:

source=PUMA pid=74840 sample#pool_usage=0.8

If your web server is fielding no requests, usage will be 0.0 (0%). If every single resource has a request, usage will be 1.0 (100%). If you have a backlog of requests that cannot be processed because no resources are available, usage can be over 100% (like 1.4).

Wish to chart this data, setup alerts, or scale your servers based on it? Great idea, but it's beyond the scope of this plugin. This plugin provides the data, what you do with the data is up to you.

Installation

Add this line to your application's Gemfile:

gem "puma-pool-usage"

And then execute:

$ bundle

Or install it yourself as:

$ gem install puma-pool-usage

Usage

In your Puma configuration file (config/puma.rb), add the following line:

plugin :pool_usage

Restart your server and you're all set.

Configuration

By default, Puma Pool Usage will log every Puma worker every 60 seconds. You can configure this via the environment variable PUMA_STATS_FREQUENCY. To gather this data only every 5 minutes, set your environment like so:

PUMA_STATS_FREQUENCY=300

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/simplymadeapps/puma-pool-usage. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the Puma::Pool::Usage project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.