pm.max_children = 10
pm.max_requests = 500
To find the optimal settings for pm = ondemand with pm.max_children = 10 and pm.max_requests = 500, you can use the following approach:
Calculate pm.max_children:
The pm.max_children setting limits the maximum number of child processes allowed to be spawned.
You can roughly determine a sensible value for pm.max_children by dividing the available system memory by the maximum child process size
.
For example, if you have a total of 16GB and your processes consume 100 MB each: 16000100=16010016000=160, meaning you should be able to run roughly a little under 160 children before running out of memory
.
Set pm.max_requests:
pm.max_requests sets the number of requests each child process should execute before respawning.
This setting is helpful for working around memory leaks.
For the given scenario, you can set pm.max_requests = 5002
.
Monitor and adjust:
It's important to monitor the server's performance and adjust these settings based on the actual resource usage and traffic patterns
.
By following these steps, you can determine and set the optimal values for pm = ondemand with pm.max_children = 10 and pm.max_requests = 500 based on your server's resources and the specific requirements of your PHP applications.