worker_processes

Scott Yang scott.yang at gmail.com
Wed Jan 31 01:50:08 MSK 2007


Hi,

Nginx utilises async IO so effectively you just need to use 1 worker
process (unless you have more connections than max_connection).
Therefore the previous link regarding number of Mongrel processes does
not apply, as Mongrel is pretty much blocking on dispatching the
requests to RoR, whereas a single worker process Nginx as front-end
can easily juggle between multiple Mongrel backends.

Single worker process Nginx should have no problem doing name based
virtual hosting either.

As Igor has said, you only need to have multiple worker processes to
take advantage of multiple CPU cores, as single-threaded Nginx would
only stick on to CPU core (although I found it efficient enough to run
on just one CPU and leave the others for CPU hungry backend scripts).
Or if you use Nginx to serve lots of small static files, as I believe
some IO calls are still blocking.

Cheers,

Scott

On 1/31/07, Šime Ramov <hi at brand84.com> wrote:
> Hmm, OK, so it seems that it's the best to leave worker processes set
> to 1, unless there is multiple processors, CPU intensive tasks, gzip,
> SSL, etc...
>
> But let me ask you this, as I'm not so clear about it yet: Lets say I
> have a couple of *normal* (normal traffic) sites running (few Django
> sites, few static sites), does it make sense to increase the worker
> processes or is it OK to leave it at 1?
>
> According to all of above, I would (and will) use one worker process
> *if* I have one site. But, I'm not so clear yet about situation where
> I have more sites running from the same nginx server via virtual
> hosting.


More information about the nginx mailing list