Gunicorn: Exporting worker utilization to statsD

Created on 24 Mar 2020  路  1Comment  路  Source: benoitc/gunicorn

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?

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.

>All comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mw44118 picture mw44118  路  3Comments

alep picture alep  路  3Comments

zenglingyu picture zenglingyu  路  4Comments

Bogdanp picture Bogdanp  路  3Comments

benoitc picture benoitc  路  4Comments