Hello, I am running Nginx as a reverse proxy with Mongrel. I haven't been able to find a clear example of what to set the worker_processes at. I'm running 10 mongrels and trying to find the sweet spot for Nginx. If anyone has any insight in this, it would be appreciated. Thanks, - jason
on 07.05.2008 07:37
on 07.05.2008 08:05
1 Unless you are doing a LOT* of static IO, you won't need more than 1 worker process. Cheers Dave * to define a LOT, we serve 1.5m dynamic hits with 32 mongrels over 3 machines using 1 nginx worker. Cpu usage, including compression, 5% max.
on 07.05.2008 08:23
If you have multiple CPUs, you can also try setting the number of worker processes to the same number of CPU cores. -Liang
on 07.05.2008 11:48
On Tue, May 06, 2008 at 11:10:59PM -0700, kingler wrote: > If you have multiple CPUs, you can also try setting the number of > worker processes to the same number of CPU cores. It make sense only if nginx eats many CPU time for gzipping or SSL. Otherwise OS may schedule all workers on single CPU.
on 07.05.2008 17:05
Igor Sysoev wrote: > On Tue, May 06, 2008 at 11:10:59PM -0700, kingler wrote: > >> If you have multiple CPUs, you can also try setting the number of >> worker processes to the same number of CPU cores. > > It make sense only if nginx eats many CPU time for gzipping or SSL. > Otherwise OS may schedule all workers on single CPU. So real quick I have to say, after using all the 'big' http servers, Nginx is my favorite. Not just for the speed, but the configuration is so much easier, so thanks! This is my default HTTP server now. :) I'm running my production server on 2 x 4-core Xeons. I have my conf setup with SSL, gzip. When hitting the server, the load is minimal. I heard in this thread that 1 worker is enough. But if I needed more, then I'd be more than happy to do that. I did play around with the settings and when I cranked up the worker_processes to 10, it seemed like my pages took a little bit more time - there was a lot of browser activity it was showing me at the bottom of my window. However, when I dropped the worker process down to 2 (where it's at now), everything seemed snappier. So is the worker process the one thread thread that listens on port 80? Or is it a multithreaded process that listens and then uses the worker connects (which are threads?) to listen to incoming requests? Or am I completely wrong all together. Thanks for everyone's replies! - jason
on 07.05.2008 21:30
On Wed, May 07, 2008 at 05:05:32PM +0200, Jason Lee wrote: > Nginx is my favorite. Not just for the speed, but the configuration is > dropped the worker process down to 2 (where it's at now), everything > seemed snappier. > > So is the worker process the one thread thread that listens on port 80? > Or is it a multithreaded process that listens and then uses the worker > connects (which are threads?) to listen to incoming requests? Or am I > completely wrong all together. A worker process is one-threaded process.