Module resty.cassandra.policies.lb.req_rr

Request-aware round robin load balancing policy for OpenResty.

This policy will try to reuse the same node for the lifecycle of a given request if possible. It is mostly designed for use in OpenResty environments.

This ensures that the underlying connection pool to the node is reused as much as possible. If a new node is chosen for every query, there is no guarantee that each selected node will already have a pre-established connection. Since this policy reuses the same node for the lifecycle of a request, the chances of having to open a new connection are much reduced.

Info:

  • Author: thibaultcha

Functions

new () Create a request-aware round robin policy.


Functions

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

Returns:

    table policy: A request-ware round robin policy.

Usage:

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