Load Balancing

Load balancing policies are responsible for routing requests, determining which nodes the driver must connect to as well as the order in which different hosts will be tried in case of network failures. Load balancing policies therefore must also be state listeners and receive notifications about cluster membership and availability changes.

Each cluster can be configured with a specific load balancing policy to be used. And the same policy will be used for all requests across all sessions managed by that cluster instance.

Here is a high level diagram of how a load balancing policy is used during query execution:

Text Diagram

Check out the Ruby Driver - Load Balancing Screencast for a quick and in-depth guide to load balancing with the Ruby Driver.