Reputation: 1375
Reading Gunicorn's docs I see two parameters, worker being the value of WEB_CONCURRENCY and worker_connections being the number of simultaneous clients.
Wouldn't the number of workers be the same as the number of clients it can handle at the same time? [assuming worker class as gevent].
It seems to be pretty clear that I'm wrong in my assumption, could someone please explain what the difference is between them?
Upvotes: 16
Views: 11509
Reputation: 3027
workers
— is a number of OS processes for handling requests. By default it is equal to the value of WEB_CONCURRENCY
environment variable, and if it is not defined, the default is 1.
worker_connections
— is a maximum count of active greenlets grouped in a pool that will be allowed in each process (for "gevent" worker class).
By the way, the documentation recommends:
DO NOT scale the number of workers to the number of clients you expect to have. Gunicorn should only need 4-12 worker processes to handle hundreds or thousands of requests per second.
Upvotes: 9