Comment Comment by eminh For those interested in doing monitoring outside of the process itself, we run this command every minute via cronps -o rss,pid= -U username | sort -k 1 -nr | head -2 | awk -F: '{FS=" ";if ($1>limit*1000) print $2}' limit=`jot -r 1 144 192` | xargs kill -QUITIt will gracefully kill 2 most memory-consuming unicorn workers above random range of 144-192MB of memory. It proved to be extremely efficient and simple solution to our needs. parent eminh 13 years ago
ps -o rss,pid= -U username | sort -k 1 -nr | head -2 | awk -F: '{FS=" ";if ($1>limit*1000) print $2}' limit=`jot -r 1 144 192` | xargs kill -QUIT
It will gracefully kill 2 most memory-consuming unicorn workers above random range of 144-192MB of memory. It proved to be extremely efficient and simple solution to our needs.