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

load balancing & session management

Shrawan Bhageria
Ranch Hand

Joined: Jun 20, 2005
Posts: 52
hi all

pl. help me

how we maintain session management in case server load balancing.
pl. explain with example


SCJP 1.4, SCWCD 1.4, MCP
Paul Bourdeaux
Ranch Hand

Joined: May 24, 2004
Posts: 783
The answer is going to be specific to the type of server you are using. An application server is not required to support distributed applications, but most do.

Basically, servers that support load balancing and clusters maintain session information in some type of datastore that each cluster machine can access. If a request comes into a machine, and its session exists on a different machine, the container will migrate the session to the machine servicing the new request.

The key point here is that there is only one session per distributed application, and the application server handles all of the migration for you. You can use an HttpSessionActivationListener if you want trigger events when the session is migrated.

“Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.” - Rich Cook
stan ioffe

Joined: Jun 30, 2005
Posts: 16
You can also serialize session data onto a disk and allow a different machine reload that data. ... However, as mentioned above, it's server specific.
I agree. Here's the link:
subject: load balancing & session management
It's not a secret anymore!