1000 FAQs, 500 tutorials and explanatory videos. Here, there are only solutions!
Resolve an infinite site loading (increase the max_children value)
This guide explains how to increase the max_children value on Cloud Server to increase 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 your site's pages.
By default, the max_children limit is set to 20. While it is possible to increase this value from the Infomaniak Manager, the max_children limit is automatically adjusted based on your Cloud Server's configuration.
On shared hosting, the maximum limit for max_children is 20. To increase this limit, it is necessary to migrate to a Cloud Server.
Prerequisites
- ensure you have the necessary resources on the Cloud Server
- make sure that all resources of the Cloud Server are not being used; if they are fully utilized, increasing the max_children value will have no effect (Modify Cloud Server resources)
- check the resource monitoring of your server; if your server resources are reached, it will be necessary to verify the optimization of processes and your site before considering increasing the max_children value
- consult the PHP error logs 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 an error:
[05-Jul-2023 09:08:58] WARNING: [pool www.infomaniak.ch] server reached max_children setting (20), consider raising it
Limits Based on Server
Max_children limits 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 |
How to accurately calculate the necessary max_children: read the article Adjusting child processes for PHP-FPM
Increase the max_children Value
To access the site for which you need to increase the max_children value on the hosting located on Cloud Server:
- log in to the Infomaniak Manager (manager.infomaniak.com) from a web browser like Brave or Edge
- click on the ‍ icon in the upper right corner of the interface (or navigate using the left sidebar menu, for example)
- select Cloud Server (Web & Domain universe)
- click on the name of the relevant server in the displayed table
- click on Web Hosting in the left sidebar 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 see the result of a pool of PHP processes without having to navigate through htop:
ps aux | grep "php-fpm: pool domain_here"
To get the number of processes, keep in mind that you always need 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 you 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") }'