whatyouhide / xandra

Fast, simple, and robust Cassandra/ScyllaDB driver for Elixir.
ISC License
406 stars 54 forks source link

Use a single control connection per cluster #274

Closed whatyouhide closed 1 year ago

whatyouhide commented 1 year ago

Closes https://github.com/lexhide/xandra/issues/226.

This work is not complete per se, but I want to avoid giant PRs.

This has the following changes visible to users:

Things that are still missing:

cc @jvf, I can't request your review but would love your 👀 on this.

jvf commented 1 year ago

I will have a look!

jvf commented 1 year ago

I had a look at the changes. My main question is the deprecation of the autodiscovery option.

We exclusively use autodiscovery: false to have full control over which nodes to hit. Our main concern is to only use nodes from the local DC but we have also used this to manually distribute load to different nodes within one DC.

I think restricting queries to the local DC is quite a common concern. Given #199 this would not be guaranteed at the moment without autodiscovery: false.

I think that Xandra is not directly comparable to the Python driver. With the Python driver they solve these issues with load balancing policies like DCAwareRoundRobinPolicy and WhiteListRoundRobinPolicy.

Without policies like this having the autodiscovery option seems pretty valuable to me. From looking at the changes I did not fully understand why you want to ditch autodiscovery: false. What am I missing?

whatyouhide commented 1 year ago

@jvf great comments, and yes you hit it right on the spot: the next step is load balancing policies to give full control over how to select nodes. I'll have some code up soon.