PHP-FPM Overloading CPU - AWS Instance

Keywords: WordPress Multisite - AWS - Technical issue - Services (Apache, MariaDB, MySQL…)

bndiagnostic ID: cbb5b4d9-2e1c-b1df-dfdf-7a220a77569f

bndiagnostic output:

? Apache: Found possible issues
? Mariadb: Found possible issues
https://docs.bitnami.com/general/apps/wordpress/troubleshooting/debug-errors-apache/
https://docs.bitnami.com/aws/apps/wordpress/troubleshooting/debug-errors-mariadb/

bndiagnostic failure reason: The suggested guides are not related with my issue

Description:
For the last 2 weeks, I am trying to figure out a reason why PHP-fpm keeps so many processes and most of the time that ends up with instance being overloaded and going offline.

I have a lot of websites running bitnami WordPress and something similiar happens with other but not that very often. One of multisites keep overloading last few days non stop.

I tried every possible solution that I found on forum and not a single one helped.
Tried:

  • Changing php-fpm processes to dynamic and on demand
  • Changing settings to everything that I found at the forum and outside
  • Used every calculcator to calculate php-fpm settings
  • Tried some config for apache

I did not managed to get php slow log as this might be a possible answer what might causing php to overload cpu.

This is how top looks like a few minutes after killing all stuck php-fpm PID’s

top - 14:10:30 up 1:24, 2 users, load average: 20.10, 11.84, 11.89
Tasks: 150 total, 20 running, 130 sleeping, 0 stopped, 0 zombie
%Cpu(s): 86.6 us, 12.3 sy, 0.0 ni, 0.2 id, 0.0 wa, 0.0 hi, 0.7 si, 0.3 st
MiB Mem : 3947.1 total, 1540.4 free, 1652.2 used, 754.5 buff/cache
MiB Swap: 0.0 total, 0.0 free, 0.0 used. 1969.1 avail Mem

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
23795 daemon 20 0 421148 115696 78960 R 13.3 2.9 0:28.91 php-fpm: pool www
28183 daemon 20 0 415444 97332 66356 R 13.3 2.4 0:33.92 php-fpm: pool www
27480 daemon 20 0 422804 111620 73136 R 13.0 2.8 0:50.49 php-fpm: pool www
28603 daemon 20 0 422460 108788 70544 R 12.0 2.7 0:37.43 php-fpm: pool www
29796 daemon 20 0 416284 108700 76592 R 11.6 2.7 0:24.82 php-fpm: pool www
24752 daemon 20 0 416496 104264 72112 R 11.0 2.6 0:11.17 php-fpm: pool www
24036 daemon 20 0 420812 107260 70636 R 10.6 2.7 1:45.92 php-fpm: pool www
32617 daemon 20 0 416616 101328 68896 R 10.6 2.5 1:46.51 php-fpm: pool www
24810 daemon 20 0 414188 102720 72816 R 10.3 2.5 0:08.00 php-fpm: pool www
24108 daemon 20 0 416016 101928 70244 R 10.0 2.5 0:22.26 php-fpm: pool www
24459 daemon 20 0 419364 103636 68628 R 9.6 2.6 1:29.28 php-fpm: pool www
28230 daemon 20 0 420016 102240 66548 R 9.6 2.5 0:33.64 php-fpm: pool www
26371 daemon 20 0 415904 99048 67360 R 9.3 2.5 1:28.86 php-fpm: pool www
28805 daemon 20 0 416368 105060 72880 R 9.3 2.6 0:30.67 php-fpm: pool www
23883 daemon 20 0 415424 104856 73644 R 8.6 2.6 0:24.20 php-fpm: pool www
24005 daemon 20 0 416152 99172 67236 R 8.6 2.5 0:28.05 php-fpm: pool www
24158 daemon 20 0 416172 100444 68444 R 8.6 2.5 2:13.64 php-fpm: pool www
24515 daemon 20 0 422316 111152 72972 R 8.6 2.8 1:31.43 php-fpm: pool www
28417 daemon 20 0 416144 98188 66420 R 8.6 2.4 0:32.65 php-fpm: pool www
26825 daemon 20 0 412124 98164 70316 S 3.0 2.4 0:47.72 php-fpm: pool www
1566 daemon 20 0 2327152 19764 6912 S 0.7 0.5 0:00.85 /opt/bitnami/apache/bin/httpd+
9 root 20 0 0 0 0 S 0.3 0.0 0:05.94 [ksoftirqd/0]
17 root 20 0 0 0 0 S 0.3 0.0 0:01.39 [ksoftirqd/1]
559 memcache 20 0 408168 4748 2200 S 0.3 0.1 0:00.81 /usr/bin/memcached -m 64 -p 1+
23172 root 20 0 11180 3840 3152 R 0.3 0.1 0:09.36 top
1 root 20 0 21920 9868 7700 S 0.0 0.2 0:02.99 /sbin/init
2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 [kthreadd]
3 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 [rcu_gp]
4 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 [rcu_par_gp]
6 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 [kworker/0:0H-kblockd]
8 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 [mm_percpu_wq]
10 root 20 0 0 0 0 I 0.0 0.0 0:05.56 [rcu_sched]
11 root 20 0 0 0 0 I 0.0 0.0 0:00.00 [rcu_bh]
bitnami@Association-Medgress:~$

HI @shomystojanovic,

If you have so many processes running in the instance is because they all are required. Your instance is probably receiving more requests than the ones you are aware of or the plugins/themes you have in the application are using the PHP processes intensively.

We suggest you check this guide to know if there is any bot/attacker accessing your site

https://docs.bitnami.com/aws/apps/wordpress/troubleshooting/deny-connections-bots-apache/

and you can also disable all the plugins and check if the CPU usage decreases. As a final suggestion, you can also decrease the number of PHP-FPM processes in the configuration to avoid this kind of performance issues in the instance.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.