benoitc / gunicorn

gunicorn 'Green Unicorn' is a WSGI HTTP Server for UNIX, fast clients and sleepy applications.
http://www.gunicorn.org
Other
9.66k stars 1.74k forks source link

Exporting worker utilization to statsD #2295

Open calebwoofenden opened 4 years ago

calebwoofenden commented 4 years ago

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?

mam8cc commented 4 years ago

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.

DeoLeung commented 2 years ago

also currently I found the number of workers metric only updated when gunicorn starts. if we had a long running application, it's hard to use the metric.

benoitc commented 2 years ago

fo you mean that When you increase the number of workers it isn’t updated? Otherwise the number of workers don’t increase until you send a signal to gunicorn or update its config.

Le ven. 24 sept. 2021 à 02:51, Zhanzhao (Deo) Liang < @.***> a écrit :

also currently I found the number of workers metric only updated when gunicorn starts. if we had a long running application, it's hard to use the metric.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/benoitc/gunicorn/issues/2295#issuecomment-926265212, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAADRIVYUANKLXXYPC652DTUDPDQBANCNFSM4LS5V7JA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

-- Sent from my Mobile