Wednesday, October 15, 2014

Linux server thrashing using vmstat

You can use the vmstat command to detect thrashing of memory and hard disk as follows:

vmstat 2
where 2 represents the number of seconds to repeat.

You may see output similar to this

procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu-----
 r  b   swpd   free          buff      cache      si   so    bi    bo   in   cs us sy id wa st
 1  0   1600 2244636 193816 1154164    0    0     1     9    0    0  1  0 98  0  0
 1  0   1600 2244496 193816 1154184    0    0     0    46 1768 1432 26  1 73  0  0
 1  0   1600 2244496 193816 1154184    0    0     0     0 1756 1383 25  1 74  0  0
 1  0   1600 2244496 193816 1154184    0    0     0     0 1732 1318 26  0 74  0  0



The parameters of interest are si and so (swap in, swap out).
In this case a value of 0, means there is no thrashing

References:

http://www.linuxjournal.com/article/8178