Cluster

From CauchoWiki

Jump to: navigation, search

Cluster configuration documentation is at http://www.caucho.com/resin-3.0/config/balance.xtp.

Contents

[edit] <cluster> directive

directivedescriptiondefault
idunique identifier of the cluster""
cluster-refuse the values from a cluster-definition directive
client-live-timehow long the load-balancer should keep an idle socket open30s
client-dead-timehow long the load-balancer should treat a backend as dead30s
client-read-timeouttimeout of load-balancer reads30s
client-write-timeouttimeout of load-balancer writes
<srun>configures an srun port

[edit] <cluster-definition> directive

directivedescriptiondefault
idunique identifier of the cluster definition""
client-live-timehow long the load-balancer should keep an idle socket open30s
client-dead-timehow long the load-balancer should treat a backend as dead30s
client-read-timeouttimeout of load-balancer reads30s
client-write-timeouttimeout of load-balancer writes
<srun>configures an srun port

[edit] example

Clustering and load balancing is configured in a <cluster> directive inside the <server> block of the resin.conf.

A cluster with two machines might look like:

[edit] resin.conf

<resin xmlns="http://caucho.com/ns/resin">
...
<server>
  <cluster>
    <client-live-time>30s</client-live-time>

    <srun id="a" host="192.168.0.10" port="6802"/>
    <srun id="b" host="192.168.0.11" port="6803"/>
  </cluster>

  ...
</server>
</resin>

[edit] Load Balancing Timeouts

Load balancing has two sets of time outs, one set from the client (front-end) perspective, and one set from the server (back-end) perspective.

The client timeouts are configured directly in the <cluster> directive. The server timeouts are configured in the individual <srun> directives.

client-read-timeoutHow long the frontend should wait on a read before timing out60s
client-write-timeoutHow long the frontend should wait on a write before timing out60s
client-live-timeHow long the frontend should keep a socket alive before discarding it60s
client-dead-timeHow long the frontend should treat a backend as dead before retrying15s

[edit] resin.conf

<cluster>
  <client-live-time>60s</client-live-time>

  <srun id="a" host="192.168.0.10" port="6802"/>
</cluster>

The server timeouts specify how long the backend will wait for new data from a frontend before giving up. This timeout should be longer than the client-live-time.

read-timeoutHow long the backend should wait on a read before timing out30s
write-timeoutHow long the backend should wait on a write before timing out30s

[edit] resin.conf

<cluster>
  ...
  <srun id="c" host="196.168.0.14" port="6802" read-timeout="120s"/>
  ...
</cluster>


[edit] See Also

Clustering and Load Balancing

Personal tools