dart_cassandra_cql
dart_cassandra_cql copied to clipboard
Load-balancing policies
Hey,
Just curious if there is anything similar to "Token aware" client policy in Java driver? (docs: https://docs.datastax.com/en/latest-java-driver/common/drivers/reference/tuningPolicies_c.html )
It seems that this should be configurable in connection pool, but I couldn't find anything just looking at the docs.
UPDATE: NodeJS driver seems to support this as well http://datastax.github.io/nodejs-driver/features/tuning-policies/#load-balancing-policy https://github.com/datastax/nodejs-driver/blob/master/lib/policies/load-balancing.js
At the moment the driver only supports round-robin load-balancing. However, it shouldn't be too hard to refactor the code and implement different load-balancing policies if more people request this.
Are you using the driver in a situation where you require token-aware routing?
Thanks!
We recently went through an audit from a Cassandra expert who recommended using token-aware policy. We're not using this driver yet (currently runs php), but I'm exploring options and trying to understand if there is anything missing.
In general, from what I understood, looks like token-aware policy is something they recommend to use by default in most cases since it gives better performance with almost no extra cost.
I can try and look for what it would take to introduce this feature probably (js driver can be used as a good reference I guess).
Would you be interested in such a change?
Sorry for the late reply.
Implementing this will probably require refactoring the driver to support pluggable connection selection policies (currently the driver does a simple RR on the healthy connection pool). This should be relatively easy to implement though.
I didn't have any free time this far to browse the JS code and figure out how the token-aware policy is implemented. Feel free to take a look at the implementation and share any details you can find.