Nasser Heidari

2009-07-08

vmstat – Find out Linux Resource utilization

Filed under: Linux — Nasser Heidari @ 05:16

vmstat command reports information about processes, memory, paging, block IO, traps, and cpu activity. However, a real advantage of vmstat command output – is to the point and (concise) easy to read/understand. The output of vmstat command use to help identify system bottlenecks. Please note that Linux vmstat does not count itself as a running process.

# vmstat -S m 4 5
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 1  0    330     95    231    848    0    0    11    17    0    0  6  0 91  2  0
 2  1    330     93    231    849    0    0     0  5493 1288  378 66  3 15 16  0
 0  0    330     95    231    849    0    0     0   110 1035  105 15  1 83  2  0
 0  0    330     97    231    849    0    0     0   919 1085  211  0  0 94  6  0
 0  0    330     96    231    849    0    0     0    29 1036   99  0  0 99  1  0

Where,

* The fist line is nothing but six different categories. The second line gives more information about each category. This second line gives all data you need.
* -S M: vmstat lets you choose units (k, K, m, M) default is K (1024 bytes) in the default mode. I am using M since this system has over 4 GB memory. Without -M option it will use K as unit.
* 4 5 :4 is the delay between updates in seconds, and 5 is the number of updates.

Field Description For Vm Mode

– procs is the process-related fields are:

* r: The number of processes waiting for run time.
* b: The number of processes in uninterruptible sleep.

– memory is the memory-related fields are:

* swpd: the amount of virtual memory used.
* free: the amount of idle memory.
* buff: the amount of memory used as buffers.
* cache: the amount of memory used as cache.

– swap is swap-related fields are:

* si: Amount of memory swapped in from disk (/s).
* so: Amount of memory swapped to disk (/s).

– io is the I/O-related fields are:

* bi: Blocks received from a block device (blocks/s).
* bo: Blocks sent to a block device (blocks/s).

– system is the system-related fields are:

* in: The number of interrupts per second, including the clock.
* cs: The number of context switches per second.

– cpu is the CPU-related fields are:

These are percentages 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. Prior to Linux 2.5.41, this includes IO-wait time.
* wa: Time spent waiting for IO. Prior to Linux 2.5.41, shown as zero.
* st: Time stolen from a virtual machine. Prior to Linux 2.6.11, unknown.

Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: