Page 531
Page 532
There are a number of approaches that you can take to identify heavy-resource users. The approach followed here first takes an overview of the environment. If something wrong is sensed, further probing is done into the area to get into the user details. The resources to look at here are CPU, file I/O, and memory. If the CPU is heavily loaded and kept busy by some user doing a lot of CPU-intensive work, it could drag the system down. Similarly, heavy file I/Os could also cause system performance to drop. Heavy requirements for memory by some processes could lead to paging and swapping, which could severely hamper the performance of the system. You should concentrate on these three resources. Basically, every process that gets executed on the server tries to acquire the following resources:
When there is heavy usage of these resources, the system will experience a drop in performance. Therefore, it is very important to locate how much of these resources are allocated to each user. In order to identify heavy resource consumption, you concentrate on one resource at a time and try to identify the individual resource consumption by processes.
Page 533
NOTE |
All scripts in the chapter were run on Oracle version 7.3.2.3 running on an HP-UX K210 Series 800 machine. The version of UNIX used was 10.10.n |
UNIX is a multiprocessing operating system; that is, the UNIX operating system is capable of managing multiple processes simultaneously. Every process that has to execute a job using the CPU will wait in the queue called the run queue for a CPU time slice to execute its job. When it's the process's turn, the process will be allocated a time slice to execute its job. A well-tuned CPU should not have many processes waiting in the run queue to execute processes, but it should be adequately busy.
The next sections identify processes that are consuming an excessive amount of CPU resource. While doing this exercise, bear in mind that on a lightly loaded system, one process could literally hog all the CPU, which is perfectly normal and should cause no reason for alarm. When you are trying to identify heavy CPU users, you must see to it that at any point of time there are sufficient number of jobs running on the system and that there is a performance problem. It is only under this condition that you proceed with the approach mentioned here, because as specified earlier, a system with low load will have its few users consuming a lot of the CPU time, which is really normal.Before you identify which user is causing a CPU resource problem, you must have a general overview of how the CPU is behaving. On UNIX systems, you can find CPU behavior by using the sar -u command. The sar -u command output has three columns of interest, as shown in Table 22.1.
Table 22.1 Important Columns in sar -u Command OutputColumn Name | Description |
%usr | Percentage of CPU time spent in servicing user requests. |
%sys | Percentage of time spent by CPU attending system calls. |
%wio | Percentage of time spent by the CPU waiting for completion of I/O from the disk. If this percentage is regularly high, it could indicate a possible bottleneck on the disks or inefficiencies in the I/O system. |
%idle | Percentage of time the CPU was idle. |
A well-tuned or healthy CPU would generally have the user CPU time double the system CPU time; that is, the CPU is spending more time servicing user requests as compared to servicing system calls.