• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Resolved php-fpm memory leak?

Tigzy

Basic Pleskian
Hello,
I'm having an issue on our prod server.
The memory usage for apache is growing until it eats it all. Every week, I have to restart the php-fpm handler to release the memory.

upload_2018-10-19_9-36-28.png

I'm running:
I haven't been able to isolate a specific app, it looks like a general issue.
I've migrated all the apps from an older PHP version (7.0) to 7.2, it doesn't solve the issue.

Any additional information you'd need ? Any hint cause I have no idea which way to go to continue investigation, my next step (last solution) would be to reinstall the server...
 
Likely some scripts are responsible for this, not PHP-FPM itself. Have you set all PHP configurations to pm = "ondemand" (do not use "static", neither "dynamic")? That should ensure that RAM and processes are freed when they are no longer needed. Also check pm.max_childrenand pm.max_requests, maybe apply appropriate changes there for your system.
 
Thanks Peter,
Currently everything is setup on "ondemand" and the max_children takes the number of domains in account.

upload_2018-10-19_10-5-21.png
 
It *appears* to be fixing the issue, yay ! :)
Giving a few more days before closing the thread.

So this means there's some 3rd party lib somewhere having a leak, right ?

upload_2018-10-22_8-58-31.png
 
If you use php-fpm it may be worth it to add
pm.process_idle_timeout = 10s;
to php.ini (settings > php settings > click on php handler > php ini)
 
I'll set max_requests to 500 see if there's a change.
A value of 10000 can be appropriate, too. 500 is quite low.

If you use php-fpm it may be worth it to add
pm.process_idle_timeout = 10s;
to php.ini (settings > php settings > click on php handler > php ini)
Here, an even shorter window can also work very well. There is no need for long idle times. Most PHP processes will finish within milliseconds, so an idle time of 5s or even lower can still work well and free resources to give your system more headroom.
 
A value of 10000 can be appropriate, too. 500 is quite low.


Here, an even shorter window can also work very well. There is no need for long idle times. Most PHP processes will finish within milliseconds, so an idle time of 5s or even lower can still work well and free resources to give your system more headroom.
You brilliantly read in my mind @Peter Debik , after posting, I told myself hummm 10 seconds is pretty high because the people who want to kill our server send TCP SYN flood attack, and they take advantage of the late timeout. If the timeout is 30 seconds they can send many requests which will overwhelm and take down the server
 
I have added the following to the additional settings in php settings of my service plan:

[php-fpm-pool-settings]
pm.process_idle_timeout = 5s;
 
Back
Top