I know this will be hard, but I'm willing to try the Q&A route.

I have a Wordpress site that currently has 60,000 visitors on the site at once.

I'm using an EC2 m3.xlarge, php/php-fpm 5.5.10, nginx 1.4.7, php-apc.

For caching plugin I'm using WP-Super-Cache.

I'm noticing a very slow response time, lots of 502 errors, plus... I have tons of errors like these in my nginx log:

10319#0: *57132 connect() to unix:/tmp/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream

I'm confused what the heck the bottle neck is...

  • I have 4 CPU cores, each at about ~15%... total load avg of .85-1 constant
  • ~4GB used of 16GB
  • RDS at 60% CPU usage, low latency for reads and writes

For my settings... ive basically exhausted all my knowledge + hours of googling...

  • 100 max_children for php-fpm
  • 4096 for backlog & somaxconn
  • nginx: worker_rlimit_nofile 200000
  • nginx: worker_processes 8
  • nginx: worker_connections 32768

I don't know if some of these are too high or low, I've tried to tweak it to the best of my ability...

I don't even really know how to find the problem either. When I look through slow log it's just a lot of random stuff probably because everything is going slow... not just one thing.

  • I already tried that (see my bullet list). Both are at 4096 – Tallboy Apr 24 '14 at 3:46
  • 2
    Apparently it needs to be much larger. And anyway, you should be scaling out, not up. – Michael Hampton Apr 24 '14 at 3:50
  • interesting.. ok – Tallboy Apr 24 '14 at 3:54
  • as for scaling out... yes I know, the syncing cache files and stuff is not fun for me... i guess its that time though :( – Tallboy Apr 24 '14 at 3:55

Some monitoring and graphing tool would be useful to pinpoint the location of bottleneck. We use http://munin-monitoring.org/ Munin grabs stats from most of known services plus system metrics and it works almost out-of-the-box on modern distros.


I think pm.max_children = 100 is way too small for 60k concurrent visitors. Even if a visitor clicks a link only once in a minute on average then you'd need to generate 1000 page views in a second (60000/60).

You have 12GB of unused memory — set for example pm.max_children = 500. Maybe even higher - depending how much RAM is needed to generate an average request. Observe RAM usage and tune number on children accordingly.


You are using 8 nginx worker_processes 8 when you only have 4 cores? I'd suggest using 3 and then allowing the remaining cpu core for other machine tasks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.