tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Simon Papillon" <>
Subject Re: jk load balancing based upon ip address rather than session id
Date Fri, 13 Jun 2008 15:01:30 GMT
Hi Chris,
So just to follow up on your post,

> So, really, it's not that you want to "load balance" based upon IP
> address... you really want to predictably choose a member of the server
> farm based upon some knowledge of the client such that, regardless of
> the domain name used, the initial request (and therefore all the rest)
> go to a particular member.

That's exactly it. I want all requests from the same client to be
channeled through to the same tomcat instance, regardless of the
domain.  Sorry for the confusion.

> You may be able to do this, but you'll certainly have to hack mod_jk in
> order to do it.
> I believe there is a method in mod_jk that chooses the jvmRoute for the
> first (JSESSIONID-less) request. If you were to modify that algorithm,
> you could achieve your goal, here. I'm a little worried that you might
> implement a fragile algorithm, though, and end up with an unbalanced
> load balancer.

I'll check this out, I think you could be right, it will probably lead
to a lumpy load profile accross the tomcat servers, but I might give
it a go.

> Do you have options other than using SSO?
> Come to think of it... how does SSO work when you switch domains with
> even a single server -- that is, without load balancing in the mix? I
> would expect that, since you are switching domains, your browser would
> not send a JSESSIONID cookie to the server, and thus you would not be
> recognized as having an existing session.
> ??!
I set a tracking gif on each page pointing to a single domain e.g. this is served up by the same container
as an query string argument I pass in the jsessionid for whichever
domain the request is made to.  For example if the domains
have sessions as follows : JSESSIONID=1234 : JSESSIONID=ABCD : JSESSIONID=wxyz

a.jsp on
<a href="

a.jsp on
<a href="
etc for

the servlet handling the registers
the different domain specific session ids with its own session id and
thus ties them altogether, thus when one of the session ids logs on,
its associated with a tracker session id which can then propogate the
information to the other user sessions.
Its a bit rough and ready, but seems to work, I think the tracker gif
thing ist the most common way that the web analytics tools work.
If you want more info on this I'll happily send you the code its a
couple of java files about 400 lines in total.

Thanks for your reply,
All the best

To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message