• We value your experience with Plesk during 2024
    Plesk strives to perform even better in 2025. To help us improve further, please answer a few questions about your experience with Plesk Obsidian 2024.
    Please take this short survey:

    https://pt-research.typeform.com/to/AmZvSXkx
  • 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.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Question Struggling to calculate pm.max_children and share between sites

jim.wilson

New Pleskian
Server operating system version
CentOS Linux 7.9.2009 (Core)
Plesk version and microupdate number
Plesk Obsidian
Hi all,

I am struggling to get a happy balance on pm.max_children and am having issues with the server maxing out resources

Following https://support.plesk.com/hc/en-us/articles/360011988053

Here is the results of ps -ylC php-fpm --sort:rss

Capture.PNG

Server: 64Gb, 32 Core

The server runs

a - very busy site (On Dedicated FPM > Apache)
b - average site (On Dedicated FPM > Apache)
c & d - very small sites (On Fast CGI)

Site a regularly has problems with FPM consuming vast CPU & memory


Any thoughts/suggestions on how to balance / resolve issues ?

Thanks
 
There is not really anthing like "balancing" the PHP-FPM processes. If a request comes in, PHP will try to process it. You either provide enough resource for it or new requests cannot be processed.

You'll need to find the root cause in the access_ssl_log of your website. Normally it is bad bots that are causing a high load. Exclude them either by blocking the source IPs or by blocking their bot names, e.g. by .htaccess commands.
 
For troubleshooting purposes I can also recommend enabling the fpm status dashboard.
This often allows for easy identification of abusive PHP requests and also gives a good overview on what is really running at the time.

In order to do so, you need to:

a) add the following lines into "Additional directives" section of the PHP settings for this page
Code:
[php-fpm-pool-settings]
pm.status_path = /fpm-status

b) add the following lines into the additional Apache directives ("Apache & nginx Settings") of your site (replace the DOMAIN.TLD with the domain name of this site)
Code:
<LocationMatch ^/fpm-status>
    SetHandler proxy:unix:/var/www/vhosts/system/DOMAIN.TLD/php-fpm.sock|fcgi://127.0.0.1:9000
</LocationMatch>

After that you can access this status page via the URL: https://DOMAIN.TLD/fpm-status?full&html

If you plan to use this for a longer time, I recommend to "customize/randomize" the fpm-status URL somewhat or limit the access to your IP address or enable username/password authentication.
 
Back
Top