worker_processes

Aleksandar Lazic al-nginx at none.at
Tue Jan 30 00:21:27 MSK 2007


Hi,

On Mon 29.01.2007 18:07, Šime Ramov wrote:
>
>I installed nginx from Debian package and it came configured with
>worker_processes 1; and worker_connections 1024;

Ok.

>Now, I was wondering (since on the english wiki it states that default
>value for worker_processes is 5), to which value to set this up in some
>common situations?

It is wrong, sorry :-/

The default is 1, the box is only a config example, I have corrected it
on the wiki, thanks for the hint ;-)

>For example, if I run one Django site via FastCGI, what value to put in
>worker_processes? And if I run two Django sites? Three Django sites?
>One Django site and a couple of static sites?

Hm this is a very difficult question, from my point of view.

I have use mostly this formula:

worker_processes = (max_assumed_concurrent_client *
                    max_fcgi_instances) per site + 2 for the static one

Here for example:

(4 * 2) + 2 = 10 => worker_processes

But you should measure if you setup is the *best* for you application,
because if you have *some*/*many* long running answer processes in the
app-layer then you could need more worker_processes.

As I have said: it isn't a easy question because there are many, many
opinions about this issue ;-)

But as far as I know the follwing are fact, for know:

1.) the proxy/fcgi connection to the backend aren't persistant
2.) with more worker_processes you need more resources
3.) If you setup more worker_processes then *physical* cpus you have
    some waits, maybe not a issue, but a fact, please correct me if I'am
    wrong!
4.) You *must* measure you applicaton a *easy* explanation is here:
    http://mongrel.rubyforge.org/docs/how_many_mongrels.html, yust think
    on django instead of mongrels ;-)

Hth

Aleks





More information about the nginx mailing list