optimizing worker processes usage

Manlio Perillo manlio_perillo at libero.it
Tue Oct 2 01:31:37 MSD 2007

Igor Sysoev ha scritto:
> 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.

Ok, thanks.
I have written a Python application that compute the MD5 hash of a file 
(~3MB) and now nginx fully uses my two CPU.

Regards  Manlio Perillo

More information about the nginx mailing list