Configuring the Tomcat Connector for a JBoss AS cluster
For this configuration, first ensure that the node names for each of the JBoss AS instances in your cluster are defined correctly. Then edit the .properties files in the mod_jk/conf directory to define the Tomcat instance (also known as a Tomcat worker) for each JBoss AS instance in the cluster.
To configure the Tomcat Connector for a multiple-node JBoss AS deployment:
-
Verify that the server.xml file for each of
the JBoss servers in your cluster specifies a unique node name.
The server.xml file for a given node is located in the JBOSS_HOME\server\nodename\deploy\jbossweb.sar directory. The node name is specified by the jvmRoute attribute in the Engine tag. For example:
<Engine defaultHost="localhost" jvmRoute="node1" name="jboss.web">
Typically, the node names are configured when you set up the server. This happens automatically if, when you are deploying, you specify the Configure Automatically or Configure Server options in NexJ Studio.
-
Edit the uriworkermap.properties file to
define the nodes for your deployment.
For example:
/nexj/*=loadbalancer
-
Edit the workers.properties file to
configure the nodes and their properties.
For example:
# The list of nodes # worker.list=loadbalancer,status # Set load-balancing behaviour # worker.loadbalancer.type=lb worker.loadbalancer.balance_workers=node1,node2 worker.loadbalancer.sticky_session=1 # Set template properties # worker.template.type=ajp13 worker.template.lbfactor=1 worker.template.socket_timeout=0 worker.template.socket_keepalive=true worker.template.socket_connect_timeout=5000 worker.template.retries=2 worker.template.recovery_options=7 worker.template.connection_pool_size=256 worker.template.connection_pool_timeout=300 # Set properties for node 1 # worker.node1.reference=template worker.node1.host=localhost worker.node1.port=8009 worker.node1.route=node1 # Set properties for node 2 # worker.node2.reference=template worker.node2.host=localhost worker.node2.port=8109 worker.node2.route=node2 # Set properties for status worker # worker.status.type=status worker.status.read_only=true
The values for the
worker.nodename.host
andworker.nodename.port
properties must correspond to your JBoss AS configuration. If you add or remove any workers, change theworker.loadbalancer.balance_workers
property.Node names such as "node1" or "node2" are used by default when the servers are configured through NexJ Studio. If you specify different names in the server.xml file, use the
worker.nodename.route
property to map the node names and worker names correctly.By default, the value of the
worker.nodename.route
property is set to the worker name. If that is the case, you do not have to include this property. In a typical production environment, only one cluster is configured for each mod_jk module, so this property is not required.In the configuration, the following suggested values are used:- worker.nodename.type
- The value is always ajp13. Other worker types are unsupported.
- worker.nodename.retries
- Suggested value is 2. The maximum number of times that the node will try to establish a connection to the server after a communication error.
- worker.nodename.recovery_options
Suggested value is 7. This value is a bitmask. It indicates that, when an error occurs that prevents a complete AJP request from being sent, the server will not retry the request and will close the AJP connection. This prevents automatic request and response duplication.
- worker.nodename.connection_pool_size
Suggested value is 256. The lower of the maximum Tomcat/JBoss AJP listener thread count and the maximum web server thread count.
To determine the maximum Tomcat/JBoss AJP listener thread count: In the deploy/jbossweb.sar/server.xml file, refer to the maxThreads attribute for the Connector component for AJP.
To determine the maximum web server thread count: Refer to Apache or IIS configuration to find the maximum number of web requests that the server can process concurrently.
- worker.nodename.connection_pool_timeout
- Suggested value is 300. The number of seconds after which the idle connections in the pool are closed.
- worker.nodename.socket_keepalive
- Suggested value is true. Sends TCP keepalive messages to maintain the connection.
- worker.nodename.socket_timeout
- Suggested value is 0. Indicates that IIS should wait for the server response indefinitely.
- worker.nodename.socket_connect_timeout
- Suggested value is 5000. The number of milliseconds after which the attempted connection establishment times out.
Note: Refer to the Apache Tomcat documentation for the list and description of all configurable worker properties: http://tomcat.apache.org/connectors-doc/reference/workers.html. - If you are configuring an existing web server that is currently running, restart the web server after modifying the configuration files.