Linux Performance Monitoring Tools
In Unix like operating system we have the performance monitoring tools like top,vmstat,iostat,sar,free and lot more.... In this tutorial we will discuss most commonly used linux performance monitoring tools.
top command :
The top command shows actual process activity. By default, it displays the most CPU-intensive tasks running on the server and updates the list every five seconds. It also shows the load average of linux server. You can sort the processes by PID (numerically), age (newest first), time (cumulative time), and resident memory usage and time (time the process has occupied the CPU since startup).
Sample output of top command :
The columns in the output are :
|PID :||Process identification.|
|USER :||Name of the user who owns (and perhaps started) the process.|
|PRI :||Priority of the process|
|NI :||Niceness level (Whether the process tries to be nice by adjusting the priority by the number given.)|
|SIZE :||Amount of memory (code+data+stack) used by the process in kilobytes.|
|RSS :||Amount of physical RAM used, in kilobytes.|
|SHARE :||Amount of memory shared with other processes, in kilobytes.|
State of the process: S=sleeping, R=running, T=stopped or traced, D=interruptible sleep, Z=zombie.
|%CPU :||Share of the CPU usage (since the last screen update).|
|%MEM :||Share of physical memory.|
|TIME :||Total CPU time used by the process (since it was started).|
|COMMAND :||Command line used to start the task (including parameters)|
vmstat command :
vmstat provides virtual memory statistics. Vmstat also provides information about processes, memory, paging, block I/O, traps, and CPU activity. The vmstat command displays either average data or actual samples. The sampling mode is enabled by providing vmstat with a sampling frequency and a sampling duration.
Sample Output of vmstat command :
|[root@puppetmaster ~] # vmstat|
The columns in the output are as follows:
|r :||The number of processes waiting for runtime|
|b :||The number of processes in uninterruptable sleep|
The amount of virtual memory used (KB)
|free:||The amount of idle memory (KB)|
|buff:||The amount of memory used as buffers (KB)|
|cache:||The amount of memory used as cache (KB)|
|si :||Amount of memory swapped from the disk (KBps)|
|so :||Amount of memory swapped to the disk (Kbps)|
|bi :||Blocks sent to a block device (blocks/s)|
|bo :||Blocks received from a block device (blocks/s)|
|in :||The number of interrupts per second, including the clock|
|cs :||The number of context switches per second|
|CPU (% of total CPU time)|
|us :||Time spent running non-kernel code (user time, including nice time).|
|sy :||Time spent running kernel code (system time).|
|id :||Time spent idle.|
|wa :||Time spent waiting for IO.|
Uptime command :
The uptime command can be used to see how long the server has been up & running and how many users are logged on, as well as for a quick overview of the average load of the server.
The system load average is displayed for the past 1minute, 5 minute, and 15 minute intervals.
Sample output of uptime command :
[root@puppetmaster ~]# uptime
09:59:17 up 40 min, 2 users, load average: 0.00, 0.00, 0.00
free command :
free command displays information about the total amount of free and used memory (including swap) on the system. It also shows the information about the buffers and cache used by the kernel.
Sample Output :
Useful parameters for the free command include:
-b, -k, -m, -g : Display values in bytes, kilobytes, megabytes, and gigabytes
-l : Distinguishes between low and high memory
-c <count> : Displays the free output <count> number of times