Friday, July 29, 2016

TIP: running 2N+1 Gunicorn workers

If you read, people tend to say that for web services, run 2N+1 workers, where N is the number of CPUs.

It turns out the Intarwebs are wrong about exactly how to do this. Here's my solution based on "epicbrew"'s work on Stack Overflow:

gunicorn --workers=$((2 * $(getconf _NPROCESSORS_ONLN) + 1)) wsgi:application
The cool thing is that it works on both macOS and Linux!

No comments:

Post a Comment