Tomcat and IIS load balancing configuration
I am testing a load balancing configuration with Tomcat and IIS using the isapi_redirector. My configuration works if I have a single worker defined in my workers.properties file but it fails if I try to add a second worker (ie, I change the balance_workers entry near the bottom of the file to the one that is currently commented out). One of the symptoms I see of the problem is that when my servlet calls request.getRequestedSessionId() I get back a null. Here is my workers.properties file: workers.tomcat_home=d:\tomcat workers.java_home=c:\progra~1\java\jre15~1.0_0 ps=\ worker.list=wlb worker.ajp13w.type=ajp13 worker.ajp13w.host=localhost worker.ajp13w.port=8009 worker.ajp13w.cachesize=500 worker.ajp13w.cache_timeout=600 worker.ajp13w.socket_keepalive=1 worker.ajp13w.recycle_timeout=300 worker.ajp13w.lbfactor=1 worker.ajp13w.debug=9 worker.ajp13x.type=ajp13 worker.ajp13x.host=localhost worker.ajp13x.port=8010 worker.ajp13x.cachesize=500 worker.ajp13x.cache_timeout=600 worker.ajp13x.socket_keepalive=1 worker.ajp13x.recycle_timeout=300 worker.ajp13x.lbfactor=1 worker.ajp13x.debug=9 worker.wlb.type=lb #worker.wlb.balance_workers=ajp13w,ajp13x worker.wlb.balance_workers=ajp13w worker.wlb.sticky_session=1 worker.jkstatus.type=status - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [Solved]: Load Balancing Configuration
beautiful! glad i could help save you some time and suffering :) On Thu, 23 Sep 2004, Fournier, Pete wrote: Date: Thu, 23 Sep 2004 13:15:20 -0400 From: Fournier, Pete [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Subject: [Solved]: Load Balancing Configuration I finally have IIS on two machines serving up load balanced requests to two Tomcat machines and maintiaining Sticky Sessions. Below I am including the workers2.properties file that did the trick in case anyone else is having touble doing this. The only other change I had to make was to the Server.xml file, there you just alter the Engine node to include a jvmRoute setting, make the setting unique per Tomcat installation and use that in the workers2.properties file as the tomcatID and route settings for the channel.socket definition. Thanks for the help Alex, your clustering example got me changing some stuff around that did the trick. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[Solved]: Load Balancing Configuration
I finally have IIS on two machines serving up load balanced requests to two Tomcat machines and maintiaining Sticky Sessions. Below I am including the workers2.properties file that did the trick in case anyone else is having touble doing this. The only other change I had to make was to the Server.xml file, there you just alter the Engine node to include a jvmRoute setting, make the setting unique per Tomcat installation and use that in the workers2.properties file as the tomcatID and route settings for the channel.socket definition. Thanks for the help Alex, your clustering example got me changing some stuff around that did the trick. BEGIN workers2.properties [logger] info=Native logger level=ERROR [config:] file=${serverRoot}/conf/workers2.properties debug=1 debugEnv=1 [uriMap:] info=Maps the requests. debug=1 [shm] info=Scoreboard. Required for reconfiguration and status with multiprocess servers file=c:/Tomcat5/work/jk2.shm debug=0 [workerEnv:] info=Global server options timing=0 debug=1 [lb:lb] Info=default load balancer debug=1 [channel.socket:pfournier:8019] host=pfournier port=8019 tomcatId=pfournierTomcat lb_factor=100 route=pfournierTomcat [ajp13:pfournier:8019] channel=channel.socket:pfournier:8019 [channel.socket:kfansler1:8009] host=kfansler1 port=8009 tomcatId=kfanslerTomcat lb_factor=100 route=kfanslerTomcat [ajp13:kfansler1:8009] channel=channel.socket:kfansler1:8009 [lb:PetesLB] worker=ajp13:pfournier:8019 worker=ajp13:kfansler1:8009 timeout=30 attempts=2 recovery=90 StickySession=1 noWorkersMsg=Server busy please try back later. noWorkerCodeMsg=503 [uri:/admin] info=Tomcat HTML based administration web application. debug=0 [uri:/manager] info=A scriptable management web application for the Tomcat Web Server. debug=0 [uri:/*.jsp] info=JSP Extension mapping. debug=0 [uri:/ZipCode/ZipCodeLookup] info=ZipCodeApplication debug=0 group=lb:PetesLB [uri:/SessionTester/*] info=Session Test Application debug=0 group=lb:PetesLB [status:] [uri:/jkstatus/*] group=status END workers2.properties Peter Fournier
Re: Load Balancing Configuration
Hi Pete. If you do a search on this list, i posted last week an email with the configurations that work ... check it out. On Tue, 21 Sep 2004, Fournier, Pete wrote: Date: Tue, 21 Sep 2004 16:38:14 -0400 From: Fournier, Pete [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Load Balancing Configuration - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Load Balancing Configuration
Found the message. Unless I am reading it wrong that is for Clustering. I am looking at configuring Load Balancing with sticky sessions. I have managed to get the adaptor to route requests to each of the Tomcat instances since I originally posted yesterday, the only remaining problem is the session is not sticking. I can see it bouncing between the two of them. My current round-robin-non-session-sticking workers2.properties file is below. Thanks, Peter Fournier / BEGIN workers2.properties [logger] info=Native logger level=ERROR [config:] file=${serverRoot}/conf/workers2.properties debug=1 debugEnv=1 [uriMap:] info=Maps the requests. debug=1 [shm] info=Scoreboard. Required for reconfiguration and status with multiprocess servers file=c:/Tomcat5/work/jk2.shm debug=0 [workerEnv:] info=Global server options timing=0 debug=1 [lb:lb] Info=default load balancer debug=1 [channel.socket:pfournier:8019] host=pfournier port=8019 tomcatId=pfournierTomcat group=PetesLB lb_factor=100 route=pfournierTomcat [ajp13:pfournier:8019] channel=channel.socket:pfournier:8019 [channel.socket:kfansler1:8009] host=kfansler1 port=8009 tomcatId=kfanslerTomcat group=PetesLB lb_factor=100 route=kfanslerTomcat [ajp13:kfansler1:8009] channel=channel.socket:kfansler1:8009 [lb:PetesLB] worker=ajp13:pfournier:8019 worker=ajp13:kfansler1:8009 timeout=30 attempts=2 recovery=90 StickySession=1 noWorkersMsg=Server busy please try back later. noWorkerCodeMsg=503 [uri:/admin] info=Tomcat HTML based administration web application. debug=0 [uri:/manager] info=A scriptable management web application for the Tomcat Web Server. debug=0 [uri:/*.jsp] info=JSP Extension mapping. debug=0 [uri:/ZipCode/ZipCodeLookup] info=ZipCodeApplication debug=0 group=lb:PetesLB [status:] [uri:/jkstatus/*] group=status / END workers2.properties -Original Message- From: Alex [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 22, 2004 11:02 AM To: Tomcat Users List Subject: Re: Load Balancing Configuration Hi Pete. If you do a search on this list, i posted last week an email with the configurations that work ... check it out. On Tue, 21 Sep 2004, Fournier, Pete wrote: Date: Tue, 21 Sep 2004 16:38:14 -0400 From: Fournier, Pete [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Load Balancing Configuration - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Load Balancing Configuration
when i was playing with sticky sessions (ultimately didn't get it working -- which is why i went with the tomcat cluster and session replciation .. which has it's benefits) try putting StickySession=1 against the channel and/or the lb group. does this affect things? i remember having it in for each channel and at the time i thought it was right ... only the jk2 adapter didn't support it. On Wed, 22 Sep 2004, Fournier, Pete wrote: Date: Wed, 22 Sep 2004 11:58:28 -0400 From: Fournier, Pete [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Subject: RE: Load Balancing Configuration Found the message. Unless I am reading it wrong that is for Clustering. I am looking at configuring Load Balancing with sticky sessions. I have managed to get the adaptor to route requests to each of the Tomcat instances since I originally posted yesterday, the only remaining problem is the session is not sticking. I can see it bouncing between the two of them. My current round-robin-non-session-sticking workers2.properties file is below. Thanks, - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Load Balancing Configuration
Hi, I have an application running on my machine in Tomcat 5 via IIS using the ISAPI adaptor. I also have this application running on a different machine setup through IIS on that machine. I now want to test balancing the application on both machines via one of the IIS servers. I have followed the instructions in the book I got on Apache by wrox, but each time I call into the application the request hangs forever. Forever defined as 5 minutes. It appears that tomcat is being contacted, the CPU jumps for a sec on the tomcat process, but nothing happens after that. To simplify I am now trying to setup load balancing with just my one instance on my machine figuring that after I get that working it will be easier to translate it to both instances. This is failing, also. I believe I simply have something misconfigured, but my settings match what the book is showing and I have tried several variations. My workers2.properties files are below, both non-balanced (working) and balanced (hanging). The jk2.properties file remains unchanged for each setup. My machine is Win2K Pro, IIS5, Tomcat 5.0.27 running with JDK 1.4.2_01. I am confident that my installation is good with the non-balanced file in place. I have put a fair amount of load through the application using an http testing utility, it served 140 requests/second on my desktop machine. Any help appreciated. Thanks, Peter Fournier BEGIN Server.xml change (only showing changed Engine section) ... !-- You should set jvmRoute to support load-balancing via JK/JK2 ie : -- Engine name=Standalone defaultHost=localhost debug=0 jvmRoute=pfournierTomcat !-- Define the top level container in our container hierarchy -- !-- Engine name=Catalina defaultHost=localhost debug=0 -- ... END Server.xml change BEGIN WORKING workers2.properties FILE (entire file) [logger] info=Native logger level=ERROR [config:] file=${serverRoot}/conf/workers2.properties debug=1 debugEnv=1 [uriMap:] info=Maps the requests. debug=1 [shm] info=Scoreboard. Required for reconfiguration and status with multiprocess servers file=c:/Tomcat5/work/jk2.shm debug=0 [workerEnv:] info=Global server options timing=0 debug=1 [lb:lb] Info=default load balancer debug=1 [channel.socket:localhost:8019] host=pfournier port=8019 [ajp13:pfournier:8019] channel=channel.socket:pfournier:8019 [uri:/admin] info=Tomcat HTML based administration web application. debug=0 [uri:/manager] info=A scriptable management web application for the Tomcat Web Server. debug=0 [uri:/*.jsp] info=JSP Extension mapping. debug=0 [uri:/ZipCode/ZipCodeLookup] info=ZipCodeApplication debug=0 [status:] [uri:/jkstatus/*] group=status END WORKING workers2.properties FILE BEGIN Load Balanced workers2.properties FILE (entire file) [logger] info=Native logger level=ERROR [config:] file=${serverRoot}/conf/workers2.properties debug=1 debugEnv=1 [uriMap:] info=Maps the requests. debug=1 [shm] info=Scoreboard. Required for reconfiguration and status with multiprocess servers file=c:/Tomcat5/work/jk2.shm debug=0 [workerEnv:] info=Global server options timing=0 debug=1 [lb:lb] Info=default load balancer debug=1 [lb:PetesLB] worker=ajp13:localhost:8019 timeout=30 attempts=2 recovery=90 stickySession=1 noWorkersMsg=Server busy please try back later. noWorkerCodeMsg=503 [channel.socket:localhost:8019] host=localhost port=8019 tomcatId=pfournierTomcat group=PetesLB lb_factor=1 route=pfournierTomcat [ajp13:localhost:8019] channel=channel.socket:localhost:8019 [uri:/admin] info=Tomcat HTML based administration web application. debug=0 [uri:/manager] info=A scriptable management web application for the Tomcat Web Server. debug=0 [uri:/*.jsp] info=JSP Extension mapping. debug=0 [uri:/ZipCode/ZipCodeLookup] info=ZipCodeApplication debug=0 context=/ZipCode group=PetesLB [status:] [uri:/jkstatus/*] group=status END Load Balanced workers2.properties FILE