Multi-tenant horizontal scaling across Alphas

My primary use case for Dgraph revolves around multi-tenancy where I need to isolate each of my customer’s data within a separate tenant for security and compliance reasons, and as we grow we will require an increasing number of tenants. Different tenants will have different size datasets, and different levels of load, depending on the number of system users our customers have on-boarded to our service.

As we increase the number of tenants, we will likely need to scale horizontally to support the load; does Dgraph currently/are there any plans to support distributing tenants across nodes such that different Alpha nodes contain the entire data of, and are able to serve requests for, a subset of tenants, rather than all?

In the documentation I think I recall reading (though can’t find it now) that as Dgraph scales horizontally, replicating all data across all nodes such that any node can serve any request, but this would be undesirable in a multi-tenancy scenario, replicating every tenant’s data across every Alpha, due to the ever increasing storage requirements.

Dgraph replicates all data within a group. A single cluster can can many groups, each group consisting of 1,3 or 5 servers.

Tablets (predicates) only belong to one group. The cluster can serve requests across all groups, however it does this by forwarding any part of the request that deals with non-local data to a node that has that data.

You can control exactly which group serves which tablets, though this must be done externally with the moveTablet http API on the zero (this is when self hosting). This can be paired with disabling auto-rebalancing on the zeros to give you complete control over data locality.

1 Like

Thanks for the explanation @iluminae.

It’s great that Dgraph is built with horizontal scalability at the forefront.