How to Check Memory and I/O with vmstat on Linux CentOS 5/CentOS 6/RHEL 5/RHEL 6 server – System Performance

Share this Article :

vmstat command is a utility that will provides interesting information abaout processes, memory, i/O and CPU activity. When you run vmstat utility command without any arguments, you will see the output as below. This post will guide you on how to check memory and I/O with vmstat on Linux CentOS 5/CentOS 6/RHEL 5/RHEL 6 server to optimize the linux system performance.

[[email protected] ~]# vmstat
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu-----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 0  0      0 888252  28976  63004    5    0     0    11   15   18  0  0 99  0  0

Below are the description of above vmstat output :
1. The procs fields show the number of processes
– Waiting for run time (r)
-Blocked (b)
-Swapped out (w)

Also Read :   How to Configure Static Routes on CentOS 6.2

2. The memory fields show the kilobytes of swap memory,free memory, buffered memory and Cached memory

3. The swap fields show the kilobytes per second of memory
-Swapped in from disk (si)
-Swapped out to disk (so)

4. The io fields show the number of blocks per second
-Sent to block devices (bi)
-Received from block devices (bo)

5. The system shows the number of
-Interrupts per second (in)
-Context switches per second (cs)

6. The cpu field shows the percentage of total CPU time as
-User time (us)
-System time (sy)
-Idle (id) time

To prints the vmstat version, run this command :

[[email protected] ~]# vmstat -V
procps version 3.2.8

We can let the vmstat to run automatically by execute this command :

[[email protected] ~]# vmstat 

Where nsec is the number of seconds you want it to wait before another update.

To run vmstat on every 10 seconds :

[[email protected] ~]# vmstat 10
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu-----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 0  0      0 888072  29088  63004    4    0     0    11   14   18  0  0 99  0  0
 0  0      0 888064  29088  63004    0    0     0     0   12   15  0  0 100  0  0
 0  0      0 888064  29088  63004    0    0     0     0   13   16  0  0 100  0  0

Other vmstat usage as below :

usage: vmstat [-V] [-n] [delay [count]]
              -V prints version.
              -n causes the headers not to be reprinted regularly.
              -a print inactive/active page stats.
              -d prints disk statistics
              -D prints disk table
              -p prints disk partition statistics
              -s prints vm table
              -m prints slabinfo
              -t add timestamp to output
              -S unit size
              delay is the delay between updates in seconds.
              unit size k:1000 K:1024 m:1000000 M:1048576 (default is K)
              count is the number of updates.


Leave a Reply