You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Joseph Chiu <jc...@spun.com> on 2000/08/21 06:45:27 UTC

No sticky sessions (Re: Load Balancing)

Bah!  Load balancing doesn't work in the official 3.1 distribution.  At
least not in the "works like Jserv" sense...  The mechanism that tacks on
the jvmRoute is missing, so the jsessionid cookie never gets the
ever-important jvmRoute cookie.

The latest tree looks like it's almost there.  At least the Request object
has a setJvmRoute() method...

So, the only other thing to do is hack in something that'll set the jvmRoute
value for each Request object...

Hmmm, I guess this is what's called a "sticky session"...
http://www.metronet.com/~wjm/tomcat/FromFeb11/msg03296.html

Blech.   I just found this out tonight...  And we were so hoping to go live
Tomcat in two weeks!

-J
----
From: Andrew Cowie <af...@upoc-inc.com>
Date: Wed, 16 Aug 2000 20:39:06 -0400
I normally would not have posted post here but we at a critical point, and
urgently need your help, and so I have a question specifically for Gal
Shachor and Jean-Luc Rochat, but would appreciate input from the developers
as a whole. My question:

				Is load balancing working?

I am referring to configuring Apache so that mod_jserv sends JSERV_ROUTE
information over ajp12 to multiple Tomcat servlet machines, leading to the
Tomcat which receives a new connection to append JSERV_ROUTE to the
JSESSIONID cookie it sends back, so that future web requests are routed to
the correct servlet machine (with the user's session).

We have sniffed the traffic to 8007, and identified the text "JS1" (the
ApJServRoute for that particular server) - so mod_jserv seems to be working.
However, examining the cookies that the user's browser receives, the .JS1 is
never appended to the cookie, and so the next request is not routed by
mod_jserv to the correct Servlet machine.

The section of our httpd.conf which governs mod_jserv (modeled on the
Load-Balancing-HOWTO document) is included below my signature. Everything
else works - the pages compile and are served up correctly - it's just that
the JSESSIONID cookie is not being returned with the ".JS1" (or ".JS2")
appended, leading the next request to go to a random servlet; of course if
it doesn't go to the right one, crunch.

We have spent the better part of 5 days reading the source code for both
mod_jserv and the Ajp, Request, and other relevant classes in Tomcat. It
looks as if the code is there, but we cannot see any evidence of a
configuration parameter which we have to set on the Tomcat side to turn it
on. Every email I have seen on the subject in either Apache-Java or Jakarta
refers to it "just working" following checkins in February and April.

Configuration:

web servers (4)
	Sun Netra T1 running Solaris 2.7
	Apache 1.3.11
	mod_jserv from Tomcat 3.1 (which is the same as JServ 1.1.2 anyway)

servlet servers (2)
	Sun 220R  running Solaris 2.7
	Tomcat 3.1


Any response on this subject would be greatly appreciated. If we cannot
figure this out soon we will likely have to hardwire web servers to servlet
machines, and that would seriously erode our scalability and fault
tolerance.

Merci a tous,

		Andrew

--
Andrew Frederick Cowie
Director of Operations
Upoc, Inc

cell: 917-217-4578  office: 212-405-1044
afcowie@upoc-inc.com




------ extracted from httpd.conf ------ (it is the same on each web server).


<IfModule mod_jserv.c>

ApJServManual on

# everything goes to the balanced set
ApJServMount default balance://set1/root

# establishes hosts in the set to balance over
ApJServBalance set1 SERV1
ApJServBalance set1 SERV2

# maps hosts to actual server DNS names
ApJServHost SERV1 ajpv12://servlet1.upoc.com:8007
ApJServHost SERV2 ajpv12://servlet2.upoc.com:8007

# establishes cookie-based routing to restrict each session to a single host
ApJServRoute JS1 SERV1
ApJServRoute JS2 SERV2

# "shared memory" file for apache processes running on this server
ApJServShmFile log/jserv_shm

ApJServSecretKey DISABLED

# note that the following directives are not from the above-mentioned
example
ApJServLogLevel notice
AddType test/jsp .jsp
AddHandler jserv-servlet .jsp

</IfModule>

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org

----
Joseph Chiu, Systems Engineer. w:(626) 229-3148 c:(626) 643-2448
Spun.com: Your Online Entertainment Exchange.

"'Have a great day.'  Hmm, sounds good, but let's run it through legal
first..."


Re: No sticky sessions (Re: Load Balancing)

Posted by "yhs@mimic.onesourcecorp.com" <yh...@mimic.onesourcecorp.com>.

On Sun, 20 Aug 2000, Joseph Chiu wrote:

> Bah!  Load balancing doesn't work in the official 3.1 distribution.  At
> least not in the "works like Jserv" sense...  The mechanism that tacks on
> the jvmRoute is missing, so the jsessionid cookie never gets the
> ever-important jvmRoute cookie.
> 
> The latest tree looks like it's almost there.  At least the Request object
> has a setJvmRoute() method...
> 
> So, the only other thing to do is hack in something that'll set the jvmRoute
> value for each Request object...
> 
> Hmmm, I guess this is what's called a "sticky session"...
> http://www.metronet.com/~wjm/tomcat/FromFeb11/msg03296.html
> 
> Blech.   I just found this out tonight...  And we were so hoping to go live
> Tomcat in two weeks!
> 
> -J

ugh. can we leave it the way it is ? its a really bad idea to fiddle with
fairly complex C code and leave it untested/partially tested two weeks
before release...or at least have the option of removing the
sticky load balancing like JServ thingy...its does do sticky stuff with
the same servlet...just not with more than 1 servlet. 
-Ys-
yhs@mimic.onesourcecorp.com



RE: No sticky sessions (Re: Load Balancing)

Posted by Joseph Chiu <jc...@spun.com>.
Eep.  After digging around the source quite a bit more, I partly retract the
part where I said "the mechanism that tacks on the jvmRoute is missing".  I
see that there's code that sets the jvmRoute string to the JServ "Route"
value...

BUT, somehow, the session cookie still doesn't tack on the jvmRoute
string...  Sooooo, can anyone point me to how I can get the JServ route
suffix in my session cookies, please?

Thank you.
-J

-----Original Message-----
From: Joseph Chiu [mailto:jchiu@spun.com]
Sent: Sunday, August 20, 2000 9:45 PM
To: tomcat-dev@jakarta.apache.org
Subject: No sticky sessions (Re: Load Balancing)


Bah!  Load balancing doesn't work in the official 3.1 distribution.  At
least not in the "works like Jserv" sense...  The mechanism that tacks on
the jvmRoute is missing, so the jsessionid cookie never gets the
ever-important jvmRoute cookie.

The latest tree looks like it's almost there.  At least the Request object
has a setJvmRoute() method...

So, the only other thing to do is hack in something that'll set the jvmRoute
value for each Request object...

Hmmm, I guess this is what's called a "sticky session"...
http://www.metronet.com/~wjm/tomcat/FromFeb11/msg03296.html

Blech.   I just found this out tonight...  And we were so hoping to go live
Tomcat in two weeks!

-J
----
From: Andrew Cowie <af...@upoc-inc.com>
Date: Wed, 16 Aug 2000 20:39:06 -0400
I normally would not have posted post here but we at a critical point, and
urgently need your help, and so I have a question specifically for Gal
Shachor and Jean-Luc Rochat, but would appreciate input from the developers
as a whole. My question:

				Is load balancing working?

I am referring to configuring Apache so that mod_jserv sends JSERV_ROUTE
information over ajp12 to multiple Tomcat servlet machines, leading to the
Tomcat which receives a new connection to append JSERV_ROUTE to the
JSESSIONID cookie it sends back, so that future web requests are routed to
the correct servlet machine (with the user's session).

We have sniffed the traffic to 8007, and identified the text "JS1" (the
ApJServRoute for that particular server) - so mod_jserv seems to be working.
However, examining the cookies that the user's browser receives, the .JS1 is
never appended to the cookie, and so the next request is not routed by
mod_jserv to the correct Servlet machine.

The section of our httpd.conf which governs mod_jserv (modeled on the
Load-Balancing-HOWTO document) is included below my signature. Everything
else works - the pages compile and are served up correctly - it's just that
the JSESSIONID cookie is not being returned with the ".JS1" (or ".JS2")
appended, leading the next request to go to a random servlet; of course if
it doesn't go to the right one, crunch.

We have spent the better part of 5 days reading the source code for both
mod_jserv and the Ajp, Request, and other relevant classes in Tomcat. It
looks as if the code is there, but we cannot see any evidence of a
configuration parameter which we have to set on the Tomcat side to turn it
on. Every email I have seen on the subject in either Apache-Java or Jakarta
refers to it "just working" following checkins in February and April.

Configuration:

web servers (4)
	Sun Netra T1 running Solaris 2.7
	Apache 1.3.11
	mod_jserv from Tomcat 3.1 (which is the same as JServ 1.1.2 anyway)

servlet servers (2)
	Sun 220R  running Solaris 2.7
	Tomcat 3.1


Any response on this subject would be greatly appreciated. If we cannot
figure this out soon we will likely have to hardwire web servers to servlet
machines, and that would seriously erode our scalability and fault
tolerance.

Merci a tous,

		Andrew

--
Andrew Frederick Cowie
Director of Operations
Upoc, Inc

cell: 917-217-4578  office: 212-405-1044
afcowie@upoc-inc.com




------ extracted from httpd.conf ------ (it is the same on each web server).


<IfModule mod_jserv.c>

ApJServManual on

# everything goes to the balanced set
ApJServMount default balance://set1/root

# establishes hosts in the set to balance over
ApJServBalance set1 SERV1
ApJServBalance set1 SERV2

# maps hosts to actual server DNS names
ApJServHost SERV1 ajpv12://servlet1.upoc.com:8007
ApJServHost SERV2 ajpv12://servlet2.upoc.com:8007

# establishes cookie-based routing to restrict each session to a single host
ApJServRoute JS1 SERV1
ApJServRoute JS2 SERV2

# "shared memory" file for apache processes running on this server
ApJServShmFile log/jserv_shm

ApJServSecretKey DISABLED

# note that the following directives are not from the above-mentioned
example
ApJServLogLevel notice
AddType test/jsp .jsp
AddHandler jserv-servlet .jsp

</IfModule>

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org

----
Joseph Chiu, Systems Engineer. w:(626) 229-3148 c:(626) 643-2448
Spun.com: Your Online Entertainment Exchange.

"'Have a great day.'  Hmm, sounds good, but let's run it through legal
first..."


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org