Support » Localhost Installs » PHP-FPM for WordPress gobbling up memory

  • Resolved OC2PS

    (@sooskriszta)


    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

Viewing 4 replies - 1 through 4 (of 4 total)
  • You seem to be using ispconfig that may be configuring php-fpm with the value of “pm” as “static”. For an efficient setup, you may get rid of ispconfig or you may configure php-fpm efficiently. For example, “pm” in php-fpm can be configured to be “static”, “ondemand” or “dynamic”. I guess, currently, “pm” is static.

    As a first step, you may lower the “pm.max_children”, if you wish to keep “pm” as “static”, assuming ispconfig allows you to change these values.

    Changing the “pm” to dynamic or ondemand would make the memory more efficient. Ideally, you may remove ispconfig altogether and let you configure each site’s memory. If all the sites are yours, there doesn’t need to be any separate php process (or set of processes) for each site. In this case, php-fpm can be optimized even further.

    For more info on various php-fpm configuration, please visit http://www.php.net/manual/en/install.fpm.configuration.php .

    I hope that helps.

    Thread Starter OC2PS

    (@sooskriszta)

    For these sites, typical conf values look like this

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

    I’ll try changing pm from dynamic to ondemand to see if that helps.

    Thread Starter OC2PS

    (@sooskriszta)

    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!

    I’m glad to know you found a way to reduce the memory usage.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘PHP-FPM for WordPress gobbling up memory’ is closed to new replies.