A worker represents a running instance of Tomcat, a worker serves the requests for all dynamic web components.
Each worker is identified by a unique hostname or a unique IP address and port number.
Reasons to implement multiple workers :
- When you want different Web application contexts to be served by different Tomcat workers.
- When you want different virtual hosts to be served by different Tomcat workers.
- When you want to service more requests than the capacity of a single physical server.
A file called workers.properties is created to detail information like, where the Tomcat servers are.
Properties in workers.properties
Worker List properties
worker.list - Describe the workers that are available to Apache via a list
Other Worker Properties
worker.test1.type - Describes the type of worker
worker.test1.host - The host where the worker Tomcat instance resides
worker.test1.port - The port the AJP 1.3 Connector Tomcat instance is listening on (default 8009)
worker.test1.connection_pool_size - The number of connections used for this worker to be kept in a connection pool
worker.test1.connection_pool_minsize - The minimum number of connections kept in a connection pool
worker.test1.connection_pool_timeout - The number of seconds that connections to this worker should be left in the connection before expiry
worker.test1.mount - The contexts paths that are serviced by the worker, you can also use the JkMount directive in the http.conf file
worker.test1.retries - controls the number of times mod_jk will retry when a worker returns a error
worker.test1.socket_timeout - controls how long a worker will wait for a response on a socket before indicating an error
worker.test1.socket_keepalive - indicates if the connection to the worker should be subject to keep alive
worker.test1.lbfactor - An integer indicating the local-balance factor used by the load balancer to distribute work between multiple instances of Tomcat
Worker Load balancing properties
worker.bal1.balance_workers - A list of workers to load balance between
worker.bal1.lock - The type of locking used O (Optimistic) or P (Pessimistic)
worker.bal1.method - can be set to R (Requests), T (Traffic), B (Busy-ness)
R = The worker to use is based on the number of requests forwarded
T = The worker to use is based on the traffic that had been sent to the workers
B = The worker to use is based on the load dividing the number of concurrent requests by the load factor
worker.bal1.secret - Sets a default secret password for all workers
worker.bal1.sticky_session - Tells the mod_jk to respect the sessionID in the request and ensures that the same session is always serviced by the same worker instance.
worker.bal1.sticky_session_force - This is used for failover
Worker Types
ajp13 : This type of worker represents a running Tomcat instance
lb : used for load balancing
status : display useful information about how the load among the various Tomcat workers is distributed
jni : used in process, this worker handles the forwarding of requests to in-process Tomcat workers using JNDI
ajp12 : worker that support the AJP 1.2 protocol
Example
worker.list = worker1
worker.worker1.type = ajp13
worker.worker1.host = 192.168.0.1
worker.worker1.port = 9009
worker.worker1.connection_pool_size = 5
worker.worker1.connection_pool_timeout = 300
Example (for Load balancing)
worker.list = loadbal1,stat1
worker.tomcatA.type = ajp13
worker.tomcatA.host =192.168.0.1
worker.tomcatA.port = 8009
worker.tomcatA.lbfactor = 10
worker.tomcatB.type = ajp13
worker.tomcatB.host =192.168.0.2
worker.tomcatB.port = 8009
worker.tomcatB.lbfactor = 10
worker.tomcatC.type = ajp13
worker.tomcatC.host =192.168.0.3
worker.tomcatC.port = 8009
worker.tomcatC.lbfactor = 10
worker.loadbal1.type = lb
worker.loadbal1.sticky_seesion = 1
worker.loadbal1.balance_workers = tomcatA, tomcatB, tomcatC
worker.stat1.type= status
No comments:
Post a Comment
Note: only a member of this blog may post a comment.