Measuring load – %CPU in top is different than %us-Collection of common programming errors
When I run TOP on a remote server, I see a very small system utilization (3.8%us). However, for the actual process I am seeing 29.6% of the CPU.
Since this server has 8 CPU cores, is the %CPU the utilization of only 1 CPU, while the us
up top is over the 8 CPUs?
When I divide 29.6 by 8, I get 3.7 which looks to validate my guess. So questions:
- The low utilization I am seeing is actually over 8 CPUs while the %CPU is for the CPU the process is using?
- What happens for processes that are utilizing more than one CPU?
- Does tomcat use more than one CPU if required? Or will tomcat crash if the load is increased but we will never be informed of high load
Top Output
top - 12:17:40 up 9 days, 21:51, 2 users, load average: 0.32, 0.28, 0.27
Tasks: 201 total, 2 running, 199 sleeping, 0 stopped, 0 zombie
Cpu(s): 3.8%us, 0.1%sy, 0.0%ni, 96.1%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 16229072k total, 5617572k used, 10611500k free, 156480k buffers
Swap: 8388588k total, 0k used, 8388588k free, 2632452k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
32676 tomcat 20 0 12.4g 2.3g 10m S 29.6 14.6 2530:56 java
I have checked sources such as http://www.kernelhardware.org/linux-top-command/ , but not one of them makes the distinction between %us
and %CPU
.
Only some ambiguous information such as: %CPU - Percentage of CPU used
-
The CPU percentages shown in
top
are for all CPUs combined. To see per-CPU statistics, press 1 whiletop
is running.The percentages in the process list, on the other hand, are a percentage of a single CPU core, and thus may exceed 100%.