简体   繁体   中英

PHP-FPM for WordPress gobbling up memory

I have a small, though not tiny, VPS: 1.5GHz, 1GB dedicated RAM, 1GB burstable RAM, some 40GB HDD.

The stack is CentOS nginX mySQL(Percona) PHP-FPM.

I have 3 low traffic websites (10-40 visitors a day per site) each running a separate instance of WordPress.

Additionally, I have 3 more instances of WordPress. These 3 sites aren't launched yet, so effectively traffic is zero.

The CPU usage has never gone north of 5% in the last month or so.

Yet, PHP-FPM process is taking up a ton of memory. At the moment, I am using 3GB (don't know how...because dedicated+burstable available to me should only be 2GB).

PHP-FPM process for the 3 active websites are using 732MB, 438MB and 89MB respectively.

PHP-FPM process for the 4 zero-traffic, zero-content websites are using 679MB, 621MB, and 596MB respectively.

Further:

  • php-fpm (apache) 127MB
  • mysqld 122MB
  • nginx 44MB
  • named 21MB
  • miniserv.pl 20MB
  • lfd 16MB
  • php-fpm (ispconfig) 13MB
  • php-fpm (ispapps) 13MB
  • php-fpm (root) 7MB
  • newrelic-daemon 7MB
  • nginx(root) 4MB
  • rsyslogd(root) 3MB
  • nrsysmond(newrelic) 3MB
  • mysqld_safe(root) 2MB

Sample PHP-FPM config: http://hennalap.com/phpinfo.php

For most of these sites, conf file has values like

pm = dynamic  
pm.max_children = 10  
pm.start_servers = 2  
pm.min_spare_servers = 1  
pm.max_spare_servers = 5  
pm.max_requests = 0

PHP-FPM is the culprit.

I started looking for an update and found that my version (5.3.3) was the last independent version of PHP-FPM. Subsequently it was merged into the main PHP project.

PHP is already on 5.5.0 so I decided to upgrade to that. However, ISPConfig3 is not compatible with 5.5.0 so I ended up upgrading to 5.4.16 instead.

I also set pm = ondemand (though pm = dynamic could have worked equally well).

Now, my memory usage is 450MB, down from some 3.5GB!

Umm may bad config, PHP-fpm never kill child ( so never restar, never clean RAM ), APC caching, php-fpm use 128 MB of RAM each process is they dont restart can use a lot of RAM.

Maybe you can post some logs and configuration.

You use w3tc on wordpress or some plugin than caching and save info on APC ?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM