Sunday 16 May 2021

PT - OS performance Monitoring using VMSTAT

 

PT - OS performance Monitoring using  VMSTAT 

vmstat

process ---- Memory ---- swap ---- i/o ----- system ----  cpu 

Process : r | b

Memory : spwd | spwd | free | buffer | cache

Swap : si | so

I/O:  bi | bo

System : cs | us | sy 

CPU : id |wt | st 

Field Meaning


r number of processes waiting for run time  
b number of processes in uninterruptible
sleep
spwd Virtual memory swapped out to disk

spwd Virtual memory swapped out to disk
free Amount of free memory

si Amount of memory swapped in from disk
so Amount of memory swapped to disk
us User CPU time
bi Blocks received from a block        device
(blocks/s)                        
bo Blocks sent to a block device
sy System CPU time
id CPU idle time


  • vmstat command output example 




  • vmstat 2 ( output every 2 second)





  • Example to apply load on OS by executing i/o 30 times using apply_io_stress.sh file.

cat > apply_io_stress.sh <<EOL

#!/bin/bash

counter=1

while [ \$counter -le 30 ]

do

dd if=/dev/zero of=/tmp/test1.img bs=500M count=1 oflag=dsync

((counter++))

done

rm -f /tmp/test1.img

EOL

  • Provide execute permission below.

chmod +x apply_io_stress.sh

srv1:~ # sh apply_io_stress.sh



^Z

[1]+  Stopped                 sh apply_io_stress.sh


srv1:~ #

  • We can see after executing sh file number of r b  process increases also I/O bi bo  reading blocks and write block increase.



^Z

[1]+  Stopped                 sh apply_io_stress.sh


  • Once stopping apply_io_stress.sh file processes and I/O value came back to normal.



vmstat -d 2

  • vmstat -d 2 ( Disk output at every 2 seconds) Examples below.











No comments:

Post a Comment