I am using gunicorn with Sanic, and I can’t get a good idea reading the docs on Sanic or Gunicorn what an ideal setting for Gunicorn workers is.
If the server only runs the sanic app and has 4 cores, should I set workers to 4 or higher? I do see that when the app is running, the process does get up to 100% cpu utilization and drop back down (as viewed in
Is it correct to assume:
- if I use exactly 4 workers,then if all 4 workers are running cpu-intensive tasks, they will get the all the attention without delay
- if I have a lot of users, then having just 4 workers will not be able to handle all the requests and then they will be stuck in request queue?
I am mainly trying to see if I could in fact increase worker count without spending on more servers. Not all endpoints are cpu-intensive, and most of them are behind cache so usually the response is quick.