aspose file tools*
The moose likes Performance and the fly likes Session and request capacity Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Performance
Bookmark "Session and request capacity" Watch "Session and request capacity" New topic
Author

Session and request capacity

kavin clain
Ranch Hand

Joined: Jan 19, 2010
Posts: 68
Is there any limit to save information on session and request object...
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6661
    
    5

Yes and no.

There is no limit. But there is a limit on the amount of memory you can use, so from that perspective there would be a limit


SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12789
    
    5
Recall that a session or a request only keeps a reference to an object, it does not make a copy.

Over the life span of a request, presumably short, this make no difference.

The problem comes with a session - if the servlet container decides to serialize the session to disk, it WILL try to make a copy. Disastrous if the object is not serializable and presenting performance problems even if it is.

Bill
kavin clain
Ranch Hand

Joined: Jan 19, 2010
Posts: 68
What is the situation when the servlet container decides to serialize the session to disk?

The java based server are resource intensive... then how to allocate more memory...?

William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12789
    
    5
The servlet API lets a servlet container serialize a session to disk any time it wants to. The next time a request using the session comes in, it will deserialize back into memory.

Allocating more memory will be documented in your container docs.

Do you have a specific problem or is this just a general query?

Bill

kavin clain
Ranch Hand

Joined: Jan 19, 2010
Posts: 68
Actually the basic problem is all about limiting memory(Heap size) and affecting resources(affecting the heap).
I am concerned about my upcoming web application and resource allocation.

I have few more queries:

We save some information in session then how to handle such circumstances when session serialized on disk?
Does making objects Serializable solve this issue?

Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6661
    
    5

Does making objects Serializable solve this issue?


Yes all objects bound to session / application scopes must be serializable since they can be moved across instances.
 
 
subject: Session and request capacity