Search code examples
javacassandradatastax

LatencyAwarePolicy datastax cassandra version 4.6 and connect without local datacenter


I am moving my project to spring boot 2.3.5 which has driver 4.6 and LatencyAwarePolicy looks like disappeared from existence. I wonder do we have similar policy builder for driver 4.6 or what is the best approach for 4.6.

https://docs.datastax.com/en/drivers/java/3.6/com/datastax/driver/core/policies/LatencyAwarePolicy.Builder.html

I search but could not find anything in the docs. maybe https://github.com/datastax/java-driver/blob/4.x/core/src/main/java/com/datastax/oss/driver/internal/core/loadbalancing/BasicLoadBalancingPolicy.java with BasicLoadBalancingPolicy I can connect without data center name but I am confused is this as good as LatencyAwarePolicy ?


Solution

  • The default load balancing policy in 4.x now has best practices baked in, including token awareness and busy node avoidance (which was the goal of LatencyAware).

    This blog post discusses more: https://www.datastax.com/blog/improved-client-request-routing-apache-cassandratm

    You can still implement any LBP you care to by implementing the LoadBalancingPolicy interface, but it normally should not be necessary.