Skip to content
This repository was archived by the owner on Aug 26, 2024. It is now read-only.

Add rack-aware load balancing policy #2

Merged
merged 5 commits into from
Jan 2, 2023
Merged

Conversation

martin-sucha
Copy link
Collaborator

We need to prefer local rack as there are higher network costs
when communicating with nodes in remote rack.

This policy prefers nodes from the local rack, then local datacenter
and then other nodes.

The new RackAwarePolicy is similar to DCAwarePolicy,
but does not have the deprecated options.
TokenAwarePolicy and other code needed to be modified
so that the local rack is propagated.

The TokenAware policy was changed to prefer replicas in remote
rack / remote DC before trying non-replica nodes.
It does not make much sense to not try the replicas and
trying the replicas simplifies the code as now we have three
levels local/remote/remote2.

This change might not be backwards-compatible,
we don't know what exactly this project guarantees in terms of
backwards compatibility.

Co-Authored-By: Peter Navrátil [email protected]

The out was not helpful for understanding the failure of
a test.
Printing the query plans will help.
This argument was not used anywhere, it worked by chance
since it had the same value everywhere.
The Datstax C++ driver has default ONE,
the Scylla fork has LOCAL_ONE.
@martin-sucha martin-sucha force-pushed the ms/rack-aware-cleanup branch from e69b80e to f59881a Compare January 2, 2023 11:51
@martin-sucha
Copy link
Collaborator Author

Some unit tests are failing, but those are failing also upstream.

All load balancing policy unit tests pass (./cassandra-unit-tests '--gtest_filter=*LoadBalancingUnitTest.*')

We need to prefer local rack as there are higher network costs
when communicating with nodes in remote rack.

This policy prefers nodes from the local rack, then local datacenter
and then other nodes.

The new RackAwarePolicy is similar to DCAwarePolicy,
but does not have the deprecated options.
TokenAwarePolicy and other code needed to be modified
so that the local rack is propagated.

The TokenAware policy was changed to prefer replicas in remote
rack / remote DC before trying non-replica nodes.
It does not make much sense to not try the replicas and
trying the replicas simplifies the code as now we have three
levels local/remote/remote2.

This change might not be backwards-compatible,
we don't know what exactly this project guarantees in terms of
backwards compatibility.

Co-Authored-By: Peter Navrátil <[email protected]>
@martin-sucha
Copy link
Collaborator Author

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants