Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I just bought a new server which will be running nginx, PHP, MySQL stack that will be serving fully-cached html requests 90% of the time and PHP/mysql requests otherwise through FastCGI.

Stats on the box are:

CentOS 5.x 64-bit

2x Intel Quad Core Xeon E5520 (8 cores/16 threads)

6GB DDR3 @ 800Mhz

Wondering what some nginx pros would generally recommend regarding number of worker processes for a server like this. Am looking for optimum setup here as this is strictly a web server - will ideally be serving a few thousand requests/sec from html cache and a few hundred max from PHP/mysql.

Thanks!

share|improve this question
add comment

3 Answers 3

Nginx's resident memory usage is trivial and to the best of my knowledge there is little penalty for having 8 Nginx processes (1 per core) rather than 1.

I would run apache bench or another utiltiy with high concurrency requesting disk heavy objects. Keep increasing the AB tests till you discover the breaking point. Then experiment with the amount of Nginx procs keeping all other tests equal. Report back so we can all be the wiser.

share|improve this answer
add comment

Take a look at http://serverfault.com/questions/6288/number-of-nginx-worker-processes

share|improve this answer
    
lol, every answer recommends a different method. ace is likely to be more confused after reading that. –  CarpeNoctem Mar 2 '10 at 2:42
add comment

If you are doing a proxying workload (PHP counts as a proxying workload) then I would recommend only one worker as there is no reason to use more than one.

The only reason I would recommend more than one worker is when you are using nginx for heavy static file IO. Even though nginx uses an asynchronous IO model, there are still a few system calls that can block the progress of the worker, reading from disk is one of those. In those cases I would recommend one worker per disk spindle, or CPU, whichever is the smaller.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.