Staggering java linux process startup to prevent OOM
- by ctennis
I am running a number of java processes on a single Linux machine. From a memory and computing standpoint, everything is fine when things are static.
However, periodically we use a configuration management package up upgrade the jar or war files, and restart the java process.
The problem is, that is restarts them all relatively quickly, and so we get 10 or so java VMs restarting all at the same time (we use daemontools for the service stops/starts), which wreaks havoc on the machine, in terms of OOMs or just really slow. This is because it's spawning the JVM 10x at the same time.
Other than trying to stagger the startups, is there a smarter way of handling this? Maybe a sysctl tuning performance parameters, or a JVM parameter?