Win a copy of TDD for a Shopping Website LiveProject this week in the Testing 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Load Balancing Problem with jsessionid

 
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ever since I found this suit I've felt strange new needs. And a tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic