Walter Lee

Simple Load Balancing (LB) in Sun Java Web Server Reverse Proxy Plugin (RPP)

Tuesday Jun 24, 2008

One common mistake in setting up Load Balancing (LB) with Sun Java Web Server Reverse Proxy Plugin (RPP) is the use of commas or semi-colons to separate different backend hosts in the "servers" parameter.


See http://docs.sun.com/source/819-0902-05/rpp61.html#wp010


 "servers
- A quoted, space-delimited list of the servers that receive
the forwarded requests. Individual server names may optionally
be prefixed with http:// or https:// to indicate the protocol
and/or suffixed with a colon and integer to indicate the port."


 So, in my env,


I set up my RPP front-end to backend to two web instances, e.g. in RPP front-end obj.conf,


<Object name="default">
AuthTrans fn="match-browser" browser="*MSIE*" ssl-unclean-shutdown="true"
NameTrans fn="assign-name" from="/amserver(|/*)" name="amserver"
NameTrans fn="assign-name" from="/amconsole(|/*)" name="amconsole"
....


<Object name="amserver">
ObjectType fn="force-type" type="magnus-internal/passthrough"
Service  fn="service-passthrough" servers="https://apple.asia.sun.com:61602 https://apple.asia.sun.com:61802"  rewrite-host="true"
Error reason="Bad Gateway" fn="send-error" uri="/badgateway.html"
</Object>

<Object name="amconsole">
ObjectType fn="force-type" type="magnus-internal/passthrough"
Service fn="service-passthrough" servers="https://apple.asia.sun.com:61602 https://apple.asia.sun.com:61802" rewrite-host="true"
Error reason="Bad Gateway" fn="send-error" uri="/badgateway.html"
</Object>


You can see my AM server backends at servers="https://apple.asia.sun.com:61602 https://apple.asia.sun.com:61802" .
 (Note - the space delimiter above, NOT any comma or semi-colons!)


When we hit http://apple.asia.sun.com:61904/amserver/   (which is the front-end RPP url) 4 times,


I got LB hits across the two backends evenly,


 e.g. from https://apple.asia.sun.com:61602  backend instance logs,


129.158.175.16 - - [24/Jun/2008:11:45:47 +0800] "GET /amserver/ HTTP/1.1" 200 38 -- 750
129.158.175.16 - - [24/Jun/2008:11:46:05 +0800] "GET /amserver/ HTTP/1.1" 200 38 -- 750


and from https://apple.asia.sun.com:61802 backend  instance logs,


129.158.175.16 - - [24/Jun/2008:11:45:53 +0800] "GET /amserver/ HTTP/1.1" 200 38
129.158.175.16 - - [24/Jun/2008:11:46:10 +0800] "GET /amserver/ HTTP/1.1" 200 38


(You can see the alternate  time stamps above for the LB)  


When I tested and stopped 1st backend  instance https://apple.asia.sun.com:61602  backend instance, then all hits will go to the 2nd backend instance,


129.158.175.16 - - [24/Jun/2008:11:45:53 +0800] "GET /amserver/ HTTP/1.1" 200 38
129.158.175.16 - - [24/Jun/2008:11:46:10 +0800] "GET /amserver/ HTTP/1.1" 200 38



(after I stopped 1st backend instance, then all hits go to 2nd instance below)

129.158.175.16 - - [24/Jun/2008:11:47:22 +0800] "GET /amserver/ HTTP/1.1" 200 38
129.158.175.16 - - [24/Jun/2008:11:47:26 +0800] "GET /amserver/ HTTP/1.1" 200 38


Hope this shows how to set up and test RPP functions in Sun  Java Web Server .




[2] Comments
Like this post? del.icio.us | furl | slashdot | technorati | digg