stephenhillier / starlette_exporter

Prometheus exporter for Starlette and FastAPI

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Blocking Calls when in Multiprocess mode

jgould22 opened this issue · comments

I am still getting a bit of a handle on how python async works however I have a question.

Since starlette_exporter depends on the client_python which is not generally async am I blocking the event loop when I enable client_python's multi-process mode?

I can see it uses the file system here to store/share its metrics between workers and in doing so makes regular file open calls.

Do these open calls block the event loop?

I'm not sure I have the Python async chops to be able to answer your question, but if you dig deeper and find any answers please report back. 👍

For what it's worth I currently use FastAPI with uvicorn with only one worker, but deployed to a number of pods so I'm not as familiar with multiprocess mode (the deployment config described here: https://fastapi.tiangolo.com/id/deployment/docker/#replication-number-of-processes).

Is hard to block them as the call is done on tmpfs (in memory)
You will have the blocking time for the file I believe is shorter that the most of other calls.

Doing some cleanup of older issues. If this is still an issue it may be a good question for the client_python repo. Cheers