Click or drag to resize

DCAwareRoundRobinPolicy Class

A data-center aware Round-robin load balancing policy.

This policy provides round-robin queries over the node of the local datacenter. Currently, it also includes in the query plans returned a configurable number of hosts in the remote datacenters (which are always tried after the local nodes) but this functionality will be removed in the next major version of the driver. See the comments on DCAwareRoundRobinPolicy(String, Int32) for more information.

Inheritance Hierarchy
SystemObject
  DseDCAwareRoundRobinPolicy

Namespace:  Dse
Assembly:  Dse (in Dse.dll) Version: 2.9.0
Syntax
C#
public class DCAwareRoundRobinPolicy : ILoadBalancingPolicy

The DCAwareRoundRobinPolicy type exposes the following members.

Constructors
  NameDescription
Public methodDCAwareRoundRobinPolicy
Creates a new datacenter aware round robin policy that auto-discover the local data-center.

If this constructor is used, the data-center used as local will the data-center of the first Cassandra node the driver connects to. This will always be ok if all the contact points use at Cluster creation are in the local data-center. If it's not the case, you should provide the local data-center name yourself by using one of the other constructor of this class.

Public methodDCAwareRoundRobinPolicy(String)
Creates a new datacenter aware round robin policy given the name of the local datacenter.

The name of the local datacenter provided must be the local datacenter name as known by Cassandra.

The policy created will ignore all remote hosts. In other words, this is equivalent to new DCAwareRoundRobinPolicy(localDc, 0).

Public methodDCAwareRoundRobinPolicy(String, Int32) Obsolete.
Creates a new DCAwareRoundRobin policy given the name of the local datacenter and that uses the provided number of host per remote datacenter as failover for the local hosts.

The name of the local datacenter provided must be the local datacenter name as known by Cassandra.

Top
Properties
  NameDescription
Public propertyLocalDc
Gets the Local Datacenter. This value is provided in the constructor.
Public propertyUsedHostsPerRemoteDc Obsolete.
Gets the number of hosts per remote datacenter that should be considered. This value is provided in the constructor.
Top
Methods
  NameDescription
Public methodDistance
Return the HostDistance for the provided host.

This policy consider nodes in the local datacenter as Local. For each remote datacenter, it considers a configurable number of hosts as Remote and the rest is Ignored.

To configure how many host in each remote datacenter is considered Remote.

Public methodInitialize
Public methodNewQueryPlan
Returns the hosts to use for a new query.

The returned plan will always try each known host in the local datacenter first, and then, if none of the local host is reachable, will try up to a configurable number of other host per remote datacenter. The order of the local node in the returned query plan will follow a Round-robin algorithm.

Top
See Also

Reference