1

After switching pm from dynamic to ondemand I'm having less problems with memory usage on my 1GB VPS, but it seems that under some high load situations the server still gets stuck. It's an VMWare VPS with 1GB real RAM and 4GB 'fake RAM' (SSD Cache).

I installed newrelic server monitoring and realized that the problem still seems to be php5-fpm. The server goes up to a load of 150 (2 cpu system) and all php-fpm pools spawn their maximum of 10 children which eats up almost 2,5 GB RAM while the average RAM usage on the system is 300 MB.

If I understand ondemand correctly, all the spare server settings are of no use and the spawned childs should die after the request is finished. So the only thing I could possibly do is to lower max_children further, but because I have 30+ pools I guess this wouldn't help me either way.

This is my standard pool config:

[web2]

listen = 127.0.0.1:9011
listen.allowed_clients = 127.0.0.1

user = web2
group = client1

pm = ondemand
pm.max_children = 10
pm.process_idle_timeout = 10s;
pm.max_requests = 0

Has anybody an idea how to optimize this setup so the server doesn't get hang in high load situations?

******EDIT****** I tried process.max = 32 but I'm quite unsure if that is even changing something when using ondemand. Server collapsed again today and I have no clue what the problem is. Totally moderate traffic. If I to a rush using blitz.io on a page everything goes smooth. He spawns all 10 children and delivers pages as fast as he can while delivering a immediate 500 to any more requests without making the server explode.

6
  • What I feel I have to to somehow (don't know if it's really helpfull), is to limit the total number of processes spawned (across all pools), so that I won't overcommit my RAM and won't get into the RAM swapping-hell which happens above the 1 GB boarder. Because spawning more processes in this state will likely make everything worse (the requests will take longer, so even more processes will get spawned). But I can't find out how it is possible to configure php5-fpm this way.
    – s1lv3r
    Jun 19, 2013 at 12:58
  • If you're experiencing such high loads, why on earth are you not upgrading the RAM on the VPS?
    – pauska
    Jun 20, 2013 at 12:25
  • Next RAM upgrade with this provider would almost double the cost and I'm pretty unsure this will solve the problem. I still think this is some problem related to the configuration. This server just replaced an old VPS under Ubuntu 8.0.4 with apache2-mpm-prefork and mod-php, which ran the same workload with half of the RAM. I just don't really believe that I'll need 4 times the RAM (512 vs 2048) for the same workload after switching to php-fpm.
    – s1lv3r
    Jun 20, 2013 at 12:34
  • OK then. Why are you letting PHP-FPM spawn 10 children? Have you tried setting it to something like 3, and see if that still gives you enough performance?
    – pauska
    Jun 20, 2013 at 12:37
  • Yeah, my problem is, having one site with 10 children is perfectly fine (and needed as the pages have different loads and need to handle some spiking, too), but if all 30 pages spawn their 10 children the server literally explodes. process.max sounds like a nice solution, but doesn't seem to do any change.
    – s1lv3r
    Jun 20, 2013 at 12:47

1 Answer 1

0

Finally found the problem.

After having read so much about the Wordpress botnet, I don't know why I didn't thought about that in the first time. All of the pools are Wordpress sites and they are beeing hit at random times by the botnet all at the same time which makes the server freak out.

I now installed fail2ban (I'm pretty sure I also had this done on the old server ...) and also lowered max_children and it seems the server can now survive an attack without the need to reboot.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .