title: Schedule garbage collections for multiple jvms on single server
body: <p>We have linux servers running about 200 microservices in java each, using c-groups for isolation for cpu and memory isolation. One  thing we have discovered is that java tends to require a full core of CPU to perform (major) garbage collection efficiently.</p>
  
  <p>However obviously with 200 apps running and only 24 CPUs if they all decided to GC at the same time they would be limited by the c-groups. Since typical application CPU usage is relatively small (say about 15% of 1 cpu peak), it would be nice to find a way to ensure they don't all GC at the same time. </p>
  
  <p>I'm looking into how we can schedule GCs so that each microserevice does not GC at the same time so that we can still run over 200 apps per host, but was wondering if anybody had some suggestions or experience on this topic before trying to re invent the wheel. </p>
  
  <p>I found that there are command line methods that we can use, as well as using MBeans to actually trigger the GC, but read that it is not advised to do so as this will mess up the non-deterministic procedure java uses for GC. </p>
  
  <p>Something that I'm thinking about is using performance metrics to monitor cpu, memory, and traffic to try and predict a GC, then if multiple are about to GC, perhaps we could trigger them one at a time, however this might be impractical or also bad idea. </p>
  
  <p>We are running java 7, and 8.</p>