Managing the OOM Killer among us

Like me you have probably had your share off issues when something runs amok and OOM (The default out of memory killer) slaughters something that was behaving well and is, as it turns out, critical to your operation.
In my case MySQL is the primary target for OOM because it consumes the most memory on any given server. But occasionally someones PHP code will start to get out of hand on those same servers. And I want OOM to kill said out of hand code and thus protect my primary application! But oom does not… Instead it kills my one big app to protect the small but hungry programs. And this is not a gentle death either, it is a full blown Kill -9 to the face! So how do I make my app less of a target?

The method changes over the course of OS’s and versions but the two ways showcased here are mostly compatible and work on a wide variety of systems.
The Adjustment, and the Score.

Continue “Managing the OOM Killer among us”