Tomcat load not distributed equally by Apache
All: We have Apache 2 load balancing two tomcat 4.1.x workers. There are two primary applications running under tomcat. One app has long session times - eg the user logs-in in the morning and doesn't end their session until evening. The other app has short sessions - a connection is made, some work is performed, and they get out in under 3 minutes. Mod_jk is providing the load balancing via weighted round-robin. Both workers are equally weighted. In theory, each worker should have the same load distribution. (Truly in theory, each worker gets an equivalent number of sessions. Right? Our apps have sessions with a disproportionate number of transactions per session.) We see worker1 averaging higher CPU usage. I can justify this behavior because of session affinity being enabled -- and the huge difference in transactions per session in the applications. Two questions. (1) Am I missing something or are our assumptions wrong? (2) How could we distribute load to the tomcat workers via tomcat CPU usage instead of round-robin? Is there is a different Apache module that can load balance via tomcat CPU usage? Any help, guidance, direction you can provide would be greatly appreciated. Scott
RE: Tomcat load not distributed equally by Apache
Thanks very much Simon. :) We will take a look at this. Best Regards, Scott -Original Message- From: Simon Pabst [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 15, 2003 1:25 PM To: Tomcat Users List Subject: Re: Tomcat load not distributed equally by Apache We had the same problem, see this thread http://www.mail-archive.com/[EMAIL PROTECTED]/msg97638.html Unless mod_jk Developers fix this, the only possible solution seems to build and use Apache 2 with Multithreading support (i used the worker mpm, perchild should work too, see http://httpd.apache.org/docs-2.0/mpm.html ) then build mod_jk1/2 again with the new apxs. I used for my Apache2/mod_jk2/mod_ssl: httpd-2.0.47: ./configure --prefix=/path/to/apache2 --with-mpm=worker --enable-ssl --enable-so --enable-rewrite --enable-proxy tomcat-connectors-1.1M1-src: ./configure --with-apxs2=/path/to/apache2/bin/apxs [ --with-java-home=/path/to/java --with-jni ] At 13:09 15.07.2003 -0400, you wrote: All: We have Apache 2 load balancing two tomcat 4.1.x workers. There are two primary applications running under tomcat. One app has long session times - eg the user logs-in in the morning and doesn't end their session until evening. The other app has short sessions - a connection is made, some work is performed, and they get out in under 3 minutes. Mod_jk is providing the load balancing via weighted round-robin. Both workers are equally weighted. In theory, each worker should have the same load distribution. (Truly in theory, each worker gets an equivalent number of sessions. Right? Our apps have sessions with a disproportionate number of transactions per session.) We see worker1 averaging higher CPU usage. I can justify this behavior because of session affinity being enabled -- and the huge difference in transactions per session in the applications. Two questions. (1) Am I missing something or are our assumptions wrong? (2) How could we distribute load to the tomcat workers via tomcat CPU usage instead of round-robin? Is there is a different Apache module that can load balance via tomcat CPU usage? Any help, guidance, direction you can provide would be greatly appreciated. Scott - 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]
configuring tomcat/apache using loadbalancing for ajp
I am curious if this setup looks correct. I am confused about using the alias directive. If you have multiple workers how can you specify more than one alias with the same fakename? Do I need to use them. do I need to explicitly use them for the JkMount directives? thanks Scott Alias /bizflow /apps/tomcat/tomcat-worker1/webapps/bizflow Alias /bizapps /apps/tomcat/tomcat-worker2/webapps/bizapps Alias /bizflow /apps/tomcat/tomcat-worker1/webapps/bizflow Alias /bizapps /apps/tomcat/tomcat-worker2/webapps/bizapps Directory /apps/tomcat/tomcat-worker1/webapps/bizflow Allow from all /Directory Directory /apps/tomcat/tomcat-worker2/webapps/bizflow Allow from all /Directory Directory /apps/tomcat/tomcat-worker1/webapps/bizapps Allow from all /Directory Directory /apps/tomcat/tomcat-worker2/webapps/bizapps Allow from all /Directory JkMount /bizflow/*.jsp loadbalancer JkMount /bizapps/*.jsp loadbalancer JkMount /bizapps/*/servlet/ loadbalancer JkMount /bizflow/*/servlet/ loadbalancer worker.list=worker1, worker2, loadbalancer # # First tomcat server # worker.worker1.port=8015 worker.worker1.host=localhost worker.worker1.type=ajp13 # Specify the size of the open connection cache. worker.worker1.cachesize=50 # # Specifies the load balance factor when used with # a load balancing worker. # Note: # lbfactor must be 0 # Low lbfactor means less work done by the worker. worker.worker1.lbfactor=100 # # Second tomcat server # worker.worker2.port=8016 worker.worker2.host=localhost worker.worker2.type=ajp13 # Specify the size of the open connection cache. worker.worker2.cachesize=50 # # Specifies the load balance factor when used with # a load balancing worker. # Note: # lbfactor must be 0 # Low lbfactor means less work done by the worker. worker.worker2.lbfactor=100 # # Load Balancer worker # # # The loadbalancer (type lb) worker performs weighted round-robin # load balancing with sticky sessions. # Note: # If a worker dies, the load balancer will check its state #once in a while. Until then all work is redirected to peer #worker. worker.loadbalancer.type=lb worker.loadbalancer.balanced_workers=worker1, worker2 # $Header:$ # Based upon the NCSA server configuration files originally by Rob McCool. # # This is the main Apache server configuration file. It contains the # configuration directives that give the server its instructions. # See URL:http://httpd.apache.org/docs-2.0/ for detailed information about # the directives. # # Do NOT simply read the instructions in here without understanding # what they do. They're here only as hints or reminders. If you are unsure # consult the online docs. You have been warned. # # The configuration directives are grouped into three basic sections: # 1. Directives that control the operation of the Apache server process as a # whole (the 'global environment'). # 2. Directives that define the parameters of the 'main' or 'default' server, # which responds to requests that aren't handled by a virtual host. # These directives also provide default values for the settings # of all virtual hosts. # 3. Settings for virtual hosts, which allow Web requests to be sent to # different IP addresses or hostnames and have them handled by the # same Apache server process. # # Configuration and logfile names: If the filenames you specify for many # of the server's control files begin with / (or drive:/ for Win32), the # server will use that explicit path. If the filenames do *not* begin # with /, the value of ServerRoot is prepended -- so logs/foo.log # with ServerRoot set to /apps/apache/apache-2.0.43 will be interpreted by the # server as /apps/apache/apache-2.0.43/logs/foo.log. # ### Section 1: Global Environment # # The directives in this section affect the overall operation of Apache, # such as the number of concurrent requests it can handle or where it # can find its configuration files. # # # ServerRoot: The top of the directory tree under which the server's # configuration, error, and log files are kept. # # NOTE! If you intend to place this on an NFS (or otherwise network) # mounted filesystem then please read the LockFile documentation (available # at URL:http://httpd.apache.org/docs-2.0/mod/mpm_common.html#lockfile); # you will save yourself a lot of trouble. # # Do NOT add a slash at the end of the directory path. # ServerRoot /apps/apache/apache-2.0.43 # # The accept serialization lock file MUST BE STORED ON A LOCAL DISK. # IfModule !mpm_winnt.c IfModule !mpm_netware.c #LockFile logs/accept.lock /IfModule /IfModule # # ScoreBoardFile: File used to store internal server process