Every now and then DBAs need to investigate memory and CPU consumption on database servers. To find out the CPU and memory consumption, “top” is the most commonly used command in Linux environments. “free” is another command to display current memory consumption. Most important part of investigation is to sort the output of ”top” command to find out the top consumers of memory or CPU. In this article I will explain the easiest and simplest way to display top consumers in descending order.
We can use “-o” option of “top” command in order to sort the output based on a column. Following are the columns that are displayed in the output of top command.
PID | OS Process ID |
USER | OS User running the process |
PR | Process Priority |
NI |
|
VIRT | Virtual Memory usaed by the process |
RES | Physical memory used by the process |
SHR | Shared meory used by the process |
S | Status of the process |
%CPU | Percentage of CPU used by the process |
%MEM | Percentage of memory used by the process |
TIME+ | CPU centiseconds (hundredth of a second) used by the process |
COMMAND | Command being executed |
In a real time scenario, I observed memory usage going above 90% despite SGA (and current PGA usage) was not more than 60 percent of total memory. Although OS caching of file system also consumes memory, but in my case this consumption was also not very high, as an be seen below.
[root@dbhost ~]# free -g |
As you can see that 215G memory is in used out of total 235G. To find out top memory consumers, I used below command.
[root@dbhost ~]# top -o RES top - 06:13:12 up 8 days, 10:40, 2 users, load average: 0.73, 0.88, 1.10 ... ... |
Above command output exposed that oracle parallel server processes are the culprit here (tuning parallel server process is not the topic under discussion here therefore I would not explain it further).
Similarly, “top -o %CPU” can be used to display the output sorted in order of CPU consumption by individual processes
No comments:
Post a Comment