Performance Guide
Chapter 3, Tuning CPU resources

Identifying CPU-bound systems

Identifying CPU-bound systems

A system is CPU bound (has a CPU bottleneck) if the processor cannot execute fast enough to keep the number of processes on the run queue consistently low. To determine if a system is CPU bound, run sar -u (or cpusar -u for each processor on a system with an SCO SMP License) and examine the %idle value.

If %idle is consistently less than 5% (for all CPUs) on a heavily loaded database server system, then the system may be lacking in processing power. On a heavily loaded system with many logged-in users, a %idle value that is persistently less than 20% suggests that the system not be able to cope with a much larger load. Examination of the number of processes on the run queue shows whether there is an unacceptable buildup of runnable processes. If processes are not building up on the run queue, a low idle time need not indicate an immediate problem provided that the other subsystems (memory and I/O) can cope with the demands placed upon them.

Run queue activity can be considered heavy if sar -q (mpsar -q for SMP) reports that runq-sz is consistently greater than 2 (and %runocc is greater than 90% for SMP). If low %idle values are combined with heavy run queue activity then the system is CPU bound.

If low %idle values are combined with low or non-existent run queue activity, it is possible that the system is running CPU-intensive processes. This in itself is not a problem unless an increase in the number of executing processes causes a buildup of numbers of processes on the run queue.

If %wio values are consistently high (greater than 15%), this is more likely to indicate a potential I/O bottleneck than a problem with CPU resources. See Chapter 5, ``Tuning I/O resources'' for more information on identifying I/O bottlenecks.

High values of %wio may also be seen if the system is swapping and paging. Memory shortages can also lead to a disk I/O bottleneck because the system spends so much time moving processes and pages between memory and swap areas on disk. If the value of %sys is high relative to %usr, and %idle is close to zero, this could indicate that the kernel is consuming a large amount of CPU time running the swapping and page stealing daemons( sched and vhand). These daemons are part of the kernel and cannot be context switched; this may lead to several processes being stuck on the run queue waiting to run. For details of how to identify and tune memory-bound systems, see Chapter 4, ``Tuning memory resources'' and ``Tuning memory-bound systems''.

The following table summarizes the commands that you can use to determine if a system is CPU bound:

Table 3-1 Identifying a CPU-bound system

 ---------------------------------------------------------------------
 Command      Field        Description
 ---------------------------------------------------------------------
 sar -u       %idle        percentage of time that the CPU was idle
 mpsar -u     %idle        average percentage of time all CPUs are
                           idle (SMP only)
 cpusar -u    %idle        percentage of time the specified CPU was
                           idle (SMP only)
 [mp]sar -q   %runocc      percentage of time the run queue is
                           occupied
              runq-sz      number of processes on the run queue
See ``Tuning CPU-bound systems'' for a discussion of how to tune CPU-bound systems.