How the "Token-aware Routing" and "Latency-aware Routing" works if both set to true.

216 views
Skip to first unread message

Arun More

unread,
Sep 27, 2016, 4:21:52 AM9/27/16
to DataStax C++ Driver for Apache Cassandra User Mailing List
Hi,

If I set both routing policy to true which CPP driver allows me to do that then which one will take effect.

cass_cluster_set_token_aware_routing(cluster, cass_true);
cass_cluster_set_latency_aware_routing(cluster, cass_true);

I have following questions

Q1)
Are both of TokenAwareRouting and LatencyAwareRouting true effective?
Q2)
If both of true is effective, how CPP driver behave to select cassandra nodes in routing policy?
I would like to know LatencyAwareRouting will be applied among nodes with the token affected not with all nodes in the ring or etc.
Q3)
If LatencyAwareRouting is true, is dynamic_snitch_badness_threshold(cassandra.yaml) setting effective?
If answer yes, how CPP driver routing policy will be?
Q4)
If TokenAwareRouting is true, is dynamic_snitch_badness_threshold(cassandra.yaml) setting effective?
If answer yes, how CPP driver routing policy will be?

Regards,
Arun

Michael Penick

unread,
Sep 27, 2016, 1:21:15 PM9/27/16
to cpp-dri...@lists.datastax.com
Answers below.

Mike

On Tue, Sep 27, 2016 at 1:21 AM, Arun More <arun....@gmail.com> wrote:
Hi,

If I set both routing policy to true which CPP driver allows me to do that then which one will take effect.

cass_cluster_set_token_aware_routing(cluster, cass_true);
cass_cluster_set_latency_aware_routing(cluster, cass_true);

I have following questions

Q1)
Are both of TokenAwareRouting and LatencyAwareRouting true effective?

Yes, It will choose the lowest latency replica first. In other words, Token-aware is applied then latency-aware.
 
Q2)
If both of true is effective, how CPP driver behave to select cassandra nodes in routing policy?
I would like to know LatencyAwareRouting will be applied among nodes with the token affected not with all nodes in the ring or etc.

Yes, the lowest latency token affected node is chosen (if they're available).
 
Q3)
If LatencyAwareRouting is true, is dynamic_snitch_badness_threshold(cassandra.yaml) setting effective?
If answer yes, how CPP driver routing policy will be? 

It won't affect how the driver chooses a replica, but it will affect which nodes the coordinator chooses to read/write to (assuming the consistency level is greater than ONE).
 
Q4)
If TokenAwareRouting is true, is dynamic_snitch_badness_threshold(cassandra.yaml) setting effective?
If answer yes, how CPP driver routing policy will be?


Same as above, it doesn't affect how the driver choose its replica, but affects any additional replica, read/write from the coordinator, if the consistency level is greater than ONE. 

 
Regards,
Arun

--
You received this message because you are subscribed to the Google Groups "DataStax C++ Driver for Apache Cassandra User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cpp-driver-user+unsubscribe@lists.datastax.com.

Michael Penick

unread,
Sep 27, 2016, 1:23:25 PM9/27/16
to cpp-dri...@lists.datastax.com
Small correction. The dynamic snitch only affects reads.

Arun More

unread,
Sep 28, 2016, 2:27:49 AM9/28/16
to cpp-dri...@lists.datastax.com
Hi Mike,

Thanks for replying.
I have additional questions.

If it applies token aware first then it will match only one node right as token will be hashed to only one node. So if this node has high latency then latency aware will be applied and query may hit to the node which is not affected by token aware. 

Is my understanding correct?

How token aware is applied for batch query. Batch may have multiple query with multiple partition keys on different table. So which key is considered to choose coordinator.

Regards,
Arun

Michael Penick

unread,
Sep 28, 2016, 11:21:39 AM9/28/16
to cpp-dri...@lists.datastax.com
On Tue, Sep 27, 2016 at 11:27 PM, Arun More <arun....@gmail.com> wrote:
Hi Mike,

Thanks for replying.
I have additional questions.

If it applies token aware first then it will match only one node right as token will be hashed to only one node. So if this node has high latency then latency aware will be applied and query may hit to the node which is not affected by token aware. 

If the replication factor is something like 3 (which is pretty standard) then it will choose the lowest latency replica from those 3.
 

Is my understanding correct?

How token aware is applied for batch query. Batch may have multiple query with multiple partition keys on different table. So which key is considered to choose coordinator. 
 

It uses the first entry in the batch.
Reply all
Reply to author
Forward
0 new messages