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!