Limited Time Offer!

For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!

Enroll Now

Linux Performance Monitoring using iostat, mpstat and vmstat | Linux Performance Monitoring Guide

linux-performance-monitoring

iostat reports CPU, disk I/O, and NFS statistics.

mpstat reports processors statictics.
vmstat reports virtual memory statistics.

vxstat – This Utility can be used as well.

iostat reports CPU, disk I/O, and NFS statistics.

The iostat command generates two types of reports, the CPU Utilization report and the Device Utilization report. The first report generated by the iostat command is the CPU Utilization Report.

iostat commands Table
iostat Iostat without any argument displays information about the CPU usage, and I/O statistics
iostat -c Display only cpu statistics
iostat -d Display only disk I/O statistics
iostat -n Display only network statistics (device and NFS statistics)
iostat -m Display the device I/O statistics in Blocks and To change I/O data in MB/second
iostat –p Display I/O statistics only for a device(data for all the disks available in the system)
iostat -t By default iostat displays only the current date. To display the current time, use this option
iostat -x Display extended disk I/O statistics information
iostat -x sda1 Display Extended status of device sda1
iostat 2 Execute Every 2 seconds (until you press Ctl-C)
iostat 2 3 To execute every 2 seconds for a total of 3 times
iostat -N To display the LVM statistics use option -N as shown below.
iostat –V To Display Version
iostat -d -x Display only disk I/O statisticsin in extended form
iostat -d -x sda Display only sda device I/O statisticsin in extended form
iostat -Td -xdn 5 For Solaris
iostat -d -x 5 For Linux
if Average read or write times over 50 ms, this should be consider for serious i/o problems

The report has the following format:

%user – Show the percentage of CPU utilization that occurred while executing at the user level (application).
%nice – provides statistics on a per physical device or partition basis.
Device – This column gives the device name
tps – Indicate the number of transfers per second that were issued to the device. A transfer is an I/O request to the device.
Blk_read/s – Indicate the amount of data read from the drive expressed in a number of blocks per second.
Blk_wrtn/s – Indicate the amount of data written to the drive expressed in a number of blocks per second.
Blk_read – The total number of blocks read.
Blk_wrtn – The total number of blocks written.
kB_read/s – Indicate the amount of data read from the drive expressed in kilobytes per second.
kB_wrtn/s – Indicate the amount of data written to the drive expressed in kilobytes per second.
wrqm/s – The number of write requests merged per second that were issued to the device.
r/s – The number of read requests that were issued to the device per second.
w/s – The number of write requests that were issued to the device per second.
rsec/s – The number of sectors read from the device per second.
wsec/s – The number of sectors written to the device per second.
await – The average time (in milliseconds) for I/O requests issued to the device to be served.
svctm – The average service time (in milliseconds) for I/O requests that were issued to the device.
%util – Percentage of CPU time during which I/O requests were issued to the device.

vmstat reports virtual memory statistics.

vmstat -a Display active and inactive memory
vmstat -f Display number of forks since last boot
vmstat 2 Execute Every x seconds (for y number of times)
vmstat -t 1 100 Display timestamp
vmstat -V version info
vmstat -m Display slab info
vmstat -s Display statistics in a table format
vmstat -d Use option -d to display the disk statistics as shown below. This displays the reads, writes, and I/O statistics of the disk.
vmstat 1 3 vmstat – Increase the width of the display
vmstat -p sdb1 Display statistics for a partition
vmstat -S m Display in MB

The report has the following format:

Procs – r: Total number of processes waiting to run
Procs – b: Total number of busy processes
Memory – swpd: Used virtual memory
Memory – free: Free virtual memory
Memory – buff: Memory used as buffers
Memory – cache: Memory used as cache.
Swap – si: Memory swapped from disk (for every second)
Swap – so: Memory swapped to disk (for every second)
IO – bi: Blocks in. i.e blocks received from device (for every second)
IO – bo: Blocks out. i.e blocks sent to the device (for every second)
System – in: Interrupts per second
System – cs: Context switches
CPU – us, sy, id, wa, st: CPU user time, system time, idle time, wait time

mpstat reports processors statictics.

reports processors statictics(mpstat – Report processors related statistics and mpstat displays CPU statistics )

mpstat :- mpstat displays CPU statistics
mpstat -A :- Display all information
mpstat -P ALL :- Display CPU statistics of individual CPU (or) Core

Reference:
http://www.linux-tutorial.info/modules.php?name=ManPage&sec=1&manpage=iostat
http://www.thegeekstuff.com/2011/07/iostat-vmstat-mpstat-examples/

Tagged : / / / / / / / / / / / / / / / / / / /