Troubleshoot Linux Server Performance Using vmstat Command

Troubleshoot Linux Server Performance Using vmstat Command

We can do troubleshooting with vmstat command for Linux monitoring performance in Linux. Vmstat is used to monitor the server performance using the command line and it shows you the information including CPU, Block I/O, Swap, Process, memory, and paging. 

If you don’t find vmstat command, you can install using yum -y vmstat


Troubleshoot Linux Server Performance

Check Out: EFS Mount Issue “Failed To Resolve Server: Name or Service Not Known”

The output will be broken into 6 parts: so

  • r: The number of process waiting for run time
  • b: The number of process in uninterruptible sleep
  • swpd: Amount of Virtual memory used.
  • free: idle memory
  • buff: memory used as buffers.
  • cache: memory used as a cache.
  • inact: inactive memory
  • active: active memory
  • si: The amount of memory swapped in from disk.
  • so: The amount of memory swapped to disk.
  • bi: Blocks received from a block device 
  • bo: Blocks sent to a block device 
  • in: interrupts per second, including the clock.
  • cs: The number of context switches per second.
CPU: These are percentages of total CPU time.
  • us: Amount of time that the processor spends on user tasks.
  • sy: Amount of time that processor spends on kernel related tasks
  • id: Amount of time spends idle. 
  • wa: Amount of time that processor waiting for IO. 
  • st: Amount of time stolen from a virtual machine.

Example 1: It displays active and inactive memory of the system running on the server. so

vmstat -a

Check Out: How To Create Clone of Existing Virtual Machine In VMWare

Example 2: you want to check the slab information. It means a set of one or more contiguous pages of memory set aside by the slab allocator for an individual cache. It’s a memory management mechanism. so

If you don’t find any information, it depends on your kernel. so

vmstat -m | more

Example 3: It executes every 2 seconds and stops automatically after 5 intervals. so

vmstat 2 5

Example 4: Check disk statistics using vmstat -d so

Check Out: Top 16 SCP Command To Copy Data Remotely In Linux

Example 5: you can also display the timestamp using vmstat -t delay count so

vmstat -t 2 4

Example 6: Display the size in Megabytes.

vmstat -S M 2 4

Check Out: Learn Top 12 lsof Commands Example For Files In Linux 8

Example 7: you can display header only once after delay and count.

vmstat -n 2 4

linux troubleshooting commands with vmstatExample 8: Displays the number of forks since last boot.

vmstat -f

vmstat command in linux

Check Out: How To Set Ulimit Users and File Descriptions On Linux Server

Example 9: it displays the width of the output using the ‘-w’ option. 

vmstat -w 2 4

vmstat linux

Example 10: we can display the I/O statistics of a particular disk using vmstat -p /dev/xvda1

vmstat linux performance monitoring

You’re done Troubleshoot Linux Server Performance monitoring command in linux vmstat

Share on:

I'm the founder of Curious Viral. I hope this blog will provide you complete information about Linux Technology & I would like to share my technical knowledge with you which I have learned during this period.

Other Posts You May Like...

Leave a comment