Multi-region queries (fast reads)

The use case here is the registration and log-in process for a service that is global. Let’s assume a very basic case, pseudo-SQL is: registration = INSERT into ACCOUNT, and logging-in = SELECT from ACCOUNT where username = ? and password = ?.

Let’s say there are 4 datacenters: 3 in Ashburn (different availability zones) and 1 in Singapore.

Any tips on structuring this so that writes happen in Ashburn (regardless of where the customer is in the world), so require 2 of the 3 Ashburn datacenters to be online for consensus to write. However, reads can be from any of the 4 datacenters without contacting any other datacenter (in other words, can you read in a sort of eventual consistent fashion, know that you are giving up ACID / consensus in terms of reads in this scenario to get lower latency)?

Or is this all over-complicated and there is a simpler way to achieve the same goal (low latency for reads, higher latency due to multi-region consensus for writes)?

Hey @ptunic

Currently, we do not have an option that would allow you to have reads from any of the 4 data centers because the leaseholder completes both reads and writes, and at the moment there can be only one leaseholder for a given range. We are planning to release follower reads so that eventually AS OF SYSTEM TIME queries can be completed by a follower nodes and not a leaseholder. To ensure all writes are completed in Ashburn, you can use leaseholder preferences to set the lease in Ashburn, you can read more about that here.

Basically, right now you can control where we place replicas (via constraints), and where we place leaseholders (via leaseholder preferences). But until follower reads are released, there isn’t a way to write exclusively in one DC and read from another. If you wanted to do that today, you’d have to partition your tables so that you can place the leaseholders for Singapore data in Singapore. I’m not sure what your schema looks like, so it’s hard to say whether this will work for you.

Hope that helps!


Looks like this is the issue to follow for Follower Reads: