title: Optimizing Tomcat / Garbage Collection
body: <p>Our server has 128GB of RAM and 64 cores, running Tomcat 7.0.30 and Oracle jdk1.6.0_38, on CentOS 6.3.</p>
  
  <p>Every 60 minutes we're seeing garbage collection that was taking 45 - 60 seconds.  Adding -XX:-UseConcMarkSweepGC increased page load times by about 10% but got that down to about 3 seconds, which is an acceptable trade-off.</p>
  
  <p>Our config:</p>
  
  <pre>-Xms30g
  -Xmx30g
  -XX:PermSize=8g
  -XX:MaxPermSize=8g
  -Xss256k
  -XX:-UseConcMarkSweepGC
  </pre>
  
  <p>We set the heap at 30 GB to keep 32 bit addressing (I read that above 32 GB the 64 bit addressing takes up more memory, so you have to go to about 48 GB to see improvements).</p>
  
  <p>Using VisualGC I can see that the Eden space is cycling through every 30 - 60 minutes, but not much happens with the Survivor 0, Survivor 1, Old Gen, and Perm Gen.</p>
  
  <p>We have a powerful server.  What other optimizations can we make to further decrease the 3 second GC time?</p>
  
  <p>Any recommendations to improve performance or scaling?</p>
  
  <p>Any other output or config info that would help?</p>