Configure multiple dispatchers

If you need to configure multiple dispatchers, you must configure different ports, and directories for each dispatcher to ensure that dispatcher information does not get mixed up.

Multiple dispatchers are typically not needed; in fact they are rarely used. You would need to start multiple dispatchers if you needed to have different environments using the same version of the Genero Application Server on the same host. For example, you may wish to co-locate your production, training, and development environments.

To start multiple dispatchers on a single host, you create a copy of the application server configuration file (default as.xcf) for each dispatcher you will start.

Each dispatcher will have its own uniquely-named configuration file, and each configuration file must have different values for the elements shown in Table 1:
Table 1. Elements defined for each dispatcher
Element Values to be set
TCP_BASE_PORT The base port.
TCP_PORT_OFFSET The offset that is added to the base port as the listening port. The combination of base port+offset must be unique to each dispatcher.
TCP_ADMIN_PORT The admin port for GAS administration tasks must be unique to each dispatcher.
Application data directory Path to the application data directory for data files. The recommended way is to change the value of the res.appdata.path resource to a directory value unique for each dispatcher. An alternative approach is described in Shared application data directory.
Tip: You can share the same configuration file provided you run the dispatcher with the -E option to override the resources shown in Table 2 for each instance with different values:
Table 2. Override resources
Resource Example
res.ic.base.port httpdispatch -E res.ic.base.port=dispatcher1-base-port
res.ic.port.offset httpdispatch -E res.ic.port.offset=myOffset
res.ic.admin.port httpdispatch -E res.ic.admin.port=dispatcher1-admin-port
res.appdata.path httpdispatch -E res.appdata.path=/work/tmp/gas/appdata1

Shared application data directory

If you want to use the same application data directory, specified by the resource res.appdata.path, for each dispatcher, it is important to ensure that directories located under the directory remain independent.

For more information on why you need to be cautious about this, see Why do my applications fail using multiple dispatchers? and Error taking session ownership.

The values for the following directories need to be unique for each dispatcher. You can change these directly in their configuration files:

These examples are extracted from the default application server configuration file:
-- The res.appdata.path resource specifies the directory for application data
-- for the dispatcher

<RESOURCE Id="res.appdata.path"
 Source="INTERNAL">C:\ProgramData\FourJs\gas\3.20.08-130789</RESOURCE>

-- The res.log.output.path resource specifies the log directory
-- as defined by the LOG element

<RESOURCE Id="res.log.output.path"
 Source="INTERNAL">$(res.appdata.path)/log</RESOURCE>
<LOG>
  <OUTPUT Type="$(res.log.output.type)">$(res.log.output.path)</OUTPUT>
  ...
</LOG>

-- The res.path.tmp resource specifies the temporary directory
-- as defined by the TEMPORARY_DIRECTORY element

<RESOURCE Id="res.path.tmp"
 Source="INTERNAL">$(res.appdata.path)/tmp</RESOURCE>

<TEMPORARY_DIRECTORY>$(res.path.tmp)</TEMPORARY_DIRECTORY>

-- SESSION_DIRECTORY element specifies the session directory

<SESSION_DIRECTORY>$(res.appdata.path)/session</SESSION_DIRECTORY>