What's the role of Dgraph server nodes

The Dgraph cluster is having the below server nodes. What’s the role of each server node in the cluster. Which server node is handling mutations and which server node is supporting reads.

  • Zero

  • Alpha

Dgraph is supporting verticle scaling by using sharding. How Dgraph is supporting sharding and can we configure custom sharding?

Welcome!

Here is a breakdown of the roles of servers: (tldr: alphas do most of the work, zeros are used for coordination)
https://dgraph.io/docs/deploy/overview/

As far as custom sharding, there is nothing built in to dgraph to support this, however our team built a program that periodically calls a rpc to get every tablets location and runs a /moveTablet call to make sure each tablet is on the server we expect it to be on. Here are the zero http endpoints: https://dgraph.io/docs/deploy/dgraph-zero/#endpoints. Note that dgraph will automatically move shards around on you every 8m unless you override that setting. https://dgraph.io/docs/deploy/cluster-setup/#shard-rebalancing

Our use case for custom sharding is around multi-tenancy and making sure a customer is collocated with all of their predicates.

1 Like

If you are more technically inclined, there’s also the dgraph paper which outlines all these.

[quote=“iluminae, post:2, topic:13598”]g
sharding
[/quote]

How Dgraph is supporting sharding around multi-tenancy?
Our use cases are mostly arround multi tenancy.

Regarding the brand new v21.03 multi-tenancy feature dgraph added, I do not think any special consideration is made for tenants wrt rebalancing - the built in rebalancing mechanism will move a tablet between Alpha groups every 8m if the alpha groups are un-balanced (based on size on disk).

With my company’s version of multi-tenancy, its just prefixing every predicate and sorting all of the tablets by prefix to allocate to a dgraph group.