worker cpu balance

Ed W lists at
Sun Apr 13 11:30:07 MSD 2008


> However, it does not scale on multiple CPUs, whatever the number of
> worker_processes. I've tried 1, 2, 8, ... The processes are quite there,
> but something's preventing them from sharing a resource since the
> machine never goes beyond 50% CPU used (it's a dual core). Sometimes,
> "top" looks like this :
> nginx use both workers but one is used ~70-80 and the other only ~20-30
> percent.

This is just a guess since I haven't looked at the code

I read that nginx is event based, hence it probably is designed with a 
single process reading and writing to all sockets (correct?).  So in 
your case perhaps the bottleneck is reading from the socket and this is 
maxing out the single CPU?  I would guess that the worker processes only 
split the load of any processing downstream of the network socket 
handling step..?

OK, that's my guess, perhaps the author will now explain the real problem...

Ed W

More information about the nginx mailing list