210 likes | 504 Views
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 . Internet. Our Current Web Servers on Solaris. Client. Problems.
E N D
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
Internet Our Current Web Servers on Solaris Client
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 / http://1.2.3.4:80 • ProxyPassReverse / http://1.2.3.5:80 • <Proxy balancer://mycluster> • BalancerMember http://1.2.3.4:80 • BalancerMember http://1.2.3.5:80 • </Proxy>
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 • <Engine name="Standalone" defaultHost="localhost" debug="0"> with: <Engine jvmRoute="tomcat1" name="Standalone" defaultHost="localhost" debug="0"> • <Server port="8009" with: <Server port="18081"
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. 86400 IN SOA ns.scalingout.org. sctemme.scalingout.org. ( 2006051401 ; Serial 86400 ; refresh (1 day) 7200 ; retry (2 hours) 8640000 ; expire (10 days) 86400 ) ; minimum (1 day) scalingout.org. IN NS bagheera.scalingout.org. gw IN A 10.11.0.1 bagheera IN A 10.11.0.2 ; ... mail IN CNAME bagheera ns IN CNAME bagheera www IN A 10.11.0.113 IN A 10.11.0.114 IN A 10.11.0.115
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, 2008 http://www.theserverside.com/tt/knowledgecenter/knowledgecenter.tss?l=LoadBalancingTomcatApacheWeb • Brain Stansberry, A new httpd-based load balancer http://www.jugs.ch/html/events/slides/090313_BrianStansberry_mod-cluster-jug.pdf • Apacheand Tomcat load balancing http://confluence.atlassian.com/display/DOC/Apache+and+Tomcat+load+balancing