In a Tomcat production environment, you might have hundreds of web requests per second on a routine basis. With so much volume assaulting your Tomcat server, you'll probably discover that memory resources in one Tomcat JVM (Java Virtual Machine) can become overwhelmed. To help prevent this situation from becoming reality you can place two or more Tomcat servers in a cluster. A cluster is a group of servers that communicate with one another. Now you have multiple JVMs to handle the work load coming in from the network. Session data can be shared among the cluster members to achieve high availability, i.e., recovery of a web session should a server crash occur.
To learn how to cluster in Apache Tomcat, follow these steps:
CATALINA_BASE/confto your new directory.
c:/TomcatA/conf.server.xml. Locate the cluster entry:
<!-- <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/> -->
Connectorelement for HTTP:
<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />
<Connector port="8181" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />
<Server port="8005" shutdown="SHUTDOWN">
<Server port="8001" shutdown="SHUTDOWN">
CATALINA_BASEhave different values.
CATALINA_HOMEis the original installation directory that contains our web applications whereas
CATALINA_BASEcontains our customized configuration.