wood burning stoves*
The moose likes Servlets and the fly likes server's limitation on number of sessions  ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "server Watch "server New topic
Author

server's limitation on number of sessions ?

Artemesia Lakener
Ranch Hand

Joined: Jun 21, 2005
Posts: 162
Does each application server have a vendor specific limit on how many HttpSessions it can handle at a given moment ? Any idea what's the limit for Tomcat ?
thanks.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60782
    
  65

I do not believe that Tomcat, or other servlet containers, impose any artificial limits on the number of active session other than that dictated by the limitations of resources (such as available memory).


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Neeraj Dheer
Ranch Hand

Joined: Mar 30, 2005
Posts: 225
yea i agree with Bear...

the number of sessions would not be a fixed number, but depend on the resources available.

For example: if in an application, the session needs to store only one StringBuffer object then we may be able to store many sessions, but if the session were to store many more 'big' objects, in that case, memory would be required to store those objects, thus reducing the total number of objects to be stored...
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12761
    
    5
Servlet containers are allowed to Serialize sessions to disk or other storage so they do NOT have to keep all active sessions in memory. Thats why you should ensure that all objects "stored" in sessionss should implement Serializable.
Bill
Frank Sikuluzu
Ranch Hand

Joined: Dec 16, 2003
Posts: 116
Originally posted by William Brogden:
Servlet containers are allowed to Serialize sessions to disk or other storage so they do NOT have to keep all active sessions in memory. Thats why you should ensure that all objects "stored" in sessionss should implement Serializable.
Bill


How about HttpRequest ? will there be any chance that requests are serialized to disk ? I guess not, but not sure. Please confirm if you know the answer.

By the way, sessions are first stored in memory so it consumes memory. Where are "requests" stored ? Do they also eat memory ?
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Originally posted by Frank Sikuluzu:


How about HttpRequest ? will there be any chance that requests are serialized to disk ? I guess not, but not sure. Please confirm if you know the answer.

By the way, sessions are first stored in memory so it consumes memory. Where are "requests" stored ? Do they also eat memory ?


Requests do not get serialized to disk.
They only last a fraction of a second (except in fringe cases).

Because of the transient nature of requests containers often pool and recycle request objects to cut down on object creation.


Look for "recycle":
http://cvs.apache.org/viewcvs.cgi/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/Request.java?view=markup
[ June 22, 2005: Message edited by: Ben Souther ]

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: server's limitation on number of sessions ?
 
Similar Threads
Multiple session objects for multiple login user in the same/ new browser window
Time limit to take the part 2
Time limit of part II
setFetchSize on preparestatement vs setFetchSize on resultset
Favourite movie chain...