uCosminexus Application Server, Web Container Functionality Guide

[Contents][Glossary][Index][Back][Next]

4.4.4 Execution environment settings (When the Smart Composer functionality is used)

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.

Organization of this subsection
(1) Setup procedure
(2) Settings in workers.properties and mod_jk.conf
(3) Example settings

(1) Setup procedure

To set the distribution of requests by the round-robin format, specify the settings using the following procedure:

  1. Define the load balancer and worker in workers.properties.
    Definitions for the load balancer
    Specify the list of worker names, worker types (specify lb), and list of workers for load balancing.
    Definitions for each worker
    Specify the worker types (specify ajp13), port number, host name, and the load balancing value.
    The default value is defined in workers.properties that is provided by default. To use the default definition defined as a comment, delete the hash mark (#) at the beginning of the applicable line.
    For details on workers.properties (worker definition file), see 9.5 workers.properties (worker definition file) in the uCosminexus Application Server Definition Reference Guide.
  2. Define the mapping between the URL pattern and worker in mod_jk.conf.
    If mapping is already defined, delete or replace the definition.
    For details on mod_jk.conf (redirector operation definition file for HTTP Server), see 9.3 mod_jk.conf (redirector operation definition file for HTTP Server) in the uCosminexus Application Server Definition Reference Guide.
  3. Set up the Web server environment and restart the Web server.
    For details on the Web server settings, see Appendix B Precautions related to Cosminexus HTTP Server Settings.

Notes
  • When you use load balancing with the redirector and if a failure is detected in a worker, the worker is excluded from the choices for redirect destination workers for 60 seconds from the detection of failure. Therefore, even if the failure is recovered, the worker might not be used for a maximum of 60 seconds.
  • In UNIX, when the server processes of Cosminexus HTTP Server are generated or destroyed according to the load, multiple server processes are allocated by the worker defined first in workers.properties. Also, even if the number of server processes is fixed, the server process to which the request is allocated is uncertain, and therefore, if you specify the same load balancing value, round-robin might not occur. Unless destroyed, the server processes are allowed to increase according to the load, and therefore you must specify a directive in such a way so that the server processes are not generated or destroyed in a short time.
    Specify the httpsd.conf directive of Cosminexus HTTP Server in such a way so that the following conditions are fulfilled:
    Conditions Meaning
    MaxSpareServers [Figure] 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.
Example specification of directive
 
StartServers 256
MaxClients 256
MaxSpareServers 256
MaxRequestsPerChild 10000
 

(2) Settings in workers.properties and mod_jk.conf

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.

Note:
In worker-name, define the worker name specified in the worker.list key or the worker.worker-name.balanced_workers key.

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

Legend:
Y: Can be specified
--: Cannot be specified
O: Can be optionally specified

(3) Example settings

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

[Figure]

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.

Example of workers.properties (In Windows)
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
 

Example of workers.properties (In UNIX)
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.

Example of mod_jk.conf
JkMount /examples/* loadbalancer1