Load balancing

The DSE driver uses a custom load balancing policy, defined in dse-reference.conf:

datastax-java-driver {
  basic.load-balancing-policy {
    class = DseLoadBalancingPolicy

It is based on DefaultLoadBalancingPolicy in the OSS driver, and reuses many of the same concepts: token awareness, local datacenter only, and optional node filtering. Therefore it is recommended to first review the explanations in the OSS driver manual.

In addition, DseLoadBalancingPolicy uses an algorithm that improves overall latency behavior when compared to round robin, and has built-in slow node avoidance that takes the responsiveness and uptime of each replica into account when forming the query plan.

Like the OSS policy, the local datacenter can be defined either in the configuration:

datastax-java-driver.basic.load-balancing-policy {
  local-datacenter = datacenter1

Or programmatically when building the session:

DseSession session = DseSession.builder()