Now, the group's colleagues are looking for new energy and I see a strange phenomenon. A Tomcat app that has only one simple JSP page, and this JSP no matter what the page Java code (I want to use this JSP in her Web page to test server for a pair of Tomcat Max QPS). But after a few minutes with LoadRunner. Tomcat that allocates 1024M of heap memory outofmemory! The code for this page, such as the following:
<%@ page language= "java" contenttype= "text/html; charset=iso-8859-1" pageencoding= "iso-8859-1" %> <! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd" >
The initial analysis was. A JSP page is dead. A corresponding Java file is generated, and the Java file is compiled into a class file. Load into the memory. That is, a class object will be loaded into PermGen space.There is no relationship with heap space.
But the final report is on the space overflow. So the test must be that every time a JSP page is requested, an object is generated.
Baidu a bit, found every request JSP page, will produce a session object. There is this configuration in Tomcat's Web. xml:
<session-config> <session-timeout>30</session-timeout> </session-config>
That is, every time a JSP page is requested. will produce a session object. And this object expires after 30 minutes. We calculated that the next QPS was 5000, which means 5,000 session objects per second. A 300K object is generated per minute, and the session is a map object. It's bigger, so it's going to blow up the memory very quickly.The workarounds are as follows:
1. Add Session=false to the page directive.
2. Set the session expiration time to 0.
Now her loadrunner is running very steady.
After working on the practical never JSP that, search JSP problem more demanding ...
Copyright notice: This article blog original article. Blogs, without consent, may not be reproduced.
A JSP results page tomcat memory overflow