IntelliJ open source
[Logo] JavaRanch » Big Moose Saloon
  Search | FAQ | Recent Topics | Hot Topics
Register / Login


Reply Bookmark it! Watch this topic JavaRanch » Forums » Java » Performance
 
RSS feed
 
New topic
Author

Session and request capacity

kavin clain
Ranch Hand

Joined: Jan 19, 2010
Messages: 42

Is there any limit to save information on session and request object...
Deepak Bala
Bartender

Joined: Feb 24, 2006
Messages: 4876

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 - SCJP Mocks - SCJP 5 Mock exam (Word document ) - SCJP 5 Mock exam in Java.Inquisition format
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Messages: 10261

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

Java Resources at www.wbrogden.com
kavin clain
Ranch Hand

Joined: Jan 19, 2010
Messages: 42

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
Messages: 10261

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


Java Resources at www.wbrogden.com
kavin clain
Ranch Hand

Joined: Jan 19, 2010
Messages: 42

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
Messages: 4876

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.

SCJP 6 articles - SCJP 5/6 mock exams - SCJP Mocks - SCJP 5 Mock exam (Word document ) - SCJP 5 Mock exam in Java.Inquisition format
 
jQuery in Action
 
 
Reply Bookmark it! Watch this topic JavaRanch » Forums » Java » Performance
 
RSS feed
 
New topic
replay challenge

.