Try To Optimizing php-fpm7.3 Configuration with NGINX
1 min readAug 2, 2019
See the file of configuration on
vi /etc/php/7.3/fpm/pool.d/www.conf
1. pm.max_children
You need to divided by 2. Why? Because your server won’t server all process only for php-fpm, so my calculate is half RAM of the server needed for other processes. Then divided by per php-fpm process 30~40MB
Check Memory:
free -m
Check php-fpm process:
ps --no-headers -o "rss,cmd" -C php-fpm7.3 | awk '{ sum+=$1 } END { printf ("%d%s\n", sum/NR/1024,"Mb") }'
Example:
Server RAM = 4GB
4GB / 2 / 30MB = 66~
2. pm.start_servers
I multiply the server number of cores by 4
Example:
Server Core = 2
2 x 4= 8
3. pm.min_spare_servers
I multiply the server number of cores by 2
Example:
Server Core = 2
2 x 2= 4
4. pm.max_spare_servers
I multiply the server number of cores by 4
Example:
Server Core = 2
2 x 4= 8
And then restart / reload the php by
sudo service php7.3-fpm restart