Impact of JSP session configuration on web applications: jspsessionweb applications

Source: Internet
Author: User

Impact of JSP session configuration on web applications: jspsessionweb applications

Impact of JSP session configuration on web Applications

Previously, the company made a web project. After the release, as the access volume increases, it is found that the JVM memory usage is large, full gc is frequent, and the size of the old area does not change much after full gc. At first, we thought that the parameter configuration of the JVM virtual machine was unreasonable. we adjusted the parameter of the JVM Virtual Machine and found that GC was very frequent.

Funll GC frequently affects performance. We export the jvm heapdump (Java stack snapshot) file and use the IBM HeapAnalyzer analysis tool for analysis. After analysis, we found that many session objects exist in the heap. These session objects occupy a large amount of space and occupy a large proportion of heap memory. Obviously, the problem occurs on the session.

When a client accesses a session, a session object is generated when the session of the client is not in the server. Because the session expiration time in the project is set to a large value, when the access volume is large, A large number of session objects are generated, resulting in a large amount of heap memory.
The previous session was set to 30 minutes, and then to 1 minute. The Code is as follows:

<! -- Set the session to invalid. Unit: --> <session-config> <session-timeout> 1 </session-timeout> session-config>

After setting the session expiration time to 1 minute, we conducted a stress test and found that the full gc reduces a lot, and the JVM memory usage also decreases a lot. Draw conclusions from this result.

Reasonable session expiration time is very necessary.

Note: Since this web project does not contain any information into the session, you can set the session time to be very short. If the session contains information, you need

Set a reasonable expiration time.

Thank you for reading this article. I hope it will help you. Thank you for your support for this site!

Related Article

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.