Resolving CPU bottlenecks
High CPU activity is normal and desirable. However, when a machine is 95 percent busy, we have to check if this is for all processors or if there is one processor that has a large load.
CPU % time is divided into 4 components:
Component |
Name |
Description |
---|---|---|
Us |
User time |
Time used by all user processes (non-kernel) |
Sy |
System |
Time spent by operating system kernel |
Id |
Idle |
Time spent idle |
Wa |
Wait |
Time spent waiting for I/O |
Getting ready
For this example, I compiled a C program named pos.exe
. This program executes a SQL with a cartesian join to ensure that we have CPU activity for a while, so we have the time to track it down. You can open a command-line processor window and issue a SQL from there.
How to do it...
Get
vmstat
results. Issue the following command, and note the CPU columns on the right. In this example, the user CPU maintains a constant 90 percent or more activity, so immediate attention is required:[db2instp@nodedb21 ~]$ vmstat 5 100 procs ----...