Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

EXPERTALKS: Nov 2012 - Web Application Clustering

509 views

Published on

This presentation was part of EXPERTALKS: Nov 2012 conducted at Equal Experts India on 24th Nov 2012. Visit http://meetup.com/expertalks to know more...
-------------------------------------------------------------------------------------
Ever wondered how Facebook is able to support user requests growing at thousands per second without ever crashing ?

Any enterprise application that we use today; whether it’s a banking website or an eCommerce app; uses Clustering.

Clustering addresses some of the most crucial demands of today’s ever-growing user base; including scalability and 24/7 availability amongst others.

This presentation discusses the concept of web application clustering.

FOCUS AREAS:
* Why clustering
* Clustering Types
* Load Balancing Algorithms
* Fault Tolerance
It also has a guide workshop on how to build a Vertical Cluster using Tomcat.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

EXPERTALKS: Nov 2012 - Web Application Clustering

  1. 1. www.equalexperts.com Web Application Clustering Piyush Katariya pkatariya@equalexperts.com
  2. 2. www.equalexperts.com • NFR Now • userLoad = 50+ • Single jvm • 3 Ghz processor, single core • 2+ GB RAM • NFR Expected • userLoad = 500+ The scaling challenge
  3. 3. www.equalexperts.com • AKA Vertical clustering • Moore’s law • Taking advantage of processor power and memory • Multiple app instances on same machine  Do take care of  Cache  Static variables, singletons  User Sessions • Scaling your code • Cannot combat hardware failure Scaling UP
  4. 4. www.equalexperts.com Load Balancing • Algorithms  Round robin (Simple, Weighted, Dynamic)  Quickest  Least Connection  Hybrid • Software Vs Hardware Load Balancers
  5. 5. www.equalexperts.com Tomcat Cluster 1 Tomcat Cluster 2 N/W ApacheServer
  6. 6. www.equalexperts.com • NFR Now • userLoad = 500+ • two jvm’s • Multicore processor • 8+ GB RAM • NFR Expected • userLoad = 5000+ • Better response time The challenge continues..
  7. 7. www.equalexperts.com Scaling Out • AKA Horizontal Clustering • First step towards HA • Taking advantage of low cost commodity hardware • Multiple Nodes/Machines Again do take care of  Cache  Static variables, singletons  User Sessions • Can combat hardware failure
  8. 8. www.equalexperts.com N/W Apache Server Node 1 Node 2 Node 4Node 3
  9. 9. www.equalexperts.com The “Perfection” only exists in dictionary • Prefer “scaling out” over “scaling up” • Tune your thread pools and db connection pools • Mind your loggers • Cache’s == Steroids for web-app • High intra-cluster bandwidth • Seek for RIA app design • gzip your HTTP responses • Continuous monitoring is a must
  10. 10. www.equalexperts.com Workshop Time ! • Pre- requisites  Apache Tomcat 7  Apache 2.x  mod-jk module for Apache
  11. 11. www.equalexperts.com The Workshop Problem ? “Create your private vertical cluster on your local machine using two tomcat instances front ended with Apache HTTP server which will have load balancer employing Weighted Round Robin policy ” Tomcat Cluster 1 Tomcat Cluster 2 N/W ApacheServer
  12. 12. www.equalexperts.com Get started  Install Apache HTTP Server 2.x  Create a folder named “cluster”  Create two instances(physical) of tomcat by extracting given zip folder twice in “cluster” folder and name them “<YourName>1”, “<YourName>2”  conf/server.xml • Comment /Remove connector tag with “HTTP/1.1” protocol • Cluster I - cluster/<YourName>1  Server port – 8005 , AJP/1.3 Connector Port - 8009 • Cluster II – cluster/<YourName>2  Server port – 8105 , AJP/1.3 Connector Port - 8109 • Add attribute jvmRoute=“<Your name>1” in Engine tag element  Add <distributable /> tag in web.xml for .war under webapps folder
  13. 13. www.equalexperts.com Continue…  Copy mod_jk.so to apache/modules folder  apache/conf/httpd.conf  “LoadModule jk_module modules/mod_jk.so”  JkWorkersFile confworkers.properties  JkMount /examples/jsp/* bal1  JkMount /jkstatus/ stat1
  14. 14. www.equalexperts.com The final touch  apache/conf/workers.properties worker.<YourName>1.type=ajp13 worker.<YourName>1.host=localhost worker.<YourName>1.port=8009 worker.<YourName>1.lbfactor=10 worker.<YourName>2.type=ajp13 worker.<YourName>2.host=localhost worker.<YourName>2.port=8109 worker.<YourName>2.lbfactor=10 worker.bal1.type=lb worker.bal1.stickysession=1 worker.bal1.balanceworkers=<YourName>1,<YourName>2 worker.list=bal1,stat1 worker.stat1.type=status worker.stat1.css = /status.css
  15. 15. www.equalexperts.com Hope that this presentation helped you understand the concept of Clustering… Thank You !!! pkatariya@equalexperts.com

×