Configuring Cassandra's TokenAware and LatencyAware policy together in C++ driver

耗尽温柔 提交于 2021-02-10 16:09:44

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!