Geographically distribute DGraph

I am looking into making my app a multi region serverless apps. I want my app to have great latency across the world. AWS has some samples where you distribute Amazon DynamoDB across regions with lambda functions for each region.

Is it reasonable to geographically distribute DGraph to multiple AWS regions like this?

I am thinking a HA setup with 3 nodes, say Australia, US and UK.

Or would this make DGraph really slow? I feel like it would probably make it slow.

It is definitely possible. Since writes have to be applied to majority of the cluster (2 out of 3), the write latency would depend on the latency between the data centers.

Reads should be much faster, considering that you can route them to the nearest dgraph server.


That’s great, thanks.

Just to help my understanding of DGraph, how are the reads faster? Can they just reply with the data if they have it?

If say I write to a DB in Australia and then read in London seconds later, if only Australia and the US have been written too, does this mean that the data will just not yet be in the UK and it will return no results. FYI eventual consistency is fine for my scenario if I get overall faster reads, I just want to understand what is happening.

Yeah, I am assuming that you will be running full copy replicas here so all three servers would be serving the same data hence they can just reply.

That is a good question. By default, each dgraph client will see its writes, so there is client level sequencing. The client maintains a map with the index of the latest write for each group and while reading the server waits till we catch up to that index.

If you are using multiple clients, which I think you would be since you plan to have a serverless app, the behaviour would be eventually consistent but you can get around it if you want to by using server level sequencing which would be part of the next release. With server level sequencing, each server would wait to answer a read till it has caught up with the latest index on the leader for a group, hence a client will see writes by all other clients.


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.