File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes is session devil in clustering environment Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "is session devil in clustering environment" Watch "is session devil in clustering environment" New topic

is session devil in clustering environment

Will Lee
Ranch Hand

Joined: Mar 16, 2005
Posts: 58
It is suggested in the office that session should be absolutely forbid in clustering environment. The reason is synchronization among nodes cause overhead and problem. Any argument to support this opinion?

I personally disagree. Session is for stateless server to remember who the caller is. If you need to implement a stateful application, you have to "save" the user info somewhere, either on server, or client side and pass to server every time. Yes, session migration among nodes does introduce overhead, but it doesn't get rid of this issue w/out session: how about the cost to pass user identity and authenticate/authorize user for every request? If carefully designed, we can try to reduce the footprint of the session object so that the migration session won't be too expensive. In our FLEX application, our front end team pretty much cache everything on client side (is that good?) so that only the authentication token will be saved in session.

In addition, the session migration issue has been there for a while and I believe most of the application server should have a optimized way to deal w/ it.

I may overlook some important points to discourage session. Any suggestion?

Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33106

Big sessions are a problem. In your case of it being a single string, I think it is fine. The alternative (checking logon is valid every time something happens) doesn't sound better to me.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Will Lee
Ranch Hand

Joined: Mar 16, 2005
Posts: 58
Thank you Jeanne very much for the reply. It's very helpful for my design. I think I'm going to use session.
I agree. Here's the link:
subject: is session devil in clustering environment
It's not a secret anymore!