• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.

Question PHP-FPM (pm.max_requests) Query

maximus99

Basic Pleskian
Server operating system version
Centos7.9
Plesk version and microupdate number
18.0.52
PHP-FPM (pm.max_requests) Query

We are running plesk 18.0.52 using PHP-FPM for a domain . but as per plesk php config for pm.max_requests it shows Standard in Panel what it means ? default value 0 ? But still its not showing in configuration as show below

1722001187185.png

pm = ondemand
pm.max_children = 20
pm.max_spare_servers = 1
pm.min_spare_servers = 1
pm.process_idle_timeout = 10s
pm.start_servers = 1

Please advise what is my current value or what is standard ? And for this config what could be a ideal value to set . I agree it has some calculations we have some hug traffic and memory consumption
 
The Plesk article referenced does not address pm.max_requests - only pm.max_children.

The default value of 0 can be dangerous if there is a memory leak in a third-party library. We experienced this issue once in the past. As a result, the servers became unstable because the available free memory was gradually consumed (a small memory leak, but each PHP request led to a growing PHP process).

However, a common recommendation is to set it between 500 and 1,000 requests. This range is often effective in balancing performance and preventing memory leaks.
 
No that didnt fixed my issue . One of our particular domain is going down multiple times between 12:00 AM to 4:00 AM . We are not sure what is causing that

1. No errors in DB side
2. didnt see errors in apache logs or the OS logs

this is the php-fpm parameters we have set for that particular domain , Any advise would be helpful


php_value[error_reporting] = 22519
php_value[max_execution_time] = 400
php_value[max_input_time] = 150
php_value[max_input_vars] = 1500
php_value[memory_limit] = 1024M
php_value[open_basedir] = none
php_value[post_max_size] = 128M
php_value[upload_max_filesize] = 128M


pm = ondemand
pm.max_children = 20
pm.max_requests = 800
pm.max_spare_servers = 1
pm.min_spare_servers = 1
pm.process_idle_timeout = 60
pm.start_servers = 1
request_terminate_timeout = 500
 
What is meant by "going down"?
Is there a lot of activity in the Apache logs between midnight an 4 am?
Why is PHP-FPM suspected as a root cause?
 
What is meant by "going down"? -- In our monitoring tool we have set the polling like if we dont get a status 200 in web check . it will notify and mark us its not reachable.
Is there a lot of activity in the Apache logs between midnight an 4 am? -- Well i could see in access_ssl_logs some 404 and 500 of our monitoring tool trying to check particular domain . I see its generic as its throwing after 4 AM as well.
We could see this message in error log : [proxy_fcgi:error] AH01068: Got bogus version 34 , And this as well generic.

Finally the proxy error log :

2024/07/31 00:39:01 [error] 6921#0: *9907 upstream prematurely closed connection while reading response header from upstream,
2024/07/31 00:39:03 [error] 6919#0: *12580 connect() failed (111: Connection refused) while connecting to upstream,
We see these upstream connection close errors

And to avoid this we have to fine tune the php-fpm is what the other KB or document says so we have suspected it could be because of that as its only issue with this particular domain.
 
Would it not be a better approach to examine what the website scripts are doing and specifically where they spend most of the execution time instead of increasing server resources?
 
Back
Top