{"id":1266,"date":"2012-08-31T17:45:10","date_gmt":"2012-08-31T09:45:10","guid":{"rendered":"http:\/\/rmohan.com\/?p=1266"},"modified":"2012-08-31T17:45:10","modified_gmt":"2012-08-31T09:45:10","slug":"apache-server-load-balancing-with-multiple-tomcat-clustering","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=1266","title":{"rendered":"Apache server load balancing with Multiple Tomcat Clustering- :"},"content":{"rendered":"<p>Load Balancing -: Load balancer accept request from external client and forward them to one of the available Backend servers according to a scheduling algorithm. We can use dedicated hardware and any load balancing software for load balancing Mod_proxy_balancer- : Apache web server\u2019s module of mod_proxy_balancer the apache module developed to provide to load balancing over a set of web server. Load balancer it can keep track of session Sticky Session- A single user always deals with the same backend server.<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"http:\/\/rmohan.com\/wp-content\/uploads\/2012\/08\/javaee-tomcat-load-balancing-480x320.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1267\" title=\"javaee-tomcat-load-balancing-480x320\" src=\"http:\/\/rmohan.com\/wp-content\/uploads\/2012\/08\/javaee-tomcat-load-balancing-480x320.png\" alt=\"\" width=\"320\" height=\"214\" srcset=\"https:\/\/mohan.sg\/wp-content\/uploads\/2012\/08\/javaee-tomcat-load-balancing-480x320.png 320w, https:\/\/mohan.sg\/wp-content\/uploads\/2012\/08\/javaee-tomcat-load-balancing-480x320-300x200.png 300w, https:\/\/mohan.sg\/wp-content\/uploads\/2012\/08\/javaee-tomcat-load-balancing-480x320-150x100.png 150w\" sizes=\"(max-width: 320px) 100vw, 320px\" \/><\/a><br \/>Installation -:<br \/>Apache modules- Download from apache\u2019s web site, mod_proxy module for load balancing <br \/>Windows-: Download mod_proxy modules and copy in modules directory. Linux- Download mod_proxy modules and run following command for compile. <br \/>#.\/configure &#8211;enable-proxy &#8211;enable-proxy-balancer [run .\/configure \u2013h # make # make install<br \/>Configuration-:<br \/>Windows-: Enable following load modules in and add require modules in httpd.conf file<br \/>C:\\Program Files\\Apache Software Foundation\\Apache2.2\\conf\\httpd.conf <br \/>LoadModule proxy_module modules\/mod_proxy.so LoadModule proxy_ajp_module modules\/mod_proxy_ajp.so LoadModule proxy_balancer_module modules\/mod_proxy_balancer.so LoadModule proxy_connect_module modules\/mod_proxy_connect.so LoadModule proxy_ftp_module modules\/mod_proxy_ftp.so LoadModule proxy_http_module modules\/mod_proxy_http.so<br \/>Now we can add following lines for proxy-balancer (Cluster name is domain.abc.net with two member)<br \/>ProxyRequests Off ProxyPass \/ balancer:\/\/domain.abc.net\/ lbmethod=byrequests stickysession=jsessionid nofailover=On maxattempts=15 <br \/>ProxyPreserveHost OnBalancerMember http:\/\/192.168.10.10:84 BalancerMember http:\/\/192.168.100.10:85 Linux- <br \/>We need three servers one is load balancer and other two workers nodes Http Server configuration file \u201c\/etc\/httpd\/conf\/httpd.conf\u201d add following lines<br \/>Include conf\/extra\/httpd-proxy-balancer.conf<br \/>Now create the httpd-proxy-balancer.conf file in the \u201c\/etc\/httpd\/conf\/httpd.conf\u201d and add the following lines.<br \/>ProxyRequests Off ProxyPass \/ balancer:\/\/domain.abc.net\/ lbmethod=byrequests stickysession=jsessionid nofailover=On maxattempts=15 <br \/>ProxyPreserveHost OnBalancerMember http:\/\/192.168.10.10:84 BalancerMember http:\/\/192.168.100.10:85 Load balancing method-:<br \/>There are three type of load balancing method used in mod_prxy Byrequests-:Weighted request count balancing Bytraffic-: Weighted traffic byte count balancing Bybusyiness-: Pending request balancing <br \/>Where method is one of the three listed before. Default is byrequestsBalancerMember http:\/\/192.168.10.10:84 loadfactor=4 BalancerMember http:\/\/192.168.100.10:85 loadfactor=6 <br \/>A load factor will be applied member of the cluster, in order to define and sharing load balancing between members of cluster.<br \/>In the following example 40% of the requests will be forwarded to the first and reaming 60% will be forward to second cluster. <\/p>\n<p>ProxyPass \/ balancer:\/\/domain.abc.net\/ lbmethod=byrequests stickysession=jsessionid<br \/>SESSION_ID is the name of the variable at the application level storing the session identifier.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Load Balancing -: Load balancer accept request from external client and forward them to one of the available Backend servers according to a scheduling algorithm. We can use dedicated hardware and any load balancing software for load balancing Mod_proxy_balancer- : Apache web server\u2019s module of mod_proxy_balancer the apache module developed to provide to load balancing [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/1266"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1266"}],"version-history":[{"count":2,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/1266\/revisions"}],"predecessor-version":[{"id":1269,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/1266\/revisions\/1269"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1266"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1266"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1266"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}