uCosminexus Application Server, Web Container Functionality Guide
By defining the list of workers that act as the distribution destinations in the load balancer, requests are distributed to the workers in the round-robin format.
If you set a load balancing value in each worker that acts as the distribution destination and define the request distribution ratio, you can adjust the proportion of load on each host. Since the redirector distributes requests with the round-robin format for each HTTP request at this ratio, higher the ratio for a worker the greater will be the proportion of forwarded requests. However, the HTTP requests belonging to the same session are distributed to the same worker as the last time.
To set the distribution of requests by the round-robin format, specify the settings using the following procedure:
Conditions | Meaning |
---|---|
MaxSpareServers MaxClients | The server processes increase up to MaxClients and stay resident even after the processing ends. |
MaxRequestsPerChild 10000 | The HTTP request is processed 10,000 times and then the server process is terminated to refresh the operations (10,000 is the recommended value). Specify an adequately large value for the number of J2EE servers that act as the distribution destinations. |
StartServers = MaxClients | You specify this condition to start all the server processes first. |
StartServers 256 MaxClients 256 MaxSpareServers 256 MaxRequestsPerChild 10000 |
Define the settings for distributing requests by the round-robin format in workers.properties and mod_jk.conf. The following table lists the keys defined in workers.properties and mod_jk.conf:
Table 4-7 Keys defined in workers.properties and mod_jk.conf (When distributing requests by the round-robin format)
Types of files | Key name | Description |
---|---|---|
workers.properties | worker.list | Specifies a list of one or multiple worker names. |
worker.worker-name.host | Specifies the worker host name or IP address. | |
worker.worker-name.port | Specifies the worker port number. | |
worker.worker-name.type | Specifies the worker type. Specify lb in the load balancer and ajp13 in the worker for load balancing. | |
worker.worker-name.balanced_workers | Specifies the list of workers for load balancing. | |
worker.worker-name.lbfactor | Specifies the load balancing value. | |
worker.worker-name.cachesize | Specifies the number of worker connections that are reused in the redirector. This key can only be specified in Windows. |
|
worker.worker-name.receive_timeout | Specifies the communication timeout value. | |
worker.worker-name.delegate_error_code | Specifies the error status code used when the creation of the error page is entrusted to the Web server. | |
mod_jk.conf | JkMount | Specifies some combination of workers specified in the URL pattern and worker.list. |
The following table lists the parameters that you can specify for each worker type:
Table 4-8 Keys that can be specified for each worker type
Key name | Worker type (value specified in worker.worker-name.type) | |
---|---|---|
Load balancer (Specify lb) |
Worker (Specify ajp13) |
|
worker.worker-name.host | -- | Y |
worker.worker-name.port | -- | Y |
worker.worker-name.type | Y | Y |
worker.worker-name.balanced_workers | Y | -- |
worker.worker-name.lbfactor | -- | O |
worker.worker-name.cachesize | -- | O |
worker.worker-name.receive_timeout | -- | O |
worker.worker-name.delegate_error_code | -- | O |
The following figure shows the distribution of requests by the round-robin format.
Figure 4-8 Example of distribution of requests by the round-robin format
In this example, the requests under /examples are equally distributed on host A and on host B. The worker name in host A is worker1 and the worker name in host B is worker2.
An example of the workers.properties file is shown below. The load balancer and worker are defined here. Since the requests are distributed at an equal rate, 1 is specified as the load balancing value for both worker1 and worker2.
worker.list=loadbalancer1 worker.loadbalancer1.balanced_workers=worker1, worker2 worker.loadbalancer1.type=lb worker.worker1.port=8007 worker.worker1.host=hostA worker.worker1.type=ajp13 worker.worker1.cachesize=64 worker.worker1.lbfactor=1 worker.worker2.port=8007 worker.worker2.host=hostB worker.worker2.type=ajp13 worker.worker2.cachesize=64 worker.worker2.lbfactor=1
worker.list=loadbalancer1 worker.loadbalancer1.balanced_workers=worker1, worker2 worker.loadbalancer1.type=lb worker.worker1.port=8007 worker.worker1.host=hostA worker.worker1.type=ajp13 worker.worker1.lbfactor=1 worker.worker2.port=8007 worker.worker2.host=hostB worker.worker2.type=ajp13 worker.worker2.lbfactor=1
An example of the mod_jk.conf file is shown below. The load balancer name loadbalancer1 is specified here.
JkMount /examples/* loadbalancer1
All Rights Reserved. Copyright (C) 2013, Hitachi, Ltd.