4

It seems php-fpm is allocating more and more memory, although peaks and dips in amount of requests. Couldn't post more than one image, so I put them here.

As you can see in the uri of the pictures, one pictures nginx requests, showing clear dips and peaks. The others, which are php-fpm memory and average memory per child doesn't seem to follow the same pattern at all. Only a restart of php-fpm will have an effect, and even then I can't say I notice any change in performance.
The system is fine, response time is good and all is well, just curious if this is expected behaviour, and if it either has performance benefits or should be avoided (by lowering max_requests or something?).

System is running Debian GNU/Linux 6.0 Squeeze, AMD64. PHP version 5.3.6. PHP 5.3.6


pool.d/www.conf:

pm.max_children = 50
pm.start_servers = 30
pm.min_spare_servers = 5
pm.max_spare_servers = 35
pm.max_requests = 1024


I have gotten these in php-fpm.log since it was freshly installed:

[28-Jun-2011 14:45:39] WARNING: [pool www] child 1893 exited on signal 9 (SIGKILL) after 22296.217811 seconds from start
[28-Jun-2011 14:45:39] NOTICE: [pool www] child 18391 started
[28-Jun-2011 14:45:39] WARNING: [pool www] child 1903 exited on signal 9 (SIGKILL) after 22296.213677 seconds from start
[28-Jun-2011 14:45:39] NOTICE: [pool www] child 18392 started
[28-Jun-2011 14:45:39] WARNING: [pool www] child 1904 exited on signal 9 (SIGKILL) after 22296.213757 seconds from start
[28-Jun-2011 14:45:39] NOTICE: [pool www] child 18393 started
[28-Jun-2011 14:45:39] WARNING: [pool www] child 1905 exited on signal 9 (SIGKILL) after 22296.214307 seconds from start
[28-Jun-2011 14:46:20] NOTICE: fpm is running, pid 18410
[28-Jun-2011 14:46:20] NOTICE: ready to handle connections
[28-Jun-2011 15:10:04] NOTICE: Terminating ...
[28-Jun-2011 15:10:04] NOTICE: exiting, bye-bye!
[28-Jun-2011 15:10:04] NOTICE: fpm is running, pid 1742
[28-Jun-2011 15:10:04] NOTICE: ready to handle connections
[28-Jun-2011 15:10:22] NOTICE: Terminating ...
[28-Jun-2011 15:10:22] NOTICE: exiting, bye-bye!
[28-Jun-2011 15:10:22] NOTICE: fpm is running, pid 2016
[28-Jun-2011 15:10:22] NOTICE: ready to handle connections
[28-Jun-2011 15:28:04] NOTICE: Terminating ...
1
  • exact same problem in php 5.3.8, nginx 1.1.4. php-fpm and/or nginx processes constantly increase in ram usage until the vps simply runs out of it. the culprit appears to be nginx using all the ram according to 'top'. still no resolution via google or nginx/php-fpm irc, as it seems a relatively unknown phenomenon. i tried changing various php-fpm configs, even nginx configs, changed ulimit open files, although changing php-fpm to lower max-requests seems to help, but doesn't solve the problem (it just takes longer to max out the ram). i've only got 2 nginx worker processes running, 2048 worker_
    – user95783
    Commented Sep 24, 2011 at 20:34

2 Answers 2

3

Some ideas:

  1. Lower your fpm settings then increase as needed:

    pm.max_children = 10 # concurrent children's
    pm.start_servers = 2
    pm.min_spare_servers = 2
    pm.max_spare_servers = 4
    pm.max_requests = 300 # till restart

  2. Lower the nginx settigns.

  3. Install pecl-apc(Debian package is php5-apc).

  4. Update your php/nginx version to latest stable

What is your server spec?

3

Check how much RAM you have to spare (perhaps stop php-fpm to calculate this) and how much memory a php-fpm process typically takes for your webapp (look at top or ps) and then set pm.max_children = available RAM / php-fpm process RAM , otherwise you'll run out of memory.

You must log in to answer this question.

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