This is the default load-balancing policy. This is a straightforward implementation and chooses hosts in a round robin fashion to execute queries. This implementation is not datacenter aware. If a host fails in a query, the next one in the round robin is used.
Suppose you have three hosts in a cluster. Your query execution sequence could look like this:
- Query1: host1, host2, host3
- Query2: host2, host3, host1
- Query3: host3, host1, host2
To use this policy, create a Cluster object as follows:
Cluster cluster = Cluster.builder().addContactPoints("127.0.0.1").withLoadBalancingPolicy(new RoundRobinPolicy()).build();