• 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
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

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
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic