Full mesh needed?

I’m looking into CockroachDB for a global app backend deployment. We have some users in China, so I wonder if CockroachDB needs to be deployed as full mesh (every DB connects to every other DB).

The reason I ask is that if we place one DB in Hong Kong and one in Shenzhen, the replication between those two will be very good since the connection between Hong Kong and Shenzhen is very good. But connection between Shenzhen and other cities in the US and Europe can be really bad. The connection could be throttled or even completely cut off our hours from time to time due to the great firewall of China.

So, with this in mind, would it be possible to connect a Shenzhen node to only Hong Kong, or is full mesh required? Is also a ring network possible? For example Stockholm -> Moscow -> Beijing Shenzhen -> Hong Kong -> Dubai -> Frankfurt -> Stockholm.


Hi Pete,
thank you for your interest in CockroachDB!
We understand the inconvenience of your varying network topology.

At this time, CockroachDB identifies a blocked link between any two nodes correctly as a network partition.

If the two nodes are part of a consensus group (subject to your zone configuration), the node that is on the minority side will start refusing processing requests until quorum is restored.

Also consider that a query received on a node out of a data range’s consensus group will be automatically forwarded to a node in the consensus group for processing. So if a consensus group is shared between (e.g.) Shenzen and Hong Kong, and the great firewall is up, then a query received on the other side of the firewall will either wait or abort.

So all in all this is a complicated situation to work with.

You could try to use zone configurations to separate the Chinese data from the non-Chinese data, in different data centers. For this to work you will need a fully replicated subset of your data in China at all times. However I am not 100% this would work, for example for any query that needs to span data in and out of China.

A better solution would be to use our upcoming feature Change Data Capture (CDC), due to be released in CockroachDB 2.1 (alpha release planned for June, full release planned for October). With this feature you can create a “soft replica” of your database across the Great Firewall by copying the changes from one replica to another only when the link is available, but without impairing availability of either side. The downside is that organizing your data this way means that transactions won’t be able to span both sides.

I hope this helps, and we would be interested to work further on your use case should you want to provide more details about your application.