File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How many objects can be in Session

 
Saith Govind
Greenhorn
Posts: 13
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there any limit to the number of objects I keep in Httpsession object. Does putting more number of objects affect the performance of the servlet?
Please help.
Thank you so much..
 
Pete Harris
Ranch Hand
Posts: 39
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In a word, no. The HttpSession Attribute list is usually backed by a HashMap and so it can grow unconstrained.
As for performance, the speed of retrieval of objects is constant, but the problem you may run into is the memory usage of the server if you have many sessions.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13048
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A servlet engine has the option of serializing sessions out to disk if it wants to due to memory getting tight. (Not all servlet engines implement this, I know JRun does.) Thats why all objects you put in a session should implement Serializable.
Naturally recovering a session from disk introduces a delay.
Bill
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic