session maintenance across two web-servers with loadbalancer
Joined: Oct 21, 2008
I have two web-servers, both the web-server has its own load balacer, now my problem is when i move from server1 to server2 and back to server1 session is not getting maintained, rather it creates a new session, hence all my session values are lost.
Eg.. I move from weblogic to iplanet server and from iplanet whn am returning back to weblogic i dont see the initial session values, rather it goes null. it works perfectly if there is no load balacer.
Why there is an issue with load balancer? how to fix it? please advise [ October 21, 2008: Message edited by: lavanya muthu ]
Sessions are objects that exist within a Java Virtual machine. Any time you're load balancing, you're going to be dealing with 2 different Java Virtual Machines, and what's in the memory of JVM 1 is totally invisible to JVM 2 and vice versa.
When you use a clustering system like WebLogic provides, the sessions are serialized out to a common resource where whichever machine needs the session can go and serialize the session into its JVM. However, there's no standard mechanism or format for exporting/importing sessions, so when you mix vendors like iPlanet and WebLogic, you are almost certainly not going to be able to exchange them.
Even when you're dealing with a single vendor, you will have to configure the server to share sessions, since that's an expensive operation that's normally turned off for performance reasons.
Also pay attention to the requirement that anything in a session that you want to be clusterable MUST be serializable! The compiler won't warn you if you include non-serializable objects, and usually neither will the server. You'll only discover it when the serialized session is imported and the non-serializable items are missing.
Customer surveys are for companies who didn't pay proper attention to begin with.