Managing CPU usage with PHP-FPM
We recently increased the Max Children from 5 (default) to 20 in the MultiPHP Manager to help with an increase in traffic to our website. However, there are times when the PHP-FPM 'pool' processes may use up to 30-40% CPU during the day, which causes the reverse effect where the site slows down. Any suggestions?
Current PHP-FPM config for domain and system:
PHP-FPM Pool Options
Max Requests: 20
Process Idle Timeout: 10
Max Children: 20
-
Hello, I believe PHP-FPM would not be responsible for the bottle-neck. I would recommend you to follow this guide: which provides you with detailed information on how to troubleshoot load. You know that PHP-FPM is up to 40% the above guide, should help you identify which specific accounts/domains are causing the issue. If you notice the problem is the one website, can you provide us with the output of the following commands? sar -p sar -S nproc wc -l /etc/userdomains free -h
The above would not provide any sensitive information, as it is only gathering resource-related information. Thanks,0 -
If you notice the problem is the one website, can you provide us with the output of the following commands?
sar -p sar -S nproc wc -l /etc/userdomains free -h
Here's the output:Linux 3.10.0-1127.el7.x86_64 (server.bumperplugs.com) 05/24/2020 _x86_64_ (2 CPU) 12:00:01 AM CPU %user %nice %system %iowait %steal %idle 12:10:01 AM all 10.29 0.02 1.33 3.03 0.66 84.67 12:20:02 AM all 6.79 0.05 1.13 2.46 0.69 88.88 12:30:01 AM all 33.81 0.03 3.58 5.51 0.63 56.43 12:40:02 AM all 25.85 0.03 2.82 4.50 0.82 65.99 12:50:01 AM all 27.50 0.03 2.90 4.71 0.47 64.39 01:00:02 AM all 31.77 0.02 3.23 5.88 0.47 58.64 01:10:01 AM all 46.46 0.06 4.68 18.50 0.53 29.77 01:20:01 AM all 18.46 0.02 2.08 39.13 0.59 39.71 01:30:01 AM all 14.79 0.03 1.81 41.61 0.57 41.20 01:40:02 AM all 10.37 0.02 1.48 54.79 0.67 32.67 01:50:02 AM all 13.64 0.03 1.88 42.05 0.61 41.80 02:00:02 AM all 21.69 0.05 2.45 3.87 0.52 71.41 02:10:01 AM all 13.26 0.03 1.91 6.59 0.74 77.48 02:20:02 AM all 8.17 0.02 1.15 5.01 0.56 85.09 02:30:01 AM all 4.61 0.03 0.90 1.74 0.52 92.21 02:40:01 AM all 4.34 0.02 0.86 1.37 0.68 92.74 02:50:01 AM all 5.74 0.05 1.06 1.58 0.80 90.78 03:00:01 AM all 3.76 0.03 0.79 1.27 0.85 93.28 03:10:01 AM all 5.41 0.03 1.13 1.89 0.83 90.70 03:20:01 AM all 3.47 0.02 0.81 1.32 0.84 93.53 03:30:02 AM all 4.75 0.08 1.11 2.47 0.96 90.63 03:40:01 AM all 3.90 0.05 0.76 5.05 0.57 89.68 03:40:01 AM CPU %user %nice %system %iowait %steal %idle 03:50:01 AM all 5.45 0.02 0.92 3.98 0.59 89.03 04:00:01 AM all 4.09 0.02 0.75 3.64 0.56 90.93 04:10:01 AM all 5.72 0.03 1.19 2.93 0.67 89.45 04:20:01 AM all 3.60 0.02 0.71 3.08 0.55 92.04 04:30:01 AM all 5.67 0.05 0.96 3.07 0.53 89.72 04:40:01 AM all 4.67 0.02 0.82 1.30 0.69 92.50 04:50:02 AM all 4.40 0.03 0.91 1.59 0.69 92.38 05:00:01 AM all 5.71 0.03 1.06 1.39 0.62 91.20 05:10:01 AM all 4.16 0.03 1.01 1.46 0.78 92.55 05:20:01 AM all 5.15 0.05 1.09 1.94 0.63 91.15 05:30:01 AM all 4.78 0.03 0.82 1.42 0.69 92.26 05:40:01 AM all 5.06 0.02 0.91 1.88 0.57 91.57 05:50:01 AM all 4.64 0.03 0.86 2.01 0.59 91.88 06:00:02 AM all 3.77 0.02 0.72 1.50 0.51 93.48 06:10:01 AM all 5.44 0.72 1.26 2.16 0.64 89.77 06:20:01 AM all 7.02 0.02 1.25 2.65 0.62 88.42 06:30:02 AM all 4.80 0.05 0.95 2.59 0.75 90.87 06:40:01 AM all 6.00 0.02 0.97 2.24 0.77 89.99 06:50:01 AM all 6.89 0.02 1.19 2.47 0.59 88.84 07:00:01 AM all 4.73 0.02 0.92 1.27 0.55 92.50 07:10:01 AM all 15.76 0.03 1.07 1.63 0.60 80.91 07:20:02 AM all 15.60 0.05 1.28 2.80 0.58 79.69 07:20:02 AM CPU %user %nice %system %iowait %steal %idle 07:30:02 AM all 15.06 0.03 1.67 4.82 0.51 77.91 07:40:01 AM all 8.09 0.02 1.23 2.18 0.55 87.92 07:50:01 AM all 6.64 0.02 1.11 2.81 0.48 88.93 08:00:02 AM all 6.31 0.02 0.96 1.78 0.74 90.19 08:10:01 AM all 7.38 0.05 1.32 2.34 1.07 87.84 08:20:01 AM all 8.61 0.03 1.38 2.74 0.62 86.63 08:30:01 AM all 6.75 0.03 1.14 2.07 0.57 89.45 08:40:01 AM all 4.40 0.02 0.79 1.72 0.68 92.39 08:50:02 AM all 6.39 0.02 1.33 2.50 0.74 89.01 09:00:02 AM all 8.48 0.05 1.63 2.41 0.69 86.75 09:10:01 AM all 5.33 0.02 1.03 1.48 0.66 91.48 09:20:01 AM all 10.04 0.03 0.93 2.48 0.57 85.95 09:30:01 AM all 29.10 0.03 1.68 1.39 0.54 67.27 09:40:01 AM all 4.38 0.03 0.85 1.31 0.64 92.80 09:50:02 AM all 5.33 0.06 0.97 1.87 0.57 91.20 10:00:02 AM all 6.78 0.03 1.19 2.22 0.54 89.25 10:10:01 AM all 7.36 0.02 1.29 1.99 0.58 88.75 10:20:01 AM all 5.02 0.02 0.94 1.65 0.48 91.88 10:30:01 AM all 6.65 0.03 1.16 2.00 0.65 89.51 10:40:01 AM all 7.26 0.05 1.17 2.29 0.52 88.71 10:50:01 AM all 5.34 0.03 0.87 1.77 0.58 91.41 11:00:01 AM all 4.31 0.02 0.80 1.42 0.55 92.89 11:00:01 AM CPU %user %nice %system %iowait %steal %idle 11:10:01 AM all 8.30 0.02 1.50 2.84 0.71 86.63 11:20:02 AM all 10.22 0.03 1.49 3.12 0.54 84.61 11:30:02 AM all 8.23 0.04 1.40 2.97 0.53 86.82 11:40:02 AM all 6.27 0.03 1.24 1.76 0.57 90.14 11:50:01 AM all 7.03 0.03 1.03 2.12 0.52 89.27 12:00:01 PM all 6.62 0.03 1.09 1.98 0.55 89.72 12:10:01 PM all 15.24 0.03 2.01 4.49 0.66 77.57 Average: all 9.43 0.04 1.32 5.06 0.63 83.52 root@server.bumperplugs.com [~]# sar -S Linux 3.10.0-1127.el7.x86_64 (server.bumperplugs.com) 05/24/2020 _x86_64_ (2 CPU) 12:00:01 AM kbswpfree kbswpused %swpused kbswpcad %swpcad 12:10:01 AM 3895804 298496 7.12 79432 26.61 12:20:02 AM 3895804 298496 7.12 79432 26.61 12:30:01 AM 3895804 298496 7.12 79432 26.61 12:40:02 AM 3895804 298496 7.12 79432 26.61 12:50:01 AM 3895804 298496 7.12 79432 26.61 01:00:02 AM 3895804 298496 7.12 79432 26.61 01:10:01 AM 3895036 299264 7.14 71104 23.76 01:20:01 AM 3895036 299264 7.14 71104 23.76 01:30:01 AM 3895036 299264 7.14 71104 23.76 01:40:02 AM 3895036 299264 7.14 71104 23.76 01:50:02 AM 3895036 299264 7.14 71104 23.76 02:00:02 AM 3895036 299264 7.14 71104 23.76 02:10:01 AM 3895036 299264 7.14 71104 23.76 02:20:02 AM 3895036 299264 7.14 71104 23.76 02:30:01 AM 3895036 299264 7.14 71104 23.76 02:40:01 AM 3895036 299264 7.14 71104 23.76 02:50:01 AM 3895036 299264 7.14 71104 23.76 03:00:01 AM 3895036 299264 7.14 71104 23.76 03:10:01 AM 3895036 299264 7.14 71104 23.76 03:20:01 AM 3895036 299264 7.14 71104 23.76 03:30:02 AM 3895036 299264 7.14 71104 23.76 03:40:01 AM 3895036 299264 7.14 71104 23.76 03:40:01 AM kbswpfree kbswpused %swpused kbswpcad %swpcad 03:50:01 AM 3895036 299264 7.14 71104 23.76 04:00:01 AM 3895036 299264 7.14 71104 23.76 04:10:01 AM 3895036 299264 7.14 70652 23.61 04:20:01 AM 3895036 299264 7.14 70652 23.61 04:30:01 AM 3895036 299264 7.14 70652 23.61 04:40:01 AM 3895036 299264 7.14 70652 23.61 04:50:02 AM 3895036 299264 7.14 70652 23.61 05:00:01 AM 3895036 299264 7.14 70652 23.61 05:10:01 AM 3895036 299264 7.14 70652 23.61 05:20:01 AM 3895036 299264 7.14 70652 23.61 05:30:01 AM 3895036 299264 7.14 70652 23.61 05:40:01 AM 3895036 299264 7.14 70652 23.61 05:50:01 AM 3895036 299264 7.14 70652 23.61 06:00:02 AM 3895036 299264 7.14 70652 23.61 06:10:01 AM 3895036 299264 7.14 70356 23.51 06:20:01 AM 3895036 299264 7.14 70356 23.51 06:30:02 AM 3895036 299264 7.14 70356 23.51 06:40:01 AM 3895036 299264 7.14 70356 23.51 06:50:01 AM 3895036 299264 7.14 70356 23.51 07:00:01 AM 3895036 299264 7.14 70356 23.51 07:10:01 AM 3895036 299264 7.14 70368 23.51 07:20:02 AM 3894780 299520 7.14 70204 23.44 07:20:02 AM kbswpfree kbswpused %swpused kbswpcad %swpcad 07:30:02 AM 3894780 299520 7.14 69880 23.33 07:40:01 AM 3894780 299520 7.14 69880 23.33 07:50:01 AM 3894780 299520 7.14 69880 23.33 08:00:02 AM 3894780 299520 7.14 69880 23.33 08:10:01 AM 3894780 299520 7.14 69880 23.33 08:20:01 AM 3894780 299520 7.14 69880 23.33 08:30:01 AM 3894780 299520 7.14 69880 23.33 08:40:01 AM 3894780 299520 7.14 69880 23.33 08:50:02 AM 3894268 300032 7.15 68732 22.91 09:00:02 AM 3894268 300032 7.15 68704 22.90 09:10:01 AM 3894268 300032 7.15 68704 22.90 09:20:01 AM 3894268 300032 7.15 68704 22.90 09:30:01 AM 3894268 300032 7.15 68704 22.90 09:40:01 AM 3894268 300032 7.15 68704 22.90 09:50:02 AM 3894268 300032 7.15 68720 22.90 10:00:02 AM 3894268 300032 7.15 68720 22.90 10:10:01 AM 3894268 300032 7.15 68720 22.90 10:20:01 AM 3894268 300032 7.15 68720 22.90 10:30:01 AM 3894268 300032 7.15 68720 22.90 10:40:01 AM 3894268 300032 7.15 68720 22.90 10:50:01 AM 3894268 300032 7.15 68720 22.90 11:00:01 AM 3894268 300032 7.15 68720 22.90 11:00:01 AM kbswpfree kbswpused %swpused kbswpcad %swpcad 11:10:01 AM 3894268 300032 7.15 68728 22.91 11:20:02 AM 3894268 300032 7.15 68728 22.91 11:30:02 AM 3894268 300032 7.15 68728 22.91 11:40:02 AM 3894268 300032 7.15 68728 22.91 11:50:01 AM 3894268 300032 7.15 68728 22.91 12:00:01 PM 3894268 300032 7.15 68728 22.91 12:10:01 PM 3894268 300032 7.15 68728 22.91 Average: 3894847 299453 7.14 70810 23.650 -
Hello @msklut It is difficult to draw any conclusions with the information provided without knowing more about the parameters of your server configuration, the design of your sites, and the activity level of your sites. I would encourage you to submit a ticket using the link in my signature so that we could assist you in a more hands-on manner. Generally, the design and content of your site will have an effect on resource utilization. For example, a website with a large MySQL database that frequently reads and writes to the database will have much higher resource usage than a site with static HTML files. Even for a site that has only moderate resource usage, increasing the number of allowed children in the PHP-FPM pool options will cause resource usage to increase proportionately. Based on the information you've provided thus far, I would suggest you look into reviewing your site's code and optimizing it. However, we would be happy to review further via ticket to determine if there are any potential problems with the PHP-FPM configuration. Best regards. 0 -
Based on the information you've provided thus far, I would suggest you look into reviewing your site's code and optimizing it. However, we would be happy to review further via ticket to determine if there are any potential problems with the PHP-FPM configuration.
Thanks! Just submitted a ticket.0
Please sign in to leave a comment.
Comments
4 comments