问题
After reading about the different load balancing policies available(https://datastax.github.io/cpp-driver/topics/configuration/), it seems to me that for best performance,particularly in multi data-center cluster, token-aware and latency-aware policy should be used together('Performance Tips' section of the above mentioned article).
As per my understanding(assuming replication factor > 1), when we'll use both of these policies together, then the client will calculate the hash of the primary key used in the query and then based on the latency, it will chose the best replica for execution of that query. Is this understanding correct in the given scenario?
Also, I wanted to understand how exactly to implement/configure these 2 policies together. Do I need to just simply enable both policies one after the other in my C++ code? If not, can someone share the code snippet for enabling both the policies together?
回答1:
Yes, your understanding is correct - you can use both policies together. To enable them - just call 2 corresponding functions together, and set necessary settings as described in documentation.
If you have several DCs then it makes sense also enable DC-aware load balancing...
来源:https://stackoverflow.com/questions/48765115/configuring-cassandras-tokenaware-and-latencyaware-policy-together-in-c-drive