Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gunicorn is creating workers in every second

I am running Django using Gunicorn behind Nginx. In one of my installation, when I run the gunicorn process, I keep getting debug output, it's like workers are being created in every second (I assume this because django is loading very slow and note the message "[20205] [DEBUG] 3 workers"). You can check the detail output at this gist In similar setup, I am running 3 more installations without any such issues and respective site loads almost instantly. Any idea why this is happening? Thanks.

like image 555
Habib Ullah Bahar Avatar asked Jul 03 '15 16:07

Habib Ullah Bahar


People also ask

How many requests per second can Gunicorn handle?

Gunicorn should only need 4-12 worker processes to handle hundreds or thousands of requests per second. Generally we recommend (2 x $num_cores) + 1 as the number of workers to start off with. From threads, The number of worker threads for handling requests.

How many Gunicorn workers are in a CPU?

The suggested number of workers is (2*CPU)+1 . For a dual-core (2 CPU) machine, 5 is the suggested workers value. Gunicorn with default worker class (sync).

How many requests can Gunicorn handle?

Gunicorn process will have 5 threads now. And each thread is capable of serving a request. Hence 5 requests can be simultaneosly served.

Is Gunicorn multithreaded?

¶ Since Gunicorn 19, a threads option can be used to process requests in multiple threads. Using threads assumes use of the gthread worker.


Video Answer


1 Answers

The polling of the workers every second on --log-level debug was introduced in gunicorn==19.2.

Change the log level to info.

like image 140
Conrado Avatar answered Oct 05 '22 13:10

Conrado