Gunicorn

Gunicorn lacks native busy worker count metrics

info
performanceUpdated Aug 26, 2025(via Exa)
Technologies:
How to detect:

Gunicorn does not expose built-in metrics for the number of workers currently processing requests (busy) versus idle workers. Without this visibility, it is difficult to determine if the worker pool is appropriately sized or to proactively detect saturation before users experience latency.

Recommended action:

Implement custom busy worker tracking using Gunicorn's pre_request and post_request hooks with a multiprocessing.Semaphore to maintain an atomic counter across worker processes. Store the busy count in a custom request header (e.g., x-busy) and include it in the access_log_format using %({x-busy}i)s. Monitor this metric to right-size the worker pool.