Effective time to set JSP request session reasonably

Source: Internet
Author: User

Before writing a simple JSP to do the stress test, did not expect a problem is when the pressure is relatively large, run a long time will appear a phenomenon, that is, the JVM's memory is almost exhausted, with Jprofiler view will find that there is a Concurrenthashmap object Memory has been growing, and there are no signs of release, and then into debug mode, tracking find who has new Concurrenthashmap, because the test scenario is a very simple JSP page, found that only the JSP request session will create this Concurrenthashmap, long time no JSP, guessing is the default timeout time for the request session is too long, resulting in high pressure (200 concurrent, a total of 500,000 consecutive visits, JVM memory 1G) will occur memory has not been recycled problem, It was later printed. The default timeout for the request session (as is JBoss 4.2.2), is half an hour, if so it is true that the above memory has been occupied by the phenomenon.

This JSP is this, very simple:

<% @pagecontentType = "TEXT/HTML;CHARSET=GBK"%>

Justtest.

The specific reasons for this problem need to be combined with the mechanism of Session, the session mechanism of the article is quite a lot of interest can see the following two articles:

Http://www.builder.com.cn/2007/1123/650439.shtml

http://bbs.chinaunix.net/viewthread.php?tid=1178466

What about the question? can only say session with the time to be very careful, after all, is to consume memory resources, and usually the session will not be configured as an instant invalidate, are a certain amount of time out, in such cases, if the scope of the timeout in the time of high traffic is very likely to cause problems, so the reasonable setting of the timeout is very important.

PS: Long time no play JSP and session, really did not pay attention to this situation, for familiar with the JSP and session mechanism of the person may be common sense

, ^_^, forgive forgive me.

If you don't need a session on the page, you can do this:

<%@ page session= "false"%>

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.