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

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.

[root@rhel6 ~]# 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)

READ  4 Steps to Disable SELinux on CentOS 6.4

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

READ  How to Prepare Local Yum Repository from CD-ROM/DVD-ROM image on RHEL 7

To prints the vmstat version, run this command :

[root@rhel6 ~]# vmstat -V
procps version 3.2.8

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

[root@rhel6 ~]# vmstat 

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

To run vmstat on every 10 seconds :

[root@rhel6 ~]# 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

Your email address will not be published. Required fields are marked *

SiteGround.com

A world leading hosting company that provides fully-managed innovative and secure solutions, suitable for hosting small to medium-sized websites

Built on the best available technologies combined with Google Cloud for strong redundancy and application availability. Backed by skilled experts to address web security threats, a devops team to create advanced custom security solutions, and 24/7 sysadmins to watch over the platform. This powerful, hands-on approach makes your sites faster, safer, and easier to manage. Starting from only $3.95/mo.

TRY FREE

* up to 30 days money back guarantee