4 ms·
You can configure gunicorn to use multiple threads to recover quite a bit of concurrency in those scenarios and that is enough for many applications.
by pdhborges 4y ago
You can configure gunicorn to use multiple threads to recover quite a bit of concurrency in those scenarios and that is enough for many applications.
- srcreigh 4y agoWhat threading/workers configuration do you use? I'm looking at a page now which recommends 9 concurrent. requests for a Django server running on a 4 core computer. Meanwhile node servers can easily handle hundreds of concurrent requests.
- pdhborges 4y agoWe use the ncpu * 2 + 1 formula for the number of workers that serve API requests. I don't think in 'handling x concurrent requests' terms because I don't even know what that means. Usually I think around thoughout, latency distributions and number of connections that can be kept open (for servers that deal with web sockets). For example if you have the 4 core computer and you have 4 workers and your requests take around 50ms each you can get to a throughput of 80 requests per second. If the fraction of request time for IO if 50% you can bump your thread count to try to reach 160 request per second. Note that in this case each request consumes 25ms of CPU so you would never be able to get more than 40 requests per second per CPU whether you are using node or python.