title: Tuning JVM (GC) for high responsive server application
body: <p>I am running an application server on Linux 64bit with 8 core CPUs and 6 GB memory.</p>
  
  <p>The server must be highly responsive.</p>
  
  <p>After some inspection I found that the application running on the server creates rather a huge amount of short-lived objects, and has only about 200~400 MB long-lived objects(as long as there is no memory leak)</p>
  
  <p>After reading <a href="http://java.sun.com/javase/technologies/hotspot/gc/gc_tuning_6.html" rel="noreferrer">http://java.sun.com/javase/technologies/hotspot/gc/gc_tuning_6.html</a>
  I use these JVM options</p>
  
  <pre><code>-server -Xms2g -Xmx2g -XX:MaxPermSize=256m -XX:NewRatio=1 -XX:+UseConcMarkSweepGC
  </code></pre>
  
  <p>Result: the minor GC takes 0.01 ~ 0.02 sec, the major GC takes 1 ~ 3 sec
  the minor GC happens constantly. </p>
  
  <p>How can I further improve or tune the JVM?</p>
  
  <p>larger heap size? but will it take more time for GC?</p>
  
  <p>larger NewSize and MaxNewSize (for young generation)?</p>
  
  <p>other collector? parallel GC? </p>
  
  <p>is it a good idea to let major GC take place more often? and how?</p>