uCosminexus Application Server, Web Container Functionality Guide

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

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

By defining the list of workers that act as the distribution destinations in the load balancer, the requests are distributed to the workers with the round-robin format.

If you specify 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 of 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, use the following procedure:

  1. Define the load balancer and worker in workers.properties.
    Definitions of 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 as standard. 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. When using Cosminexus HTTP Server, define the mapping between the URL pattern and worker in mod_jk.conf. When using Microsoft IIS, define the mapping between the URL pattern and worker in uriworkermap.properties.
    If a mapping is already defined, delete the definition or replace the mapping.
    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.
    For details on uriworkermap.properties (mapping definition file for Microsoft IIS), see 9.4 uriworkermap.properties (mapping definition file for Microsoft IIS) 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 or Appendix C Microsoft IIS Settings.

Notes
  • When you perform load balancing in redirector and if a failure is detected in a worker, that worker is excluded from the choices of the redirect destination workers for the period of 60 seconds after the failure is detected. Therefore, even if the failure is recovered, the worker might not be used for a maximum period of 60 seconds.
  • When you use Microsoft IIS and specify multiple worker processes on which the redirector is running, and if two or more workers are set, many requests are allocated to the worker defined initially in workers.properties that is the initial redirect destination.
    Also, allocation of a request to a work process is dependent on the Microsoft IIS control and therefore, even if the same load balancing value is specified, there are cases when a round-robin is not performed.
    In such cases, by setting the number of application pools to one, a round robin can be performed even for the first redirect allocation destination.
  • In UNIX, when the server processes of Cosminexus HTTP Server are generated or destroyed according to the load, more requests 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, the round-robin might not occur. Unless the server process is destroyed, the server process is allowed to increase according to the load, so 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

The settings in workers.properties and mod_jk.conf are the same settings that are specified when Smart Composer is used. For details, see 4.4.4(2) Settings in workers.properties and mod_jk.conf.

(3) Example settings

The following figure shows the distribution of requests by the round-robin format.

Figure 4-9 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 will be 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
 

Examples of the mod_jk.conf and uriworkermap.properties files are shown below. The load balancer name loadbalancer1 will be specified here.

Example of mod_jk.conf (in Cosminexus HTTP Server)
JkMount /examples/* loadbalancer1
 

Example of uriworkermap.properties (In Microsoft IIS)
/examples/*=loadbalancer1