Are there any recommendations about number of gunicorn workers? #1208
Unanswered
and-semakin
asked this question in
Q&A
Replies: 1 comment
-
Hi @and-semakin , This is still not straightforward and depends on your application specifics. For example, your application has a storage layer and there's a database connection with the pooler. The pooler has a pre-defined number of connections. Which limits the concurrency of your application. So that one application process may never fully utilise one CPU core. In that case, in order to increase CPU utilisation, you run more workers per CPU core. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi folks!
I have a question regarding the deployment of an ASGI app using
gunicorn & uvicorn
combination. Gunicorn docs mention that it is a best practice to runnum_workers = 2 * num_cpu + 1
workers. Does this formula still work for asynchronous applications? Or are there any better recommendations?My intuition tells me that each async worker should have its own CPU core because it runs an event loop, so the formula should be like
num_workers = num_cpu + 1
or even justnum_workers = num_cpu
. Am I wrong?Let's assume that the application I deploy is generally IO-bound.
Beta Was this translation helpful? Give feedback.
All reactions