Home > Article > Backend Development > What should I do if the php fpm process is not released?
The solution to the problem that the php fpm process is not released: 1. Reduce the memory usage of php-fpm by reducing the total number of php-fpm processes; 2. Reduce the number of "pm.max_requests".
The operating environment of this article: linux5.9.8 system, PHP7.1 version, DELL G3 computer
#php fpm process is not released. manage?
Solving the problem that the php-fpm process does not release memory
By reducing the total number of php-fpm processes to reduce the memory usage of php-fpm, actual use During the process, it was discovered that the php-fpm process still had the problem of occupying memory for a long time without releasing it. The solution is to reduce the number of pm.max_requests.
Maximum number of requests max_requests, that is, when the number of requests processed by a PHP-CGI process accumulates to max_requests, the process will be automatically restarted, thus achieving the purpose of releasing memory. Take the VPS host setting of 1GB memory as an example (if the value you set does not reach the free memory, you can continue to lower it):
pm.max_requests = 500
When the php-fpm process reaches the value set by pm.max_requests, it will Restart the process, thereby freeing up memory. The picture below is the result after my test. It can be seen that the php-fpm process was forcibly terminated and the memory was released.
Recommended study: "PHP Video Tutorial"
The above is the detailed content of What should I do if the php fpm process is not released?. For more information, please follow other related articles on the PHP Chinese website!