1000 FAQs, 500 tutorials and explanatory videos. Here, there are only solutions!
Resolve an infinite site loading (increase the value of max_children)
This guide explains how to increase the value of max_children on a Managed Cloud Server to raise the number of simultaneous PHP processes that can be used by your site. This will be very useful for resolving issues with infinite loading of pages on your site.
By default, the max_children limit is set to 20. Although it is possible to increase this value from the administration console of your Cloud Server, the max_children limit is automatically adjusted based on your Cloud Server's configuration.
Prerequisites
- Ensure you have the necessary resources on the Cloud Server.
- Ensure that all resources of the Cloud Server are not fully utilized; if they are entirely used, increasing the value of max_children will have no effect (Modify Cloud Server Resources).
- Check the resource monitoring of your server. If your server resources are depleted, it will be necessary to check process and site optimization before considering increasing the value of max_children.
- Consult PHP error reports from the /ik-logs folder (master process PHP logs - filename: php-fpm.log) to check if the "max_children" limit has been exceeded. Example of error:
[05-Jul-2023 09:08:58] WARNING: [pool www.infomaniak.ch] server reached max_children setting (20), consider raising it
Limits Depending on the Server
Limit of max_children based on Cloud Server resources:
Cloud Server Configuration | max_children |
---|---|
2 CPU | 6 GB RAM | 20 |
4 CPU | 12 GB RAM | 40 |
6 CPU | 18 GB RAM | 60 |
8 CPU | 24 GB RAM | 80 |
12 CPU | 36 GB RAM | 120 |
16 CPU | 48 GB RAM | 160 |
24 CPU | 72 GB RAM | 240 |
32 CPU | 96 or 128 GB RAM | 320 |
Increase the value of max_children
To access the site for which max_children needs to be increased on the hosting located on the Cloud Server:
- Log in to the Infomaniak Manager (manager.infomaniak.com) from a web browser like Brave or Edge.
- Click on the icon at the top right of the interface (or navigate through the left side menu, for example).
- Choose Cloud Server (Web & Domain universe).
- Click on the name of the relevant server in the displayed table.
- Click on Web Hosting in the left side menu.
- Click on the name of the relevant hosting in the displayed table.
- Click on the name of the relevant site in the displayed table.
- Click on the Advanced Settings button.
- Click on the PHP tab.
- Click on Advanced Options.
- Choose a new value for max_children.
- Click on the blue Save button.
Advanced Commands
This command allows you to directly get the result of a pool of PHP processes without having to navigate in htop:
ps aux | grep "php-fpm: pool domain_here"
To get the number of processes, knowing that it is always necessary to subtract 1 because it also counts the grep process itself:
ps aux | grep "php-fpm: pool domain_here" | wc -l
This command will show the average memory usage in kilobytes per process in the RSS column:
ps -ylC php-fpm --sort:rss
The following command will calculate the average memory usage for all the above PHP-FPM processes in MB:
ps --no-headers -o "rss" -C php-fpm | awk '{ sum+=$1 } END { printf ("%d%s\n", sum/NR/1024,"Mb") }'