简体   繁体   English

WordPress的PHP-FPM占用了内存

[英]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. 我有一个很小但不是很小的VPS:1.5GHz,1GB专用RAM,1GB可爆RAM,约40GB HDD。

The stack is CentOS nginX mySQL(Percona) PHP-FPM. 堆栈是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. 我有3个低流量网站(每个网站每天10-40个访问者),每个网站都运行一个单独的WordPress实例。

Additionally, I have 3 more instances of WordPress. 此外,我还有3个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. 在过去一个月左右的时间内,CPU使用率从未超过5%。

Yet, PHP-FPM process is taking up a ton of memory. 但是,PHP-FPM进程占用了大量内存。 At the moment, I am using 3GB (don't know how...because dedicated+burstable available to me should only be 2GB). 目前,我正在使用3GB(不知道如何使用...因为我可以使用的专用+突发数据应该只有2GB)。

PHP-FPM process for the 3 active websites are using 732MB, 438MB and 89MB respectively. 3个活动网站的PHP-FPM进程分别使用732MB,438MB和89MB。

PHP-FPM process for the 4 zero-traffic, zero-content websites are using 679MB, 621MB, and 596MB respectively. 这四个零流量,零内容网站的PHP-FPM进程分别使用679MB,621MB和596MB。

Further: 进一步:

  • php-fpm (apache) 127MB php-fpm(apache)127MB
  • mysqld 122MB MySQLd的122MB
  • nginx 44MB nginx 44MB
  • named 21MB 命名为21MB
  • miniserv.pl 20MB miniserv.pl 20MB
  • lfd 16MB lfd 16MB
  • php-fpm (ispconfig) 13MB php-fpm(ispconfig)13MB
  • php-fpm (ispapps) 13MB php-fpm(ispapps)13MB
  • php-fpm (root) 7MB php-fpm(根目录)7MB
  • newrelic-daemon 7MB newrelic守护程序7MB
  • nginx(root) 4MB nginx(根)4MB
  • rsyslogd(root) 3MB rsyslogd(根)3MB
  • nrsysmond(newrelic) 3MB nrsysmond(newrelic)3MB
  • mysqld_safe(root) 2MB mysqld_safe(根)2MB

Sample PHP-FPM config: http://hennalap.com/phpinfo.php 示例PHP-FPM配置: http : //hennalap.com/phpinfo.php

For most of these sites, conf file has values like 对于大多数这些网站,conf文件的值如下

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. PHP-FPM是元凶。

I started looking for an update and found that my version (5.3.3) was the last independent version of PHP-FPM. 我开始寻找更新,发现我的版本(5.3.3)是PHP-FPM的最后一个独立版本。 Subsequently it was merged into the main PHP project. 随后,它被合并到主要的PHP项目中。

PHP is already on 5.5.0 so I decided to upgrade to that. PHP已经在5.5.0上,因此我决定升级到该版本。 However, ISPConfig3 is not compatible with 5.5.0 so I ended up upgrading to 5.4.16 instead. 但是,ISPConfig3与5.5.0不兼容,因此我最终升级到了5.4.16。

I also set pm = ondemand (though pm = dynamic could have worked equally well). 我还设置了pm = ondemand(尽管pm = dynamic可以同样有效地工作)。

Now, my memory usage is 450MB, down from some 3.5GB! 现在,我的内存使用量从3.5GB降至450MB!

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. 嗯,配置可能不好,PHP-fpm永远不会杀死子进程(所以永远不要重做,永远不要清理RAM),APC缓存,php-fpm使用128 MB的RAM,每个进程只要不重启就可以使用很多RAM。

Maybe you can post some logs and configuration. 也许您可以发布一些日志和配置。

You use w3tc on wordpress or some plugin than caching and save info on APC ? 您在wordpress或某些插件上使用w3tc而不是缓存并在APC上保存信息?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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