See the information about my CPU architecture:
root@jai [~]# lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 16
On-line CPU(s) list: 0-15
Thread(s) per core: 1
Core(s) per socket: 1
Socket(s): 16
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 86
Model name: Intel(R) Xeon(R) CPU D-1541 @ 2.10GHz
Stepping: 3
CPU MHz: 2099.998
BogoMIPS: 4199.99
Hypervisor vendor: KVM
Virtualization type: full
L1d cache: 32K
L1i cache: 32K
L2 cache: 4096K
L3 cache: 16384K
NUMA node0 CPU(s): 0-15
The performance of my website was struggling, sometimes working in an intermittent manner not loading pages completely one time but then a few seconds later loading all pages fine. Totally intermittent and the same happened from different computers and phones from different locations. I suspect the problem was caused by exceeding my CPU capacity to handle the traffic and processed that I were running at that moment. So I ran the following command while I was experiencing the problem. See the results:
root@cup [~]# ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%cpu | more
PID PPID CMD %MEM %CPU
26468 1499 php-fpm: pool m_jaimemontoya_n 1.0 57.3
26463 1499 php-fpm: pool m_jaimemontoya_n 0.7 42.3
26553 1499 php-fpm: pool m_jaimemontoya_n 0.6 38.5
26502 1499 php-fpm: pool m_jaimemontoya_n 0.2 35.6
26190 1499 php-fpm: pool m_jaimemontoya_n 0.3 29.4
18242 1499 php-fpm: pool m_jaimemontoya_n 1.1 22.8
19045 1499 php-fpm: pool m_jaimemontoya_n 1.0 20.6
18437 1499 php-fpm: pool m_jaimemontoya_n 0.6 20.2
18269 1499 php-fpm: pool m_jaimemontoya_n 1.1 18.5
18289 1499 php-fpm: pool m_jaimemontoya_n 0.9 13.1
19042 1499 php-fpm: pool m_jaimemontoya_n 1.1 11.9
26906 1 /usr/sbin/exim -Mc 1jTsTl-0 0.0 7.0
8546 8014 /usr/sbin/mysqld --basedir= 1.1 6.7
26872 1 /usr/sbin/exim -Mc 1jTsTl-0 0.0 6.0
26877 1 /usr/sbin/exim -Mc 1jTsTl-0 0.0 6.0
26869 1 /usr/sbin/exim -Mc 1jTsTl-0 0.0 5.0
26875 21851 /usr/sbin/exim -qG 0.0 5.0
26885 1 /usr/sbin/exim -Mc 1jTsTl-0 0.0 5.0
26891 1 /usr/sbin/exim -Mc 1jTsTl-0 0.0 5.0
26895 1 /usr/sbin/exim -Mc 1jTsTl-0 0.0 5.0
26888 1 /usr/sbin/exim -Mc 1jTsTl-0 0.0 4.0
26903 1 /usr/sbin/exim -Mc 1jTsTl-0 0.0 4.0
26880 26875 /usr/sbin/exim -qG 0.0 3.0
26881 26869 /usr/sbin/exim -Mc 1jTsTl-0 0.0 3.0
26882 26872 /usr/sbin/exim -Mc 1jTsTl-0 0.0 3.0
26899 26888 /usr/sbin/exim -Mc 1jTsTl-0 0.0 3.0
17419 1499 php-fpm: pool jaimemontoya_com 0.0 2.5
26814 1 /usr/sbin/exim -Mc 1jTsTj-0 0.0 2.5
26849 1 /usr/sbin/exim -Mc 1jTsTk-0 0.0 2.5
21290 1499 php-fpm: pool jaimemontoya_com 0.0 2.1
14959 1499 php-fpm: pool jaimemontoya_com 0.0 2.0
16122 1499 php-fpm: pool jaimemontoya_com 0.0 2.0
17085 1499 php-fpm: pool jaimemontoya_com 0.0 2.0
22367 1499 php-fpm: pool jaimemontoya_com 0.0 2.0
26826 1 /usr/sbin/exim -Mc 1jTsTk-0 0.0 2.0
26859 26849 /usr/sbin/exim -Mc 1jTsTk-0 0.0 2.0
26884 26877 /usr/sbin/exim -Mc 1jTsTl-0 0.0 2.0
26902 26895 /usr/sbin/exim -Mc 1jTsTl-0 0.0 2.0
18723 1499 php-fpm: pool jaimemontoya_com 0.0 1.7
21456 1499 php-fpm: pool jaimemontoya_com 0.0 1.7
21975 1499 php-fpm: pool jaimemontoya_com 0.0 1.7
13578 1499 php-fpm: pool jaimemontoya_com 0.0 1.6
I am trying to understand how to interpret the %CPU
column. If I add up the following values, I get 404.2 as the total:
57.3+42.3+38.5+35.6+29.4+22.8+20.6+20.2+18.5+13.1+11.9+7.0+6.7+6.0+5.0+5.0+5.0+5.0+5.0+4.0+4.0+3.0+3.0+3.0+2.5+2.5+2.5+2.1+2.0+2.0+2.0+2.0+2.0+2.0+2.0+2.0+1.7+1.7+1.7+1.6
Considering that I have 16 CPUs, how can I interpret that 404.2
that results after adding up all of the values in the %CPU
column for all processes? I have a server with 30 GB RAM with 8 Core / 16 Thread CPU. Thank you.
NOTE: In the past I used to get this warning frequently on my server logs: WARNING: [pool m_jaimemontoya_com] server reached max_children setting (5), consider raising it
So I raised it to 32. For that reason, you see more than 5 processed for php-fpm
running simultaneously.
UPDATE 1:
Using man lscpu
, I see this:
COLUMNS
CPU The logical CPU number of a CPU as used by the Linux kernel.
I asked AbraCadaver to write his comment as an answer because that was the solution for me. He did not do it. I am copying his comment below as the answer to my question:
"That's a bad data point for ps
CPU% is CPU usage is currently expressed as the percentage of time spent running during the entire lifetime of a process. Might look at top
or other utility. – AbraCadaver Apr 29 at 20:41"