JVM HeapDump: The memory is accumulated in one ins

2019-06-11 02:42发布

问题:

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?

回答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.