A JSP results page tomcat memory overflow

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.