简体   繁体   中英

How to check the number of workers running inside a docker container of kubernetes pod?

I am using Flask-uWSGI architecture for a production service and have set the master flag of uWSGI config as False . While running the service, I pass NUM_WORKERS of uWSGI as 2 to the docker container. Based on this doc on uWSGI config , master flag is necessary to re-spawn and pre-fork workers. I wonder if my service containers within the pods are actually using 2 workers?

So, I want to exec into a pod and see the number of uWSGI workers which are actually being used?

Not related but my uWSGI config:

[uwsgi]
socket = 0.0.0.0:9999
protocol = http
module = my_app.server.wsgi
callable = app
master = false
thunder-lock = true

Add a prometheus-exporter to your app, and curl /metrics endpoint manually: https://github.com/timonwong/uwsgi_exporter

It has num workers metric: https://github.com/timonwong/uwsgi_exporter/blob/9f88775cc1a600e4038bb1eae5edfdf38f023dc4/exporter/exporter.go#L50

Further, you can collect this using Prometheus to monitor and alert automatically.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM