This week's book giveaway is in the HTML Pages with CSS and JavaScript forum.
We're giving away four copies of Testing JavaScript Applications and have Lucas da Costa on-line!
See this thread for details.
Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Load Balancing Problem with jsessionid

 
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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!
 
Anirvan Majumdar
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:

Tomcat 1 - server.xml


Tomcat 2 - server.xml


Tomcat 3 - server.xml


Hope this helps!
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
 
    Bookmark Topic Watch Topic
  • New Topic