ruby on rails - How to detect how many active Unicorn workers are busy? -
i using ruby unicorn, , have configured have 15 worker processes.
how tell how many workers processing work (are not idle, waiting work) @ current time?
if need infomation on command line, check how cpu each using:
ps aux --sort=-pcpu | grep '%cpu\|unicorn'
ps aux --sort=-pcpu - gets list of processes running, sorted in cpu usage order reversed (highest cpu first)
| - pipes output of previous command next
grep '%cpu\|unicorn' - returns lines contain %cpu (the first line) or unicorn. \| or symbol in grep pattern.
you should output this, cpu usage in 3rd column, memory usage in 4th:
user pid %cpu %mem vsz rss tty stat start time command vagrant 4444 33.2 45.0 349988 152892 ? sl 13:43 0:03 unicorn master -c /vagrant/config/unicorn.rb -e development -d vagrant 4449 0.0 15.9 362204 162716 ? sl 13:44 0:01 unicorn worker[0] -c /vagrant/config/unicorn.rb -e development -d
high cpu usage means in use, tiny or no cpu means worker idle , not doing work.
Comments
Post a Comment