tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Cowie <>
Subject RE: Load balancing
Date Sun, 20 Aug 2000 20:04:59 GMT
[Summary email of a conversation between Nick Bauman and Andrew Cowie; Nick
suggested that I send this correspondence to the -dev list as it is possible
we have uncovered a deep bug.]

Andrew Cowie originally wrote to tomcat-dev:

> > > We have a problem whereby the ApJservRoute is NOT
> > > appended by Tomcat
> > > to the JSESSIONID cookie and so subsequent
> > > requests
> > > go to a random server,
> > > rather than the one hosting that users session.
> > > Crunch.

To which Nick Bauman replied:

> > > Tomcat's distributed session API doesn't actually
> > > work the way you seem to describe it in this post.
> > >
> > > If you have a web server farm for your site, a
> > > session will get created and with "stick" to that 
> > > for its entire lifetime. ... So if you
> > > have 10 servers, one server goes down and you lose
> > > 10% of your sessions: boom, like that.

Andrew replied with a further clarification:

> > I'm not sure if you saw my original message which
> > discussed our
> > architecture, but you seem to be speaking to a
> > slightly different question
> > than the one I'm trying to resolve. 
> > 
> > We fully understand that a session is on one (and
> > only one) servlet machine
> > and that you have to ensure that the user keeps
> > talking to it; loose a
> > servlet machine and poof goes that machine's users. 

To which Nick returned with:

> Oh, OK. I stand corrected.

Andrew continued:

> > The problem we're having is that we were seeking to
> > make use of mod_jserv's
> > ability to load balance across physically
> > distributed servlet machines. We
> > have a three tier architecture: 
> > 
> > Cisco Local Director
> >    |
> > Apache web servers (x4)
> >    |
> > Tomcat servlet servers (x2)
> > 
> > The trick is that Apache is *not* running on the
> > same box as Tomcat.
> > mod_jserv has a load balancing facility built into
> > it, which supports this
> > structure - with Jserv. They do it by appending a
> > routing code, say "JS1"
> > for servlet1, to the JSESSIONID cookie that Tomcat
> > returns.
> > This way, no matter which apache server (or process
> > for that matter) gets
> > hit with the next GET request, it knows where to
> > send the connection so it
> > links up with the single servlet machine which has
> > that user's session. 
> Right, I'm with you. ...
> least as I understood it, I assumed you were talking 
> about mod_jserv + Tomcat.

I was indeed.

> Well, have you looked at mod_jk? I think that's where
> the latest efforts are going. 

This was indeed new to us. [Side comment - tomcat promo material on doesn't make either mod_jserv or mod_jk seem very
significant yet are quite important for Apache integration]

I just looked at mod_jk's source, and it does seem to be along the same
lines as mod_jserv. The question I have then is this: I wasn't able to
identify whether or not you've build in the functionality that mod_jserv's
jserv_balance.c provides. As I've discussed, it allows multiple web machines
to be load balanced because a ROUTE identified is appended to the JSESSIONID
cookie (using mod_jserv terminology for a minute) allowing the whichever
physically separate web server gets the request to know which physically
separate servlet machine (one tier lower) to sent the requests to.

> Make sure whether you should be using mod_jserv or
> mod_jk. I think mod_jk is still a work in progress
> though.

Our impression was that mod_jserv had been ported to Tomcat, and it does
have the multi tier balancing that we require, again, in jserv_balance.c and
other places.

> If your assumptions turn out to be correct,
> that Tomcat's interacting with it's Apache plug-in is
> not fully functional, then please do report it as a
> bug to the bugrat system.

Certainly. Before I do, I'd like to ask:

Is mod_jserv supposed to work specifically with the multi tier load
balancing? There is always lots of discussion about sharing load across
multiple instances or processes, but little about sharing load across
separate physical machines - a necessary requirement for fault tolerance.

[So is it a bug or a feature :)]	

> You may be in a situation
> where what you have is mod_jserv, what you want is
> mod_jk and it's not ready yet.

Specifically, it's multi-tier support that we'd be looking for. If it's not
there (it seems to be there in the code) or doesn't work (seems not to,
based on our observation of the JSERV_ROUTE not being appended to the
JSESSIONID by Tomcat for return back by ajp through mod_jserv to apache and
out) so be it; we have a hardware solution in place right now, but it's a
kludge; we'd just like to know whether it's *supposed* to work, and if so,
what we can do to help *make* it work. 

All things considered, at this point getting mod_jserv to work would be our
preference. I understand the mod_jk effort towards web-server indepence;
we're somewhat more concerned about code maturity as this will be a
production environment for us very shortly; I also hear the comments about
ajp1.3 being stronger; advice on how to move forward would be appreciated. 

> Welcome to Open Source. ;)

Been there, done that. Wahoo! Like I said, we'd like to help if we can.


I've been watching the discussion about the Cookie modification bug in 3.2
... could this be the reason that JSERV_ROUTEs aren't getting appended


Andrew Frederick Cowie
Director of Operations
Upoc, Inc

cell: 917-217-4578  office: 212-405-1044

View raw message