optimizing worker processes usage

Igor Sysoev is at rambler-co.ru
Mon Sep 24 23:22:05 MSD 2007


On Mon, Sep 24, 2007 at 01:45:54PM +0200, Manlio Perillo wrote:

> Doing some tests with mod_wsgi, I have found some "problems" with worker 
> processes usage.
> 
> I have worker_processes set to 2 (and I have a Dual Core CUP).
> 
> When a WSGI app "quickly" return a chunk of data (and write it at once), 
> nginx seems to use only one process, serializing all the requestes.
> 
> How can I optimize the code so that nginx can use all the worker processes?
> 
> I have found that if the WSGI app calls, as an example, sleep(0.01), 
> then nginx will use all of its worker processes (but this slow down the 
> response time: 159.52 req/sec vs 2848.19 req/sec)

It's up to OS.

nginx uses accept_mutex to receive new connection notifications
form kqueue/epoll/etc in only one worker. It seems that your load
is not enough to utilize two CPUs.


-- 
Igor Sysoev
http://sysoev.ru/en/





More information about the nginx mailing list