Limiting memory usage and mimimizing swap thrashing on Unix / Linux

Posted by camelccc on Server Fault See other posts from Server Fault or by camelccc
Published on 2012-11-15T16:07:10Z Indexed on 2012/11/15 17:03 UTC
Read the original article Hit count: 183

Filed under:
|
|

I have a few machines that I machine that I use for running large numbers of jobs where I try to limit the number of jobs so as not to exceed the available RAM of the machine. Occasionally I mis-estimate how much memory some of the jobs will take, and the machine starts thrashing the swap file. I resolve this by sending the kill -s STOP to one of the jobs so that it can get swapped out.

Does anyone know of a utility that will monitor a server for processes by a specific name, and then pause the one with the smallest memory footprint is the total memory consumption reaches a desired threshold so that the larger ones can run and complete with a minimum of swap file thrashing? Paused processes then need to be resumed once some existing processes have completed.

© Server Fault or respective owner

Related posts about unix

Related posts about memory