# AS7 modcluster subsystem Configuration

## ModCluster Subsystem in JBoss AS7

The mod_cluster integration is done via the modcluster subsystem. In AS7 only 1.1.x and later is supported.

## ModCluster Subsystem minimal configuration

The minimal configuration is having the modcluster `schemaLocation` in the `schemaLocation` list:

    urn:jboss:domain:modcluster:1.0 jboss-mod-cluster.xsd

and the `extension module` in the `extensions` list:

    <extension module="org.jboss.as.modcluster"/>

and `subsystem` declaration like:

    <subsystem xmlns="urn:jboss:domain:modcluster:1.0"/>

With that configuration modcluster will listen for advertise on `224.0.1.105:23364` use the `simple-load-provider` with a load factor of 1.

## ModCluster Subsystem configuration

### mod-cluster-config Attributes

The attributs correspond to the properties

Proxy Discovery Configuration

Attribute | Property | Default
proxy-list | proxyList | None
proxy-url | proxyURL | None
advertise | advertise | true
advertise-security-key | advertiseSecurityKey | None
excluded-contexts | excludedContexts | None
auto-enable-contexts | autoEnableContexts | true
stop-context-timeout | stopContextTimeout | 10 seconds (in seconds)
socket-timeout | nodeTimeout | 20 seconds (in milli seconds)

Proxy Configuration

Attribute | Property | Default
sticky-session | stickySession | true
sticky-session-remove | stickySessionRemove | false
sticky-session-force | stickySessionForce | true
node-timeout | workerTimeout | -1
max-attempts | maxAttempts | 1
flush-packets | flushPackets | false
flush-wait | flushWait | -1
ping | ping | 10
smax | smax | -1 it uses default value
ttl | ttl | -1 it uses default value
domain | loadBalancingGroup | None
load-balancing-group | loadBalancingGroup | None

SSL Configuration

SSL configuration part needs to be added here too

### simple-load-provider Attributes

The simple load provider always send the same load factor. That is the default one. Example:

    <subsystem xmlns="urn:jboss:domain:modcluster:1.0">
      <mod-cluster-config>
        <simple-load-provider factor="1"/>
      </mod-cluster-config>
    </subsystem>

Attribute | Property | Default
factor | LoadBalancerFactor | 1

### dynamic-load-provider Attributes

The dynamic load provide allows to have `load-metric` as well as `custom-load-metric` defined. For example:

    <subsystem xmlns="urn:jboss:domain:modcluster:1.0">
      <mod-cluster-config advertise-socket="mod_cluster">
        <dynamic-load-provider history="10" decay="2">
           <load-metric type="cpu" weight="2" capacity="1"/>
           <load-metric type="sessions" weight="1" capacity="512"/>
           <custom-load-metric class="mypackage.myclass" weight="1" capacity="512">
              <property name="myproperty" value="myvalue" />
              <property name="otherproperty" value="othervalue" />
           </custom-load-metric>
        </dynamic-load-provider>
      </mod-cluster-config>
    </subsystem>

Attribute | Property | Default
history | history | 512
decay | decayFactor | 512

### load-metric Configuration

The load-metric are the "classes" collecting information to allow computation of the load factor sent to httpd

Attribute | Property | Default
type | A Server-Side Load Metrics | Mandatory
weight | weight | 9
capacity | capacity | 512

#### Supported load metric types

type | Corresponding Server-Side Load Metric
cpu | AverageSystemLoadMetric
mem | SystemMemoryUsageLoadMetric
heap | HeapMemoryUsageLoadMetric
sessions | ActiveSessionsLoadMetric
requests | RequestCountLoadMetric
send-traffic | SendTrafficLoadMetric
receive-traffic | ReceiveTrafficLoadMetric
busyness | BusyConnectorsLoadMetric
connection-pool | ConnectionPoolUsageLoadMetric

### custom-load-metric Configuration

The custom-load-metric are for user defined "classes" collecting information. They are like the load-metric except `type` is replaced by `class`:

Attribute | Property | Default
class | Name of your class | Mandatory

### load-metric Configuration with the jboss admin console

The load-metric have 4 commands to add / remove metrics

#### add-metric

Allows to add a `load-metric` to the `dynamic-load-provider`

For example:

           ./:add-metric(type=cpu, weight=2, capacity=1)

#### remove-metric

Allows to remove a `load-metric` from the `dynamic-load-provider`

For example:

           ./:remove-metric(type=cpu)

#### add-custom-metric

Allows to add a `load-custom-metric` to the `dynamic-load-provider`

For example:

           ./:add-custom-metric(class=myclass, weight=2, capacity=1, property=[("pool" => "mypool"), ("var" => "myvariable")])

#### remove-custom-metric

Allows to remove a `load-custom-metric` from the `dynamic-load-provider`

For example:

           ./:remove-custom-metric(class=myclass)