Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Session Managing

Status
Not open for further replies.

scripter73

Programmer
Apr 18, 2001
421
US
Hi,

General question for everyone. What are some of the best programming methods for managing state between pages if you have a lot of data you need to keep track of ( data elements numbering in the low hundreds)?

But let's say you'll have maybe 4500-5000 users at any one time and you need to keep track of these elements. Think employment application.

I say use HTTPSession, but do you have any advice on tips and tricks for keeping system memory drain low?

Thanks in advance.

scripter73




Change Your Thinking, Change Your Life.
 
State management comes down to three methods :

1) keep it in the URL
2) keep it in a session object
3) persist the data via a database, storing the key in one of the above 2 methods.

You have to think about how big your *session* objects will be, and the hits involved in saving/retrieving them. If memory is of no consegunce and you can run with 2+Gb of it, then massive objects won't be a problem. However, if they are of ridiculous size, then you should maybe think about storing them in a db.
Remember that HttpSession objects are nothing special. Tomcat uses a HashMap to store session objects, and the overhead is fairly low in retrieving them. A HttpSession object (itself in essence a HashMap) is stored in a global container variable (usually itself also a HashMap) and accessed via retrieving the browser Cookie id (or URL if cookies are disabled). Now, weighed against the overhead of making a network db call (even if pooled), then HttpSession is probably your best choice (as long as RAM is plentiful).
 
Thanks for the advice.

scripter73


Change Your Thinking, Change Your Life.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top