Tuesday, September 4, 2018

Find processes on run queue in Linux / Solaris

Ever encountered a high load average on a Linux box? Most likely reasons of having a high load average is a few processes queuing in CPU run queue. This can be seen from first two columns (r and b) from vmstat output.

# vmstat 5 5
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
67  0      0 552384 264792 12122244    0    0    25    62    5   16  2  1 97  0  0
66  0      0 538480 264848 12135348    0    0  1862  1233 3216 1167 97  3  0  0  0
67  1      0 490832 264912 12144252    0    0   998  1008 3578 1183 96  3  0  0  0
65  0      0 565148 265004 12150368    0    0   458  1228 3629 1357 96  4  0  0  0
64  1      0 522080 265132 12163624    0    0  1722   573 3776 1566 96  4  0  0  0
#


How do you find out which one? Use below commands:

ps -eo stat,pid,user,command | egrep "^STAT|^D|^R"

For Solaris use:

ps -aefL -o s -o user -o comm | egrep "^O|^R|COMMAND" 

Runnable processes have a status of "R", and commands waiting on I/O have a status of "D". On some older versions of Linux may require -emo instead of -eo.

No comments:

Post a Comment