Diagnosing CPU Performance on Linux

On Linux/Solaris, vmstat will report information about processes, memory, paging, block IO, traps, and cpu activity.

$ vmstat 1
procs -----------memory---------- ---swap-- -----io---- --system-- ----cpu----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in    cs us sy id wa
 9  0 520512  27132  15216 318944    3    2    65    40    0     3 10  3 85  2
12  0 520512  27004  15216 319080    0    0   104     0 2041 10992 88  8  3  0
20  0 520512  26764  15228 319068    0    0     0   436 2196 12869 85 13  2  0
11  0 520512  26700  15228 319068    0    0     0     0 1959  4041 88  9  4  0
20  0 520512  25724  15228 319068    0    0     0     4 2137  3307 84 14  2  0
17  0 520512  25724  15228 319068    0    0     4     0 2017 10488 89  8  3  0
 9  0 520512  25468  15228 319068    0    0     0     0 1886  7532 86 11  3  0
...

(this is a very busy server with ~97% CPU usage, but fortunately no swapping)

This system info can be captured over a long time with vmstat -n 1 > vmstat.log

On Linux, CPU and memory info can be obtained with cat /proc/cpuinfo and cat /proc/meminfo respectively.


Top command is also a good try to identify which processes are consuming most of the server resources.

This command is used to display all the running and active real-time processes in ordered list and updates it regularly. It display CPU usage, Memory usage, Swap Memory, Cache Size, Buffer Size,Process PID, User and Commands. It also shows high memory and cpu utilisation of a running processes. 


To exit from the top interface, just type q

Was this helpful?

Thanks for your feedback!

Why was this unhelpful?

Have a question about this article?

See questions about this article

Powered by Confluence and Scroll Viewport