How to monitor session values?
I am developing a web app. In that app, i am maintaining huge data map in the session. I deployed my app in Tomcat 6.0. Sometimes i am experincing heap space problem.
How to increase the heap space? How do 开发者_开发技巧i maintain the session values? How to track the values in the sesssion?
I am using netbeans 6.1 to develope the app. Is there any tool to monitor the session values?
Thanks.
I am developing a web app. In that app, I am maintaining huge data map in the session
Well, that's maybe not a that good idea, especially if you keep data in the session for a long time:
- this won't scale well if you increase the number of concurrent users.
- this would have a huge cost in a clustered environment with persistent sessions (this might not be the case here but keep it in mind).
An alternative would be to write the data to a database.
How to increase the heap space?
Use the -Xmx
JVM option to set the max heap space. For example, -Xmx512M
. With Tomcat, you are supposed to set the JVM options in the CATALINA_OPTS
environment variable (I'd set it in catalina.bat). See this blog post.
Is there any tool to monitor the session values?
Lambda Probe can do this (see the changelog).
See also
- Best Practice: Storing objects in HTTP sessions
- Java theory and practice: State replication in the Web tier
- Recipe 2.3: Reducing HttpSession object size
Well, there an API : HttpSessionAttributeListener
精彩评论