Worker Processes

How do I know which type of worker to use?

Read the Design page for help on the various worker types.

What types of workers are there?

Check out the configuration docs for worker_class.

How can I figure out the best number of worker processes?

Here is our recommendation for tuning the number of workers.

How can I change the number of workers dynamically?

TTIN and TTOU signals can be sent to the master to increase or decrease the number of workers.

To increase the worker count by one:

  1. $ kill -TTIN $masterpid

To decrease the worker count by one:

  1. $ kill -TTOU $masterpid

Does Gunicorn suffer from the thundering herd problem?

The thundering herd problem occurs when many sleeping request handlers, which may be either threads or processes, wake up at the same time to handle a new request. Since only one handler will receive the request, the others will have been awakened for no reason, wasting CPU cycles. At this time, Gunicorn does not implement any IPC solution for coordinating between worker processes. You may experience high load due to this problem when using many workers or threads. However a work has been started to remove this issue.

Why I don’t see any logs in the console?

In version R19, Gunicorn doesn’t log by default in the console. To watch the logs in the console you need to use the option --log-file=-. In version R20, Gunicorn logs to the console by default again.