DC Aware Round robin

This is a more sophisticated version of Round robin policy. It takes all nodes in the local datacenter and uses them one after another.If no nodes from the local datacenter are available it will fall back to other nodes.

For example if there are two datacenters:

  • us_east with nodes: A, B, C

  • us_west with nodes: D, E, F

this policy when set to us_east will only use A, B, C, A, B, …


To use this policy in Session:

use scylla::{Session, SessionBuilder};
use scylla::transport::load_balancing::DcAwareRoundRobinPolicy;
use std::sync::Arc;

let local_dc_name: String = "us_east".to_string();

let session: Session = SessionBuilder::new()