Module resty.cassandra.policies.lb.dc_rr

Datacenter-aware round robin load balancing policy.

This policy will work better than its plain Round Robin counterpart in multi-datacenters setups. It is implemented in such a fashion that it will always prioritize nodes from the local/closest datacenter (which needs to be manually specified).

Info:

  • Author: thibaultcha

Functions

new (local_dc) Create a DC-aware round robin policy.


Functions

new (local_dc)
Create a DC-aware round robin policy. Instanciates a DC-aware round robin policy for resty.cassandra.cluster.

Parameters:

  • local_dc string Name of the local/closest datacenter.

Returns:

    table policy: A DC-aware round robin policy.

Usage:

    local Cluster = require "resty.cassandra.cluster"
    local dc_rr = require "resty.cassandra.policies.lb.dc_rr"
    
    local policy = dc_rr.new("my_local_cluster_name")
    local cluster = assert(Cluster.new {
      lb_policy = policy
    })
generated by LDoc 1.4.6 Last updated 2021-02-18 11:29:23