2

I'm in the process of setting up a server with 4GB RAM and 2 CPUs. The stack will be CentOS + NGINX + MySQL + PHP (with APC) and spawn-fcgi. It will be used to serve 10 Wordpress blogs, 3 of which receive about 20,000 hits per day. Each Wordpress instance is equipped with the W3 TotalCache.

I have a few variables to play with:

  • NGINX (How many worker_processes, worker_connections, etc)
  • PHP (What parameters in php.ini should I change? What about apc?)
  • Spawn-fcgi (Right now I have 6 php-cgi spawned. How many of them should I have?)

I realize it's hard to tell without testing, but if you could please provide me with some ballpark numbers, that would be helpful too.

1 Answer 1

2

worker_processes usually should be the same as the number of cores. If you have blocking processes (disk_io, long threads, etc), then you can increase that.

worker_processes * worker_connections = max clients

make sure you configure gzip. It probably isn't necessary to configure rcvbuf or backlog for your site, so, I wouldn't worry much about those settings.

As for your php threads, I would probably run 5-10 as you have. If you start getting 502 Gateway connect errors, you might need to increase that.

For php.ini, the default settings should work fine. If you are uploading pictures/media, increase post_max_size and upload_max_filesize for your requirements. APC is pretty much an out of the box config and should work fine.

Since you're using W3 Total Cache, you are also eliminating a number of hits to php, which should put less load on php-cgi anyhow.

2
  • The equation is wrong. Nginx master process cannot provide even distribution of requests across the workers. Which means, there is a possibility a worker will hit worker_connections limit. So, the multiply of worker_processes and worker_connections must be somewhat higher than expected maximum number of connections. Jun 17, 2010 at 7:56
  • while I do agree, it is a general guideline. You might suggest your change to wiki.nginx.org/NginxCoreModule#worker_processes Jun 17, 2010 at 8:09

You must log in to answer this question.