Skip to content
Graphviz (DOT) templates

Database Sharding

Application-tier sharding by tenant_id across 4 shards.

Template previewGraphviz (DOT)
Rendering…

Make it your own.

digraph shards {
  rankdir=LR;
  graph [bgcolor=transparent];
  node [shape=box, style="rounded,filled", fontname=Inter, fontsize=10];

  App [label="App", fillcolor="#dbeafe"];
  Router [label="Shard router\nhash(tenant_id) mod 4", fillcolor="#fef3c7"];
  S0 [label="Shard 0\ntenants A-F", shape=cylinder, fillcolor="#dcfce7"];
  S1 [label="Shard 1\ntenants G-L", shape=cylinder, fillcolor="#dcfce7"];
  S2 [label="Shard 2\ntenants M-R", shape=cylinder, fillcolor="#dcfce7"];
  S3 [label="Shard 3\ntenants S-Z", shape=cylinder, fillcolor="#dcfce7"];

  App -> Router;
  Router -> S0; Router -> S1; Router -> S2; Router -> S3;
}