3 Configuration

classy is configured via OTP application environment variables and callbacks.

3.1 General

setup_hooks

Type: mfargs()

A callback that classy executes during startup. It allows business applications to set up other hooks using a more type-safe API.

table_dir

Type: file:filename()

Default: "."

Directory where persistent data is stored. It should be writable.

rpc_timeout

Type: timeout()

Default: 5000

Unit: ms

Default timeout for remote procedure calls.

hook_timeout

Type: timeout()

Default: 30_000

Unit: ms

Maximum run time for any hook.

rand_id_bytes

Type: pos_integer()

Default: 16

Number of bytes used in random identifiers, such as site IDs and cluster IDs.

WARNING: this value should be sufficiently large to account for the birthday problem. Note that new cluster IDs are created every time a node leaves a cluster, so the number of unique random IDs is not limited to the number of sites.

3.2 Peer

sync_timeout

Type: non_neg_integer()

Default: 1000

Unit: ms

Maximum interval of time that can pass between the membership CRDT server receiving an update and the moment it propagates it to the peers.

n_sites

Type: pos_integer()

Default: 1

Minimum number of known peers necessary to advance run level from single to cluster.

to_cluster_sets

Type: [classy:node_set_name()]

Default: []

List of node set names used to additionally restrict when the node is considered joined to a cluster. Sets from the lists are combined using set intersection operation.

quorum_sets

Type: [classy:node_set_name()]

Default: []

List of node set names used to additionally restrict when the node is considered having a quorum. Sets from the lists are combined using set intersection operation.

quorum

Type: pos_integer()

Default: 1

Minimum number of known peers necessary to advance run level from cluster to quorum.

3.3 Two-phase commit

vote_retry_interval

Type: pos_integer()

Default: 5000

Unit: ms

2PC coordinator re-sends outcome of a transaction to the participants at this interval.

3.4 Autoclean

max_site_downtime

Type: pos_integer() | infinity

Default: infinity

Unit: s.

Automatically kick sites that have been down longer than this value from the cluster.

Note: to prevent network-isolated nodes from kicking their peers, quorum among the running nodes is required to perform the act.

cleanup_check_interval

Type: pos_integer()

Default: 5_000

Unit: ms.

Autoclean check interval.

forget_after

Type: pos_integer()

Default: 1w

Unit: s

Forget information about inactive (kicked) sites after this period of time.

Note: cleanup procedure may lead to the following situation:

  1. Site A goes down
  2. Site B kicks A
  3. Information about event 2 propagates throughout the cluster.
  4. Cleanup. All active peers delete data about A.
  5. A goes back up

Since at step 4 we removed the data about event 2, A will reappear in the cluster.

So forget_after should be set to a fairly large value to make sure it doesn’t cover nodes that can go back online.

3.5 Autocluster

discovery_interval

Type: pos_integer()

Default: 5_000

Unit: ms.

Peer discovery retry interval.

discovery_strategy

Type: classy_discovery_strategy:t/0

Peer discovery method, See Autocluster.

discovery_complete_sets

Type: [classy:node_set_name()]

Default: []

Consider cluster discovery complete when intersection of the site sets specified by this parameter, with the local site subtracted, contains at least one item.


JavaScript license information