I am using the JK connector methodology for load-balancing 2 Tomcats (5.5) running behind an Apache (2.2.4) web server. I successfully managed to setup the load balancer for a web application for which session management through cookies was enabled. However, when I tried to setup the same configuration for another application which manages sessions using jsessionid and has cookies disabled, I am facing some trouble. It appears that inspite of having explicitly set the "sticky_Session" attribute for the balancer worker, requests made by the same session keep on alternating between the 2 Tomcats.
============================ The worker.properties file ============================
In the server.xml for each Tomcat, I've got the "Engine" element as follows:
Session management through Cookies has been disabled for this application. Instead we are using URL encoding to maintain sessions using the jsessionid.
Anyone who can shed some light on this? Really appreciate!
posted 12 years ago
Well, Disappointingly there doesn't seem to be any response to my query. However, I've managed to fix the issue myself and am sharing this hoping that it should benefit someone in the future.
The problem with my configuration was that, even though I had correctly declared a load-balancer worker - router - to handle multiple "real" workers - worker1, worker2, worker3; my mistake lied in the <Engine> element declaration for my corresponding Tomcats.
I believe I had read in some "How-to" reference that each Tomcat instance's <Engine> element should point to the load-balancer worker. This, I can claim now, is not correct. Each Tomcat's <Engine> element should point to a unique worker belonging to the list of balanced workers of the load-balancer worker. So it should've actually been:
Originally posted by Anirvan Majumdar: Well, Disappointingly there doesn't seem to be any response to my query. However, I've managed to fix the issue myself and am sharing this hoping that it should benefit someone in the future. ... Hope this helps!
Thank you for posting back with your solution. There are several approaches to load balancing. I use sticky sessions at the router level so I wouldn't have been able to answer you question. It could be that, nobody else who has seen your question has run into this problem either. Again, thanks -Ben