1

yugabyte cluster has 2 regions, 3 AZs, 6 node architecture.

4 nodes in central region, 2 nodes in east region

Node1 (Master, TServer) US-east
Node2 (Master, TServer) US-central-1
Node3 (TServer) US-central-1
Node4 (TServer) US-east
Node5 (Master, TServer) US-central-2 (Leader)
Node6 (TServer) US-central-2

Application is running in central region.

Application is using YCQL driver(yugabyte gocql client) that is currently configured to send SQL queries to Node2(only)


As mentioned here: In many cases, this forwarding will be purely local, because both CQL and Redis Cluster clients are capable of sending requests to the right server and avoiding an additional network hop.

  1. Is the above statement about CQL client referring to yugabyte gocql client? here it mentions: "The driver can route queries to nodes that hold data replicas based on partition key (preferring local DC)."

    How can a client driver know, which tablet server to send the request?

  2. if yes, does connection configuration of YCQL driver having connections with all 4 nodes(in central region), makes the client driver capable of knowing the correct tablet server, to send query? improving the query response time

  3. if yes, Hoes YCQL driver know, which is the right tablet server to send query request(INSERT/UPDATE/SELECT)?

overexchange
  • 15,768
  • 30
  • 152
  • 347

1 Answers1

1

How can a client driver know, which tablet server to send the request?

The driver periodically queries this table:

ycqlsh:system> select * from system.partitions;

Where it finds how tables are split, and where the tablets are located.

When you send a query, you pass the partition-keys in a way the driver understands them and hashes them and knows where to send them.

if yes, does connection configuration of YCQL driver having connections with all 4 nodes(in central region), makes the client driver capable of knowing the correct tablet server, to send query? improving the query response time

Yes. This should be combined with DC Aware query routing: https://pkg.go.dev/github.com/gocql/gocql#hdr-Data_center_awareness_and_query_routing

if yes, Hoes YCQL driver know, which is the right tablet server to send query request(INSERT/UPDATE/SELECT)?

Using the same logic as above. Knowing the tablet locations on all the cluster.

dh YB
  • 965
  • 3
  • 10
  • So, in our case, east region is replication of central region....... If I set `gocql.TokenAwareHostPolicy(gocql.DCAwareRoundRobinPolicy("US Central"))` and let’s say, gocql driver found the tablet server(that owns the table partition) in central region, as down… What happens next? Because the replication of this tablet is in “US East 2”. How does gocql driver know that the query has to be sent to the tablet server in east region? – overexchange Jan 27 '22 at 19:27
  • @overexchange it does this by knowing the location of all tablet peers/leaders for all tables/indexes in the whole cluster. – dh YB Jan 28 '22 at 09:10