title: Full GC becoming very frequent
body: <p>I've got a Java webapp running on one tomcat instance. During peak times the webapp serves around 30 pages per second and normally around 15.</p>
  
  <p>My environment is:</p>
  
  <pre><code>O/S: SUSE Linux Enterprise Server 10 (x86_64)
  RAM: 16GB
  
  server: Tomcat 6.0.20
  JVM: Java HotSpot(TM) 64-Bit Server VM 1.6.0_14
  JVM options:
  CATALINA_OPTS="-Xms512m -Xmx1024m -XX:PermSize=128m -XX:MaxPermSize=256m
                 -XX:+UseParallelGC
                 -Djava.awt.headless=true
                 -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps"
  JAVA_OPTS="-server"
  </code></pre>
  
  <p>After a couple of days of uptime the Full GC starts occurring more frequently and it becomes a serious problem to the application's availability. After a tomcat restart the problem goes away but, of course, returns after 5 to 10 or 30 days (not consistent).</p>
  
  <p>The Full GC log before and after a restart is at <a href="http://pastebin.com/raw.php?i=4NtkNXmi" rel="noreferrer">http://pastebin.com/raw.php?i=4NtkNXmi</a></p>
  
  <p>It shows a log before the restart at 6.6 days uptime where the app was suffering because Full GC needed 2.5 seconds and was happening every ~6 secs.</p>
  
  <p>Then it shows a log just after the restart where Full GC only happened every 5-10 minutes.</p>
  
  <p>I've got two dumps using <code>jmap -dump:format=b,file=dump.hprof PID</code> when the Full GCs where occurring (I'm not sure whether I got them exactly right when a Full GC was occurring or between 2 Full GCs) and opened them in <a href="http://www.eclipse.org/mat/" rel="noreferrer">http://www.eclipse.org/mat/</a> but didn't get anything useful in Leak Suspects:</p>
  
  <ul>
  <li>60MB: 1 instance of "org.hibernate.impl.SessionFactoryImpl" (I use hibernate with ehcache)</li>
  <li>80MB: 1,024 instances of "org.apache.tomcat.util.threads.ThreadWithAttributes" (these are probably the 1024 workers of tomcat)</li>
  <li>45MB: 37 instances of "net.sf.ehcache.store.compound.impl.MemoryOnlyStore" (these should be my ~37 cache regions in ehcache)</li>
  </ul>
  
  <p>Note that I never get an OutOfMemoryError.</p>
  
  <p>Any ideas on where should I look next?</p>