<code>pm = static pm.max_children = 500 </code>
https://segmentfault.com/a/1190000002488698 This article says:pm.max_children 数量的多少根据机器内存确定,基本上一个进程需要30M的内存,假设起100个进程,那么就是3000M,3G内存
A process here requires 30M of memory. How was it calculated?
What is the reasonable basis for calculating the pm.max_children configuration value?
<code>pm = static pm.max_children = 500 </code>
https://segmentfault.com/a/1190000002488698 This article says:pm.max_children 数量的多少根据机器内存确定,基本上一个进程需要30M的内存,假设起100个进程,那么就是3000M,3G内存
A process here requires 30M of memory. How was it calculated?
What is the reasonable basis for calculating the pm.max_children configuration value?
30M of memory is run out. Take the production machine and run it, it is usually around 10-30M. Look at the res and shr of top
In addition to memory, it also depends on the machine CPU, the number of visits, etc.
For example, if there are 100 requests per second, it is best to open a little more than 100, so that it is neither idle nor waiting.
How much memory does a php process occupy? It is about 20MB (specifically, it depends on how many modules your php has loaded). You can use the pmap command to see where memory is occupied. Therefore, try not to load unnecessary PHP extension modules to reduce unnecessary memory waste.
<code>pmap $(pgrep php-fpm | head -1)</code>
The consumption of a single PHP process is different. When testing your PHP program, you can use the memory_get_peak_usage(true)
function to obtain the memory peak value as the program memory consumption of a single request, and take PHP- The basic memory consumption of fpm itself can be used to obtain an approximate memory consumption of a single process.
http://blog.tanteng.me/2016/03/php-fpm-conf/
Please refer to this article