[英]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
.我正在将 Flask-uWSGI 架构用于生产服务,并将 uWSGI 配置的
master
标志设置为False
。 While running the service, I pass NUM_WORKERS of uWSGI as 2
to the docker container.在运行服务时,我将 uWSGI 的 NUM_WORKERS 作为
2
传递给 docker 容器。 Based on this doc on uWSGI config , master
flag is necessary to re-spawn and pre-fork workers.根据uWSGI config上的这个文档,重新生成和预分叉工人需要
master
标志。 I wonder if my service containers within the pods are actually using 2 workers?我想知道 pod 中的服务容器是否实际上使用了 2 个工作器?
So, I want to exec
into a pod and see the number of uWSGI workers which are actually being used?所以,我想
exec
一个 pod 并查看实际使用的 uWSGI 工作人员的数量?
Not related but my uWSGI config:不相关,但我的 uWSGI 配置:
[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将 prometheus-exporter 添加到您的应用程序,并手动 curl
/metrics
端点: https : //github.com/timonwong/uwsgi_exporter
It has num workers metric: https://github.com/timonwong/uwsgi_exporter/blob/9f88775cc1a600e4038bb1eae5edfdf38f023dc4/exporter/exporter.go#L50它有 num 个工人指标: https : //github.com/timonwong/uwsgi_exporter/blob/9f88775cc1a600e4038bb1eae5edfdf38f023dc4/exporter/exporter.go#L50
Further, you can collect this using Prometheus to monitor and alert automatically.此外,您可以使用 Prometheus 收集这些信息以自动监控和警报。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.