Worker processes

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

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.

If you have multiple CPUs, you can also try setting the number of
worker processes to the same number of CPU cores.

-Liang

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.

Igor S. 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. :slight_smile:

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 Wed, May 07, 2008 at 05:05:32PM +0200, Jason L. 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.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs