• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Session timeout in general web applications vs social apps

 
shivang sarawagi
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Generally sessions in web applications expire after a stipulated max inactive interval. To my knowledge primarily the reason is if the session objects are not invalidated they keep exhausting the memory. So my question is

A. Is there any other reason other why web applications timeout the user session after an inactive interval?

B. Social sites never timeout the user session even if you just leave them for the entire day. How do they manage sessions? Don't the active sessions exhaust memory on their servers or JVM to be specific?

 
Abhay Agarwal
Ranch Hand
Posts: 1376
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For point A , security can be another reason for invalidating session.
For point B, we do have option in Java to configure ever running session. About whether they exhaust memory of JVM depends upon what values do we store in Session.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64994
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If your session fills up and never empties it's a sign that you are not managing it properly. Just leaving stale data in the session, and counting upon its timeout to clear it out is a poor approach.
 
Paul Clapham
Sheriff
Posts: 21155
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, don't assume that a user's session data has to be stored in memory. There are other strategies.
 
shivang sarawagi
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply guys. Can you please add any resource link or would want to elaborate on session saving strategies?.
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Files or - more likely - a database are other options.
 
Joe Areeda
Ranch Hand
Posts: 331
2
Java Netbeans IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also a session may timeout but not require any user interaction to create another one.

For example the "stay logged in" checkboxes usually store a cookie in the client browser and that can be used to log in the next session.

Joe
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18226
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not exactly sure what the question is here, but it's entirely within the rights of a web application server to periodically scan its session collection and discard sessions which have exceeded the timeout limit. In other words, don't expect that you have to explicitly dispose of sessions.

The Tomcat webapp server will store serialized sessions in a work directory. This can cause a session to be have continuity over a shutdown/restart of the webapp server. I haven't checked, but I'm sure there are options that control this. Plus, of course, Tomcat supports alternative session storage to help facilitate clustering between discrete JVMs.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic