B2 2006 tomcat_clusters


Published on

  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

B2 2006 tomcat_clusters

  1. 1. Deploying Tomcat Clusters in an Advanced Blackboard TM Environment Speaker: Steve Feldman Director, Software Performance Engineering and Architecture [email_address]
  2. 2. Agenda and Introductions <ul><li>Goals, Objectives and Outcomes </li></ul><ul><li>Background Knowledge </li></ul><ul><li>Hands on Learning </li></ul><ul><li>Benchmark Statistics </li></ul><ul><li>Questions…Questions…Questions </li></ul><ul><li>Total Time: 50 Minutes </li></ul>
  3. 3. Note to Attendees <ul><li>Tomcat clustering is not a standard configuration of the Blackboard Academic Suite. </li></ul><ul><ul><li>Clusters have been set-up and tested by Blackboard Engineers, but have not been certified as a valid configuration. </li></ul></ul><ul><ul><li>The technology is proven and used throughout the world. </li></ul></ul><ul><li>The same can be said of server virtualization </li></ul><ul><ul><li>Many Blackboard clients use and deploy virtual servers. </li></ul></ul><ul><ul><li>The guidance provided in this presentation is to help clients take advantage of the power of clustering, but help clients understand that they must have knowledge on setting up and managing clusters. </li></ul></ul>
  4. 4. Presentation Goals <ul><li>The goals of this presentation are: </li></ul><ul><ul><li>Introduce the concepts and techniques for planning and deploying Tomcat Application Clusters. </li></ul></ul><ul><ul><li>Help administrators understand the value of Tomcat clusters for performance and availability. </li></ul></ul><ul><ul><li>Show administrators how to set-up their very own Tomcat cluster. </li></ul></ul>
  5. 5. Presentation Objectives <ul><li>Define what are clusters. </li></ul><ul><li>Define what are nodes. </li></ul><ul><li>Explain the differences between cluster nodes and load balanced nodes. </li></ul><ul><li>Review the configuration requirements for setting up a Tomcat cluster </li></ul><ul><li>Review the configuration requirements for setting up web server distribution to the cluster. </li></ul><ul><li>Explain issues that might come up with clusters and provide techniques for diagnosing and resolving the issues. </li></ul><ul><li>Convince every customer to go home and start setting up clusters in their development environments. </li></ul>
  6. 6. Presentation Outcomes <ul><li>At the end of the session, administrators will be able to do the following: </li></ul><ul><ul><li>Define the difference between a load-balanced configuration and a tomcat cluster. </li></ul></ul><ul><ul><li>Set-up a Tomcat cluster or a load-balanced nodes </li></ul></ul><ul><ul><li>Configure clustering for quality of service. </li></ul></ul>
  7. 7. What is a Tomcat Cluster? <ul><li>A cluster is a collection of two or more Tomcat instances running in parallel and working together to provide robust scalability, performance and reliability. </li></ul><ul><li>Clusters can be multi-homed and reside physically on the same hardware. </li></ul><ul><li>Clusters can be distributed and reside on distributed hardware. </li></ul><ul><li>Clusters are indistinguishable to end users presenting a seamless experience </li></ul>
  8. 8. Why Cluster? <ul><li>Clusters distribute workload </li></ul><ul><ul><li>Minimize unnecessary queuing </li></ul></ul><ul><ul><li>When configured for a small JVM it can reduce the amount of JVM pause times. </li></ul></ul><ul><li>Clusters can help better utilize the hardware you run on </li></ul><ul><ul><li>Clusters enable a scale-up model to go along with load-balanced installations (scale-out model) </li></ul></ul><ul><li>Clusters can provide additional availability </li></ul><ul><ul><li>Not recommend using Tomcat Clusters as the primary failover solution </li></ul></ul><ul><li>Clusters are cool…and because they are cool you should consider them! </li></ul><ul><ul><li>Just one person’s opinion! </li></ul></ul>
  9. 9. Visual Look at a Tomcat Cluster Traffic is directed by the Web Server like a software load balancer Nodes know little about there partners Recommend 1 node Per Core Web Server Instance Node 1 Node 2 Node N
  10. 10. What is an Application Node? <ul><li>An application node is a single instance of Tomcat. </li></ul><ul><li>Nodes can be part of a cluster. </li></ul><ul><ul><li>Means they are aware of each other </li></ul></ul><ul><ul><li>Part of a group </li></ul></ul><ul><ul><li>Failover </li></ul></ul><ul><li>Nodes can be part of a load-balanced configuration. </li></ul><ul><ul><li>A single physical server can have multiple logical nodes not in a cluster, but technically load-balanced by JK </li></ul></ul>
  11. 11. Clustered Nodes versus Load-Balanced Nodes <ul><li>A load-balanced node is the following: </li></ul><ul><ul><li>Physically distinct from a hardware perspective. </li></ul></ul><ul><ul><li>Has its own web server managing traffic. </li></ul></ul><ul><ul><li>Has a dedicated configuration and resource definition. </li></ul></ul><ul><ul><li>Has no understanding of failover definition. </li></ul></ul><ul><ul><ul><li>Relies on third-party resources like load-balancers. </li></ul></ul></ul><ul><li>A clustered node is the following: </li></ul><ul><ul><li>Can be physically or logically distinct from a hardware perspective. </li></ul></ul><ul><ul><li>Shares a web server with potential N+ nodes. </li></ul></ul><ul><ul><li>Shares configuration and resource definition with other nodes. </li></ul></ul><ul><ul><li>Has failover definition as part of the application configuration. </li></ul></ul>
  12. 12. Load-Balanced and Clustered Nodes Hardware or Software Load Balancer Cluster Load-Balanced Nodes unaware of each other. Nodes aware of each other. Web Server Instance Node 1 Node 2 Node N Web Server Instance Node 1 Node 2 Node N
  13. 13. Session Replication <ul><li>To enable session replication in Tomcat, three different paths can be followed to achieve the exact same thing: </li></ul><ul><ul><li>Using session persistence, and saving the session to a shared file system (PersistenceManager) </li></ul></ul><ul><ul><li>Using session persistence, and saving the session to a shared database (JDBCManager) </li></ul></ul><ul><ul><li>Using in-memory-replication, using the SimpleTcpCluster that ships with Tomcat 5 (server/lib/catalina-cluster.jar) </li></ul></ul><ul><li>Recommend Using SimpleTcpCluster </li></ul>
  14. 14. Guidelines for Setting Up a Cluster <ul><li>The cluster configuration is completely described in the server.xml file under $BLACKBOARD_HOME/apps/tomcat/conf </li></ul><ul><li>You can set-up a true cluster or settle for load-balanced JVMs. </li></ul><ul><ul><li>Either way you win. </li></ul></ul><ul><li>Create multiple clusters in a multi-homed configuration initially </li></ul><ul><ul><li>Each multihomed cluster is capable of failing over to each other rather then across physical systems </li></ul></ul><ul><ul><ul><li>Eliminates the need for cross-over connections between servers. </li></ul></ul></ul>
  15. 15. Ingredients of a Tomcat Cluster <ul><li>Class Name= Must have class package </li></ul><ul><ul><li>org.apache.catalina.cluster.tcp.SimpleTcpCluster </li></ul></ul><ul><li>Cluster Identification and Listen Port </li></ul><ul><li>Multicast Communication Address </li></ul><ul><li>JK Connector Port </li></ul><ul><li>JK Configuration Definition for Load Distribution </li></ul><ul><li>A Few Directory Copies </li></ul><ul><ul><li>$BLACKBOARD_HOME/apps/tomcat/bin </li></ul></ul><ul><ul><li>$BLACKBOARD_HOME/apps/tomcat/conf </li></ul></ul><ul><ul><li>$BLACKBOARD_HOME/apps/tomcat/work </li></ul></ul><ul><ul><li>$BLACKBOARD_HOME/apps/tomcat/log </li></ul></ul>
  16. 16. Example Cluster Code <ul><li><Cluster className=&quot;org.apache.catalina.cluster.tcp.SimpleTcpCluster&quot; </li></ul><ul><li>managerClassName=&quot;org.apache.catalina.cluster.session.DeltaManager&quot; </li></ul><ul><li>expireSessionsOnShutdown=&quot;false&quot; </li></ul><ul><li>useDirtyFlag=&quot;true&quot; </li></ul><ul><li>service.mcastBindAddress=&quot;; </li></ul><ul><li>notifyListenersOnReplication=&quot;true&quot;> </li></ul><ul><li><Membership className=&quot;org.apache.catalina.cluster.mcast.McastService&quot; </li></ul><ul><li>mcastAddr=&quot;; </li></ul><ul><li>mcastBindAddress=&quot;; </li></ul><ul><li>mcastPort=&quot;45564&quot; </li></ul><ul><li>mcastFrequency=&quot;500&quot; </li></ul><ul><li>mcastDropTime=&quot;3000&quot;/> </li></ul><ul><li><Receiver className=&quot;org.apache.catalina.cluster.tcp.ReplicationListener&quot; </li></ul><ul><li>tcpListenAddress=&quot;auto&quot; </li></ul><ul><li>tcpListenPort=&quot;4000&quot; </li></ul><ul><li>tcpSelectorTimeout=&quot;100&quot; </li></ul><ul><li>tcpThreadCount=&quot;6&quot;/> </li></ul><ul><li><Sender className=&quot;org.apache.catalina.cluster.tcp.ReplicationTransmitter&quot; </li></ul><ul><li>replicationMode=&quot;pooled&quot; </li></ul><ul><li>ackTimeout=&quot;15000&quot;/> </li></ul><ul><li><Valve className=&quot;org.apache.catalina.cluster.tcp.ReplicationValve&quot; </li></ul><ul><li>filter=&quot;.*.gif;.*.js;.*.jpg;.*.png;.*.htm;.*.html;.*.css;.*.txt;&quot;/> </li></ul><ul><li></Cluster> </li></ul>
  17. 17. Easiest Way to Skin a Tomcat Cluster <ul><li>Copy $BLACKBOARD_HOME/apps/tomcat to $BLACKBOARD_HOME/apps/tomcat_node2 </li></ul><ul><li>Change all references of $BLACKBOARD_HOME/apps/tomcat to now use $BLACKBOARD_HOME/apps/tomcat_node2 </li></ul><ul><li>Modify server.xml in new directory to reflect unique server port for AJP13 connector and shutdown. </li></ul><ul><ul><li>Cluster ports need to be unique in order to create a socket unless IP Addresses are defined and uniquely defined. </li></ul></ul><ul><li>Modify CATALINA_PID in blackboard-tomcat.sh or .bat file to point to the right node and log file directory. </li></ul>
  18. 18. Setting Up JK Load Distribution <ul><li>Apache and IIS will route traffic based on JK definition. </li></ul><ul><li>Best to set-up a new workers.properties </li></ul><ul><ul><li>Located under $BLACKBOARD_HOME/apps/tomcat/conf/jk/workers.properties </li></ul></ul><ul><ul><li>Change httpd.conf to point to new workers.properties (Unix) </li></ul></ul><ul><ul><li>Managed from within IIS </li></ul></ul><ul><ul><ul><li>Blackboard Web Site  Jakarta </li></ul></ul></ul><ul><ul><ul><li>Simply copy workers.properties and rename old file </li></ul></ul></ul>
  19. 19. Example Workers.Properties # One virtual worker worker.list=loadbalancer # Configure the virtual worker as a load balancer worker.loadbalancer.type=lb worker.loadbalancer.balanced_workers=tomcat1,tomcat2 worker.loadbalancer.method=Request # Attempt to worker.loadbalancer.sticky_session=1 # Actual workers, not available directly worker.tomcat1.port=8009 worker.tomcat1.host=localhost worker.tomcat1.type=ajp13 worker.tomcat1.lbfactor=50 worker.tomcat2.port=8209 worker.tomcat2.host=localhost worker.tomcat2.type=ajp13 worker.tomcat2.lbfactor=50
  20. 20. Web Server Configuration <ul><li>Apache manages Tomcat worker information in httpd.conf </li></ul><ul><ul><li>Define workers.properties </li></ul></ul><ul><ul><li>Establish JK Mount (Bottom of File) </li></ul></ul><ul><ul><li>Probably called new worker list “loadbalancer” </li></ul></ul><ul><li>Windows manages Tomcat worker information un uriworkermap.properties </li></ul><ul><ul><li>Must note new worker name for Cluster (aka: worker list) </li></ul></ul>
  21. 21. Things to Consider <ul><li>Apache has a limit of 1024 maxclients </li></ul><ul><ul><li>More then enough for a 2, 3 or 4 node cluster </li></ul></ul><ul><ul><li>Must always keep maxclients = (Tomcat Max Server Processes) * (# of Tomcat Nodes per Cluster) </li></ul></ul><ul><ul><li>Recompiling Apache is one way to solve the problem </li></ul></ul>
  22. 22. Advanced Feature: Setting Up QOS Models Change JKMount **JK Mount says /webapps/* but can be changed to any single webapp if you choose.
  23. 23. Example Benchmark Statistics
  24. 24. Example Benchmark Statistics 20343 Sessions/HR 51 UPL/Second 1,145,440 Bytes/Second 145,287 Transactions 14913 Sessions/HR 33 UPL/Second 695,319 Bytes/Second 94,181 Transactions 8212 Sessions/HR 22 UPL/Second 488,168 Bytes/Second 54,049 Transactions R7.1 High-Level R3 (Workload of 360 Possible Concurrent Simulations Learning System/Community System) R2 (Workload of 240 Possible Concurrent Simulations Learning System/Community System) R1 (Workload of 120 Possible Concurrent Simulations Learning System/Community System) Workload 24034 Sessions/HR 65 UPL/Second 1,329,037 Bytes/Second 157,629 Transactions (6-Nodes) 18455 Sessions/HR 50 UPL/Second 1,102,667 Bytes/Second 130,811 Transactions 17288 Sessions/HR 42 UPL/Second 901,103 Bytes/Second 118,754 Transactions 16063 Sessions/HR 45 UPL/Second 968,128 Bytes/Second 106,659 Transactions (4-Nodes) 13341 Sessions/HR 34 UPL/Second 729,616 Bytes/Second 90,353 Transactions 12459 Sessions/HR 31 UPL/Second 640,958 Bytes/Second 87,433 Transactions 10455 Sessions/HR 25 UPL/Second 544,673 Bytes/Second 59,239 Transactions (2 Nodes) 8080 Sessions/HR 22 UPL/Second 480,824 Bytes/Second 53,780 Transactions 7238 Sessions/Hr 19 UPL/Second 311,656 Bytes/Second 51,888 Transactions R7.1 HL Clustered R7.1 Mid-Level R7.1 Entry-Level
  25. 25. Example Benchmark Statistics 20207 Sessions/Hr 47 UPL/Second 1,014,189 Bytes/Sec 130,907 Transactions (3 Nodes) 14668 Sessions/Hr 32 UPL/Second 676,802 Bytes/Second 96,742 Transactions (2 Nodes) 12974 Sessions/Hr 35 UPL/Second 735,846 Bytes/Second 84,970 Transactions R7.1 High-Level R9 (Workload of 600 Possible Concurrent Simulations Full Academic Suite) R8 (Workload of 400 Possible Concurrent Simulations Full Academic Suite) R7 (Workload of 200 Possible Concurrent Simulations Full Academic Suite) Workload 27997 Sessions/Hr 71 UPL/Second 1,527,433 Bytes/Sec 181,121 Transactions (6 Nodes) 23056 Sessions/Hr 63 UPL/Second 1,196,553 Bytes/Sec 149,709 Transactions 12652 Sessions/Hr 25 UPL/Second 451,975 Bytes/Second 64,289 Transactions 24034 Sessions/Hr 65 UPL/Second 1,392,037 Bytes/Sec 157,629 Transactions (4 Nodes) 18857 Sessions/Hr 53 UPL/Second 1,157,486 Bytes/Second 118,353 Transactions 11908 Sessions/Hr 34 UPL/Second 668,189 Bytes/Second 77,553 Transactions 13804 Sessions/HR 36 UPL/Second 763,955 Bytes/Second 90,941 Transactions (4 Nodes) 12548 Sessions/Hr 33 UPL/Second 728,082 Bytes/Second 84,004 Transactions 5721 Sessions/Hr 13 UPL/Second 275,672 Bytes/Second 37,313 Transactions R7.1 HL Clustered R7.1 Mid-Level R7.1 Entry-Level
  26. 26. References <ul><li>Tomcat: The Definitive Guide by Jason Brittain </li></ul><ul><li>http://www.onjava.com/pub/a/onjava/2004/01/28/tomcat5.html?CMP=ILC-VP9761447835&ATT=804 </li></ul><ul><li>http://tomcat.apache.org/tomcat-5.0-doc/balancer-howto.html </li></ul><ul><li>http://www.onjava.com/pub/a/onjava/2002/07/17/tomcluster.html?page=1 </li></ul><ul><li>http://www.onjava.com/pub/a/onjava/2004/03/31/clustering.html </li></ul><ul><li>http://www.onjava.com/pub/a/onjava/2004/04/14/clustering.html </li></ul><ul><li>http:// arstechnica.com/articles/paedia/cpu/hyperthreading.ars </li></ul><ul><li>http://lists.samba.org/archive/samba-technical/2004-December/038305.html </li></ul><ul><li>http://tomcat.apache.org/tomcat-5.0-doc/cluster-howto.html </li></ul>
  27. 27. Past Presentations of Note <ul><li>B2 2006: How We Size the Academic Suite, Benchmarking at Blackboard </li></ul><ul><li>B2 2006: Deploying Tomcat Clusters in an Advanced Blackboard Environment </li></ul><ul><li>2006 BbWorld Presentation: Practical Guide to Performance Tuning and Scaling (2 Hour Workshop) </li></ul><ul><li>B2 2005: Introduction to Load Testing, A Blackboard Primer </li></ul><ul><li>B2 2005: Performance Testing Building Blocks </li></ul><ul><li>Users Conference 2005: Managing Your Blackboard Deployment for Growth and Performance </li></ul><ul><li>Users Conference 2005: Applied Software Performance Engineering </li></ul><ul><li>B2 2004: Introduction to Software Performance Engineering </li></ul><ul><li>B2 2004: Profiling Building Blocks for Performance Analysis </li></ul>
  28. 28. Questions?