1

I have trouble with the JVM-Heap.

We operate a website with Apache HTTP Server and an Apache Tomcat Application Server.

All *.jsp Requests to the Apache HTTP Server will be redirected to the Tomcat Server (protocol: ajp).

The website has more than 10'000 jsp files.

We have also a google search appliance and it crawle the website every night.

While it crawling, the jvm heap space rise to the max limit of 8 GB.

With javamelody, I can see that the heap space increase analogue to the loaded classes.

For the analyse I took a heapdump.

Here is the report from eclipse MAT:


One instance of "org.apache.jasper.servlet.JspServlet" loaded by "org.apache.catalina.loader.StandardClassLoader @ 0x7092c5148" occupies 1'189'603'328 (96.75%) bytes.

The memory is accumulated in one instance of "java.util.concurrent.ConcurrentHashMap$Segment[]" loaded by "".

Keywords

java.util.concurrent.ConcurrentHashMap$Segment[]

org.apache.catalina.loader.StandardClassLoader @ 0x7092c5148

org.apache.jasper.servlet.JspServlet


Is there a Problem with GSA request/s?

And why can't JVM unload the generated classes?

trincot
  • 317,000
  • 35
  • 244
  • 286
user1373150
  • 11
  • 1
  • 4
  • This is showing 1.1GB of heap used. Is this the only major part consuming memory? – Sean May 03 '12 at 19:25
  • Yes, it's the only one. I manually stopped the GSA to take the heap dump, so that the reason, why it isn't very big. I took also one last week, then it was 3.8 GB. – user1373150 May 03 '12 at 20:44
  • I wouldn't stop the GSA to take the heap dump. If you do, some of the resources may get released and then your heap dump wont tell you the whole story. Are you seeing Out of Memory exceptions in your logs? If so you may want to add the start up parameter HeapDumpOnOutOfMemoryError http://stackoverflow.com/q/542979/425406 – Sean May 04 '12 at 00:10
  • That is a heap dump after an OutOfMemoryError: One instance of "org.apache.jasper.compiler.JspRuntimeContext" loaded by "org.apache.catalina.loader.StandardClassLoader @ 0x7092af928" occupies 4'367'316'712 (98.57%) bytes. The memory is accumulated in one instance of "java.util.concurrent.ConcurrentHashMap$Segment[]" loaded by "". Keywords java.util.concurrent.ConcurrentHashMap$Segment[] org.apache.catalina.loader.StandardClassLoader @ 0x7092af928 org.apache.jasper.compiler.JspRuntimeContext – user1373150 May 04 '12 at 06:56
  • have a read through this documentation if you haven't already http://tomcat.apache.org/tomcat-6.0-doc/jasper-howto.html This will help you tune your jasper engine to possibly reduce the footprint this is causing – Sean May 04 '12 at 11:19

1 Answers1

1

It does look like loading all the JSPs is causing problems.

By default, Tomcat keeps all loaded JSPs in memory until the web application stops.

In Tomcat 7 you can set the maxLoadedJsps parameter of the JSP Servlet to limit the number of JSPs held in memory.

Mark Thomas
  • 16,339
  • 1
  • 39
  • 60