Cassandra driver(datastax) load balancing with TokenAwarePolicy

北慕城南 提交于 2019-12-25 07:27:11

问题


My question is a follow up of this topic : Cassandra load balancing with TokenAwarePolicy and shuffleReplicas

I'm encountering some issues regarding the TokenAwarePolicy that I don't understand.

Cluster configuration :

  • 3 nodes
  • Replication factor = 3
  • Load balancing policy : new TokenAwarePolicy(new RoundRobinPolicy(), false)
  • Consitancy level (Reads/Writes) : ONE

Shuffling replicas is set to false on purpose. But the thing is that I'm encountering consistency problems when reading datas in my application. For instance :

  • Insert 10 entities
  • Dome some other operations with the DB...(insert other entites)
  • Select the previously created entities: All fields are given in the 'SELECT' clause, not 'SELECT *'. Primary key is present in the 'WHERE' clause.

Result : Sometimes getting the right number of entites(10) but sometings getting less (from 0 to 9).

Notice:

  • I'm using BoundStatements only.
  • I'm not using datastax's asynchronous methods.
  • I have checked that the routing key was not null on the 'failed' queries, it wasn't.

I have to admit that I'm targeting the DB with an heavy load (30 threads running X times the above sample together), but still I don't understand why the driver is not querying the right node, giving me stale datas.

Thanks for your answer.

来源:https://stackoverflow.com/questions/37752397/cassandra-driverdatastax-load-balancing-with-tokenawarepolicy

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