HostOnNet Blog

Troubleshooting Memory Usage – vmstat

Looking for Linux Server Admin or WordPress Expert? We can help.

Linux Kernel

Linux vmstat command used to check memory usage on linux .

# vmstat
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu-----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 4  0  42116 15386132 1304192 18180176    0    0     4    22    0    1  2  1 97  0  0	

r column

r: The number of processes waiting for run time or placed in run queue or are already executing (running)

Whenever the value of the ‘ r ‘ exceeds the number of CPUs on the server, tasks are forced to wait for execution.

To find number of CPU cores on a server, run

cat /proc/cpuinfo | grep processor | wc -l

b column

b: The number of processes in uninterruptible sleep. (b=blocked queue, waiting for resource (e.g. filesystem I/O blocked, inode lock))

si/so column

This is for data written to swap.

if server is using swap, this is because too many process running or server under load. This is not good, on a healthy server, value of this column should be 0.

bi/bo column

This is Block Input/Output, that is data written and read from Hard disk.

The bi (bytes in) and bo (bytes out) column show disk I/O (including swapping memory to/from disk) on your server.

CPU Usage: (us sy id)

The us (user), sy (system) and id (idle) show the amount of CPU your server is using. The higher the idle value, the better.

About Annie

I've been working in Technical Section for over 10 years in a wide range of tech jobs from Tech Support to Software Testing. I started writing blog for my future reference and useful for all.
Posted in Linux

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.