This issue is a feature request.
Gunicorn exports some useful metrics to statsD, including the number of gunicorn workers. However, it doesn't export the number of workers currently serving a request, or equivalently, a percentage worker utilization. This is something I've been trying to figure out how to determine externally from gunicorn, and so far have been unsuccessful with. I think it might be easier to update gunicorn's statsd logging to include worker utilization, which I imagine could be found from asking the master gunicorn process how many workers are busy.
My use case for this metric is to feed it to the Kubernetes HorizontalPodAutoscaler so that I can scale my gunicorn deployment based on gunicorn worker utilization.
I would be willing to work on this and create a pull request. What do people think?
This is something we are actively searching for a solution to. Currently we scale based on CPU/Memory but that doesn't solve the problem of a pod getting several long running requests that are not CPU or memory bound.
Most helpful comment
This is something we are actively searching for a solution to. Currently we scale based on CPU/Memory but that doesn't solve the problem of a pod getting several long running requests that are not CPU or memory bound.