Consistent-Hashing-diagram.excalidraw

==⚠ Switch to EXCALIDRAW VIEW in the MORE OPTIONS menu of this document. ⚠==

Consistent Hashing — Hash Ring Diagram

Text Elements

Hash Ring ^ring-label

N1 (0°) ^n1-label N2 (90°) ^n2-label N3 (180°) ^n3-label N4 (270°) ^n4-label

N1-v1 ^n1v1 N1-v2 ^n1v2 N2-v1 ^n2v1 N2-v2 ^n2v2 N3-v1 ^n3v1 N3-v2 ^n3v2

K1 ^k1-label K2 ^k2-label K3 ^k3-label

Keys map to nearest clockwise node; virtual nodes improve balance ^rule-text

Node Addition: N4 inserted ^add-label Keys in arc [N3→N4] migrate to N4 ^migrate-text

%%

Drawing

{
  "type": "excalidraw",
  "version": 2,
  "source": "https://excalidraw.com",
  "elements": [
    {
      "id": "ring-title",
      "type": "text",
      "x": 160,
      "y": 10,
      "width": 280,
      "height": 24,
      "text": "Hash Ring",
      "fontSize": 18,
      "fontFamily": 1,
      "textAlign": "center",
      "verticalAlign": "top",
      "strokeColor": "#1e1e1e",
      "backgroundColor": "transparent",
      "fillStyle": "solid",
      "strokeWidth": 1,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "hash-ring",
      "type": "ellipse",
      "x": 80,
      "y": 40,
      "width": 360,
      "height": 360,
      "strokeColor": "#868e96",
      "backgroundColor": "transparent",
      "fillStyle": "solid",
      "strokeWidth": 2,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "n1-box",
      "type": "rectangle",
      "x": 220,
      "y": 30,
      "width": 80,
      "height": 36,
      "strokeColor": "#1971c2",
      "backgroundColor": "#d0ebff",
      "fillStyle": "solid",
      "strokeWidth": 2,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "n1-text",
      "type": "text",
      "x": 230,
      "y": 40,
      "width": 60,
      "height": 20,
      "text": "N1 (0°)",
      "fontSize": 13,
      "fontFamily": 1,
      "textAlign": "center",
      "verticalAlign": "middle",
      "strokeColor": "#1971c2",
      "backgroundColor": "transparent",
      "fillStyle": "solid",
      "strokeWidth": 1,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "n2-box",
      "type": "rectangle",
      "x": 430,
      "y": 200,
      "width": 80,
      "height": 36,
      "strokeColor": "#2f9e44",
      "backgroundColor": "#ebfbee",
      "fillStyle": "solid",
      "strokeWidth": 2,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "n2-text",
      "type": "text",
      "x": 440,
      "y": 210,
      "width": 60,
      "height": 20,
      "text": "N2 (90°)",
      "fontSize": 13,
      "fontFamily": 1,
      "textAlign": "center",
      "verticalAlign": "middle",
      "strokeColor": "#2f9e44",
      "backgroundColor": "transparent",
      "fillStyle": "solid",
      "strokeWidth": 1,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "n3-box",
      "type": "rectangle",
      "x": 220,
      "y": 374,
      "width": 80,
      "height": 36,
      "strokeColor": "#e67700",
      "backgroundColor": "#fff3bf",
      "fillStyle": "solid",
      "strokeWidth": 2,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "n3-text",
      "type": "text",
      "x": 225,
      "y": 384,
      "width": 70,
      "height": 20,
      "text": "N3 (180°)",
      "fontSize": 13,
      "fontFamily": 1,
      "textAlign": "center",
      "verticalAlign": "middle",
      "strokeColor": "#e67700",
      "backgroundColor": "transparent",
      "fillStyle": "solid",
      "strokeWidth": 1,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "n4-box",
      "type": "rectangle",
      "x": 10,
      "y": 200,
      "width": 80,
      "height": 36,
      "strokeColor": "#9c36b5",
      "backgroundColor": "#f3d9fa",
      "fillStyle": "solid",
      "strokeWidth": 2,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "n4-text",
      "type": "text",
      "x": 15,
      "y": 210,
      "width": 70,
      "height": 20,
      "text": "N4 (270°)",
      "fontSize": 13,
      "fontFamily": 1,
      "textAlign": "center",
      "verticalAlign": "middle",
      "strokeColor": "#9c36b5",
      "backgroundColor": "transparent",
      "fillStyle": "solid",
      "strokeWidth": 1,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "n1v1-box",
      "type": "rectangle",
      "x": 330,
      "y": 50,
      "width": 52,
      "height": 24,
      "strokeColor": "#1971c2",
      "backgroundColor": "#d0ebff",
      "fillStyle": "solid",
      "strokeWidth": 1,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "n1v1-text",
      "type": "text",
      "x": 335,
      "y": 55,
      "width": 42,
      "height": 16,
      "text": "N1-v1",
      "fontSize": 11,
      "fontFamily": 1,
      "textAlign": "center",
      "verticalAlign": "middle",
      "strokeColor": "#1971c2",
      "backgroundColor": "transparent",
      "fillStyle": "solid",
      "strokeWidth": 1,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "n1v2-box",
      "type": "rectangle",
      "x": 138,
      "y": 50,
      "width": 52,
      "height": 24,
      "strokeColor": "#1971c2",
      "backgroundColor": "#d0ebff",
      "fillStyle": "solid",
      "strokeWidth": 1,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "n1v2-text",
      "type": "text",
      "x": 143,
      "y": 55,
      "width": 42,
      "height": 16,
      "text": "N1-v2",
      "fontSize": 11,
      "fontFamily": 1,
      "textAlign": "center",
      "verticalAlign": "middle",
      "strokeColor": "#1971c2",
      "backgroundColor": "transparent",
      "fillStyle": "solid",
      "strokeWidth": 1,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "n2v1-box",
      "type": "rectangle",
      "x": 410,
      "y": 110,
      "width": 52,
      "height": 24,
      "strokeColor": "#2f9e44",
      "backgroundColor": "#ebfbee",
      "fillStyle": "solid",
      "strokeWidth": 1,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "n2v1-text",
      "type": "text",
      "x": 415,
      "y": 115,
      "width": 42,
      "height": 16,
      "text": "N2-v1",
      "fontSize": 11,
      "fontFamily": 1,
      "textAlign": "center",
      "verticalAlign": "middle",
      "strokeColor": "#2f9e44",
      "backgroundColor": "transparent",
      "fillStyle": "solid",
      "strokeWidth": 1,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "n2v2-box",
      "type": "rectangle",
      "x": 410,
      "y": 300,
      "width": 52,
      "height": 24,
      "strokeColor": "#2f9e44",
      "backgroundColor": "#ebfbee",
      "fillStyle": "solid",
      "strokeWidth": 1,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "n2v2-text",
      "type": "text",
      "x": 415,
      "y": 305,
      "width": 42,
      "height": 16,
      "text": "N2-v2",
      "fontSize": 11,
      "fontFamily": 1,
      "textAlign": "center",
      "verticalAlign": "middle",
      "strokeColor": "#2f9e44",
      "backgroundColor": "transparent",
      "fillStyle": "solid",
      "strokeWidth": 1,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "n3v1-box",
      "type": "rectangle",
      "x": 330,
      "y": 358,
      "width": 52,
      "height": 24,
      "strokeColor": "#e67700",
      "backgroundColor": "#fff3bf",
      "fillStyle": "solid",
      "strokeWidth": 1,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "n3v1-text",
      "type": "text",
      "x": 335,
      "y": 363,
      "width": 42,
      "height": 16,
      "text": "N3-v1",
      "fontSize": 11,
      "fontFamily": 1,
      "textAlign": "center",
      "verticalAlign": "middle",
      "strokeColor": "#e67700",
      "backgroundColor": "transparent",
      "fillStyle": "solid",
      "strokeWidth": 1,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "n3v2-box",
      "type": "rectangle",
      "x": 138,
      "y": 358,
      "width": 52,
      "height": 24,
      "strokeColor": "#e67700",
      "backgroundColor": "#fff3bf",
      "fillStyle": "solid",
      "strokeWidth": 1,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "n3v2-text",
      "type": "text",
      "x": 143,
      "y": 363,
      "width": 42,
      "height": 16,
      "text": "N3-v2",
      "fontSize": 11,
      "fontFamily": 1,
      "textAlign": "center",
      "verticalAlign": "middle",
      "strokeColor": "#e67700",
      "backgroundColor": "transparent",
      "fillStyle": "solid",
      "strokeWidth": 1,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "k1-diamond",
      "type": "diamond",
      "x": 375,
      "y": 145,
      "width": 40,
      "height": 40,
      "strokeColor": "#e03131",
      "backgroundColor": "#ffe3e3",
      "fillStyle": "solid",
      "strokeWidth": 2,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "k1-text",
      "x": 382,
      "y": 157,
      "type": "text",
      "width": 26,
      "height": 16,
      "text": "K1",
      "fontSize": 11,
      "fontFamily": 1,
      "textAlign": "center",
      "verticalAlign": "middle",
      "strokeColor": "#e03131",
      "backgroundColor": "transparent",
      "fillStyle": "solid",
      "strokeWidth": 1,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "k2-diamond",
      "type": "diamond",
      "x": 375,
      "y": 255,
      "width": 40,
      "height": 40,
      "strokeColor": "#e03131",
      "backgroundColor": "#ffe3e3",
      "fillStyle": "solid",
      "strokeWidth": 2,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "k2-text",
      "x": 382,
      "y": 267,
      "type": "text",
      "width": 26,
      "height": 16,
      "text": "K2",
      "fontSize": 11,
      "fontFamily": 1,
      "textAlign": "center",
      "verticalAlign": "middle",
      "strokeColor": "#e03131",
      "backgroundColor": "transparent",
      "fillStyle": "solid",
      "strokeWidth": 1,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "k3-diamond",
      "type": "diamond",
      "x": 110,
      "y": 145,
      "width": 40,
      "height": 40,
      "strokeColor": "#e03131",
      "backgroundColor": "#ffe3e3",
      "fillStyle": "solid",
      "strokeWidth": 2,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "k3-text",
      "x": 117,
      "y": 157,
      "type": "text",
      "width": 26,
      "height": 16,
      "text": "K3",
      "fontSize": 11,
      "fontFamily": 1,
      "textAlign": "center",
      "verticalAlign": "middle",
      "strokeColor": "#e03131",
      "backgroundColor": "transparent",
      "fillStyle": "solid",
      "strokeWidth": 1,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "arrow-k1-n2",
      "type": "arrow",
      "x": 415,
      "y": 165,
      "width": 20,
      "height": 44,
      "strokeColor": "#e03131",
      "backgroundColor": "transparent",
      "fillStyle": "solid",
      "strokeWidth": 1,
      "roughness": 1,
      "opacity": 100,
      "points": [[0, 0], [20, 44]],
      "startArrowhead": null,
      "endArrowhead": "arrow"
    },
    {
      "id": "arrow-k2-n3",
      "type": "arrow",
      "x": 395,
      "y": 295,
      "width": -5,
      "height": 88,
      "strokeColor": "#e03131",
      "backgroundColor": "transparent",
      "fillStyle": "solid",
      "strokeWidth": 1,
      "roughness": 1,
      "opacity": 100,
      "points": [[0, 0], [-5, 88]],
      "startArrowhead": null,
      "endArrowhead": "arrow"
    },
    {
      "id": "arrow-k3-n1",
      "type": "arrow",
      "x": 140,
      "y": 155,
      "width": 80,
      "height": -95,
      "strokeColor": "#e03131",
      "backgroundColor": "transparent",
      "fillStyle": "solid",
      "strokeWidth": 1,
      "roughness": 1,
      "opacity": 100,
      "points": [[0, 0], [80, -95]],
      "startArrowhead": null,
      "endArrowhead": "arrow"
    },
    {
      "id": "rule-text",
      "type": "text",
      "x": 60,
      "y": 420,
      "width": 440,
      "height": 20,
      "text": "Keys map to nearest clockwise node; virtual nodes improve balance",
      "fontSize": 12,
      "fontFamily": 1,
      "textAlign": "center",
      "verticalAlign": "top",
      "strokeColor": "#1e1e1e",
      "backgroundColor": "transparent",
      "fillStyle": "solid",
      "strokeWidth": 1,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "add-section-label",
      "type": "text",
      "x": 560,
      "y": 10,
      "width": 280,
      "height": 24,
      "text": "Node Addition: N4 inserted",
      "fontSize": 16,
      "fontFamily": 1,
      "textAlign": "left",
      "verticalAlign": "top",
      "strokeColor": "#9c36b5",
      "backgroundColor": "transparent",
      "fillStyle": "solid",
      "strokeWidth": 1,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "add-ring",
      "type": "ellipse",
      "x": 560,
      "y": 40,
      "width": 240,
      "height": 240,
      "strokeColor": "#868e96",
      "backgroundColor": "transparent",
      "fillStyle": "solid",
      "strokeWidth": 2,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "add-n3-box",
      "type": "rectangle",
      "x": 645,
      "y": 264,
      "width": 70,
      "height": 28,
      "strokeColor": "#e67700",
      "backgroundColor": "#fff3bf",
      "fillStyle": "solid",
      "strokeWidth": 2,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "add-n3-text",
      "type": "text",
      "x": 650,
      "y": 272,
      "width": 60,
      "height": 16,
      "text": "N3 (180°)",
      "fontSize": 11,
      "fontFamily": 1,
      "textAlign": "center",
      "verticalAlign": "middle",
      "strokeColor": "#e67700",
      "backgroundColor": "transparent",
      "fillStyle": "solid",
      "strokeWidth": 1,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "add-n4-box",
      "type": "rectangle",
      "x": 800,
      "y": 148,
      "width": 70,
      "height": 28,
      "strokeColor": "#9c36b5",
      "backgroundColor": "#f3d9fa",
      "fillStyle": "solid",
      "strokeWidth": 2,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "add-n4-text",
      "type": "text",
      "x": 805,
      "y": 156,
      "width": 60,
      "height": 16,
      "text": "N4 NEW",
      "fontSize": 11,
      "fontFamily": 1,
      "textAlign": "center",
      "verticalAlign": "middle",
      "strokeColor": "#9c36b5",
      "backgroundColor": "transparent",
      "fillStyle": "solid",
      "strokeWidth": 1,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "migrate-arrow",
      "type": "arrow",
      "x": 790,
      "y": 200,
      "width": -60,
      "height": 60,
      "strokeColor": "#9c36b5",
      "backgroundColor": "transparent",
      "fillStyle": "solid",
      "strokeWidth": 2,
      "roughness": 1,
      "strokeStyle": "dashed",
      "opacity": 100,
      "points": [[0, 0], [-60, 60]],
      "startArrowhead": null,
      "endArrowhead": "arrow"
    },
    {
      "id": "migrate-text",
      "type": "text",
      "x": 560,
      "y": 300,
      "width": 320,
      "height": 36,
      "text": "Keys in arc [N3→N4] migrate to N4",
      "fontSize": 12,
      "fontFamily": 1,
      "textAlign": "left",
      "verticalAlign": "top",
      "strokeColor": "#9c36b5",
      "backgroundColor": "transparent",
      "fillStyle": "solid",
      "strokeWidth": 1,
      "roughness": 1,
      "opacity": 100
    }
  ],
  "appState": {
    "gridSize": null,
    "viewBackgroundColor": "#ffffff"
  },
  "files": {}
}

%%