Load Balance of Tomcat with Apache by George Fu, UCCS CS 526 Semester Project Spring 2009
Outline Our webserver system introduction HTTP Load balancing on Solaris The work I did Future work Conclusions References
Our Current Web Servers on Solaris Client Internet
Problems No Load Balance Single Point of Failure No Transparent Failover and Failback No Scalability Performance Low Availability
Resolutions on Solaris Hardware based load balancing Reverse proxy:mod_proxy, mod_jk, mod_cluster Load balancing appliance (Juniper, Cisco…) Tomcat balancer application DNS load balancing (Round Robin)
Mod_Cluster Blancer Allows httpd to act as a load balancer in front of Tomcat based-based webservers JBoss Product Very little configuration on the httpd side Main calculations done on the backend servers Backend server dynamic configuration No more workers.properties
Mod_Proxy Blancer Part of mod_proxy New in Apache HTTP Server 2.2 Two load balancing methods –By number of requests –By number of bytes Detects failed backends
Apache mod_proxy Configuration Listen 80 LogLevel debug TransferLog logs/access_log LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_http_module modules/mod_proxy_http.so LoadModule proxy_balancer_module modules/mod_proxy_balancer.so ProxyPass / balancer://mycluster/ ProxyPassReverse / ProxyPassReverse / BalancerMember BalancerMember
Tomcat and mod_jk Apache + mod_jk Multiple tomcat servers Balancer worker Very easy to do
Apache Worker-Properties File worker.list=loadbalancer worker.tomcat1.port=18081 worker.tomcat1.host=localhost worker.tomcat1.type=ajp13 worker.tomcat1.lbfactor=1 worker.tomcat2.port=28081 worker.tomcat2.host=localhost worker.tomcat2.type=ajp13 worker.tomcat2.lbfactor=1 worker.loadbalancer.type=lb worker.loadbalancer.balanced_workers=tomcat1, tomcat2 worker.loadbalancer.method=Busyness
Apache httpd.conf File JkMount /jsp-examples loadbalancer JkMount /jsp-examples/* loadbalancer
Tomcat server.xml File with: <Server port="8009" with: <Server port="18081"
Our Webservers with Load Balancer
Future Work Problem: Single point of failure DNS round-robin No work at the server side Multiple records in DNS zone file
Example DNS Zone File scalingout.org IN SOA ns.scalingout.org. sctemme.scalingout.org. ( ; Serial ; refresh (1 day) 7200 ; retry (2 hours) ; expire (10 days) ) ; minimum (1 day) scalingout.org. IN NS bagheera.scalingout.org. gw IN A bagheera IN A ;... mail IN CNAME bagheera ns IN CNAME bagheera www IN A IN A IN A
DNS Round-Robin :
Conclusions Apache/Tomcat load balancing is easy No dedicated balancer machine is needed For better performance, mod_cluster can be used
References Aveneet Manget, Load-balancing Tomcat with Apache, ledgecenter.tss?l=LoadBalancingTomcatApache Web ledgecenter.tss?l=LoadBalancingTomcatApache Web Brain Stansberry, A new httpd-based load balancer mod-cluster-jug.pdf mod-cluster-jug.pdf Apacheand Tomcat load balancing cat+load+balancing cat+load+balancing