Distributed-Cache-diagram.excalidraw

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

Distributed Cache — Cache Topology and Data Flow Diagram

Text Elements

Client ^client-box Application Server ^app-box Cache Cluster ^cache-cluster-label Redis-1 ^redis1 Redis-2 ^redis2 Redis-3 ^redis3 Database ^db-box HIT (fast) ^hit-label populate cache ^populate-label Write-Through: write cache + DB together ^wt-label Write-Behind: write cache, async DB ^wb-label Cache-Aside: app manages cache explicitly ^ca-label Invalidation Strategies ^inv-label TTL prevents stale data; thundering herd on mass expiry ^ttl-note

%%

Drawing

{
  "type": "excalidraw",
  "version": 2,
  "source": "https://excalidraw.com",
  "elements": [
    {
      "id": "client-box",
      "type": "rectangle",
      "x": 280,
      "y": 20,
      "width": 160,
      "height": 44,
      "strokeColor": "#1e1e1e",
      "backgroundColor": "#f8f9fa",
      "fillStyle": "solid",
      "strokeWidth": 2,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "client-text",
      "type": "text",
      "x": 320,
      "y": 34,
      "width": 80,
      "height": 20,
      "text": "Client",
      "fontSize": 14,
      "fontFamily": 1,
      "textAlign": "center",
      "verticalAlign": "middle",
      "strokeColor": "#1e1e1e",
      "backgroundColor": "transparent",
      "fillStyle": "solid",
      "strokeWidth": 1,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "arrow-client-app",
      "type": "arrow",
      "x": 360,
      "y": 64,
      "width": 0,
      "height": 56,
      "strokeColor": "#1e1e1e",
      "backgroundColor": "transparent",
      "fillStyle": "solid",
      "strokeWidth": 2,
      "roughness": 1,
      "opacity": 100,
      "points": [[0, 0], [0, 56]],
      "startArrowhead": null,
      "endArrowhead": "arrow"
    },
    {
      "id": "app-box",
      "type": "rectangle",
      "x": 240,
      "y": 120,
      "width": 240,
      "height": 50,
      "strokeColor": "#1971c2",
      "backgroundColor": "#e7f5ff",
      "fillStyle": "solid",
      "strokeWidth": 3,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "app-text",
      "type": "text",
      "x": 270,
      "y": 137,
      "width": 180,
      "height": 20,
      "text": "Application Server",
      "fontSize": 14,
      "fontFamily": 1,
      "textAlign": "center",
      "verticalAlign": "middle",
      "strokeColor": "#1971c2",
      "backgroundColor": "transparent",
      "fillStyle": "solid",
      "strokeWidth": 1,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "arrow-app-cache",
      "type": "arrow",
      "x": 310,
      "y": 170,
      "width": -130,
      "height": 80,
      "strokeColor": "#2f9e44",
      "backgroundColor": "transparent",
      "fillStyle": "solid",
      "strokeWidth": 2,
      "roughness": 1,
      "opacity": 100,
      "points": [[0, 0], [-130, 80]],
      "startArrowhead": null,
      "endArrowhead": "arrow",
      "label": {
        "text": "check cache",
        "fontSize": 11,
        "strokeColor": "#2f9e44"
      }
    },
    {
      "id": "cache-cluster-border",
      "type": "rectangle",
      "x": 30,
      "y": 250,
      "width": 240,
      "height": 130,
      "strokeColor": "#2f9e44",
      "backgroundColor": "#ebfbee",
      "fillStyle": "solid",
      "strokeWidth": 2,
      "roughness": 1,
      "strokeStyle": "dashed",
      "opacity": 100
    },
    {
      "id": "cache-cluster-label",
      "type": "text",
      "x": 70,
      "y": 256,
      "width": 160,
      "height": 20,
      "text": "Cache Cluster",
      "fontSize": 13,
      "fontFamily": 1,
      "textAlign": "center",
      "verticalAlign": "top",
      "strokeColor": "#2f9e44",
      "backgroundColor": "transparent",
      "fillStyle": "solid",
      "strokeWidth": 1,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "redis1-box",
      "type": "rectangle",
      "x": 45,
      "y": 285,
      "width": 70,
      "height": 36,
      "strokeColor": "#2f9e44",
      "backgroundColor": "#b2f2bb",
      "fillStyle": "solid",
      "strokeWidth": 2,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "redis1-text",
      "type": "text",
      "x": 50,
      "y": 295,
      "width": 60,
      "height": 20,
      "text": "Redis-1",
      "fontSize": 12,
      "fontFamily": 1,
      "textAlign": "center",
      "verticalAlign": "middle",
      "strokeColor": "#2f9e44",
      "backgroundColor": "transparent",
      "fillStyle": "solid",
      "strokeWidth": 1,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "redis2-box",
      "type": "rectangle",
      "x": 115,
      "y": 285,
      "width": 70,
      "height": 36,
      "strokeColor": "#2f9e44",
      "backgroundColor": "#b2f2bb",
      "fillStyle": "solid",
      "strokeWidth": 2,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "redis2-text",
      "type": "text",
      "x": 120,
      "y": 295,
      "width": 60,
      "height": 20,
      "text": "Redis-2",
      "fontSize": 12,
      "fontFamily": 1,
      "textAlign": "center",
      "verticalAlign": "middle",
      "strokeColor": "#2f9e44",
      "backgroundColor": "transparent",
      "fillStyle": "solid",
      "strokeWidth": 1,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "redis3-box",
      "type": "rectangle",
      "x": 185,
      "y": 285,
      "width": 70,
      "height": 36,
      "strokeColor": "#2f9e44",
      "backgroundColor": "#b2f2bb",
      "fillStyle": "solid",
      "strokeWidth": 2,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "redis3-text",
      "type": "text",
      "x": 190,
      "y": 295,
      "width": 60,
      "height": 20,
      "text": "Redis-3",
      "fontSize": 12,
      "fontFamily": 1,
      "textAlign": "center",
      "verticalAlign": "middle",
      "strokeColor": "#2f9e44",
      "backgroundColor": "transparent",
      "fillStyle": "solid",
      "strokeWidth": 1,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "arrow-cache-hit",
      "type": "arrow",
      "x": 150,
      "y": 250,
      "width": 170,
      "height": -80,
      "strokeColor": "#2f9e44",
      "backgroundColor": "transparent",
      "fillStyle": "solid",
      "strokeWidth": 2,
      "roughness": 1,
      "strokeStyle": "dashed",
      "opacity": 100,
      "points": [[0, 0], [170, -80]],
      "startArrowhead": null,
      "endArrowhead": "arrow",
      "label": {
        "text": "HIT (fast)",
        "fontSize": 11,
        "strokeColor": "#2f9e44"
      }
    },
    {
      "id": "arrow-app-db",
      "type": "arrow",
      "x": 410,
      "y": 145,
      "width": 110,
      "height": 130,
      "strokeColor": "#e03131",
      "backgroundColor": "transparent",
      "fillStyle": "solid",
      "strokeWidth": 2,
      "roughness": 1,
      "opacity": 100,
      "points": [[0, 0], [110, 130]],
      "startArrowhead": null,
      "endArrowhead": "arrow",
      "label": {
        "text": "MISS → DB",
        "fontSize": 11,
        "strokeColor": "#e03131"
      }
    },
    {
      "id": "db-box",
      "type": "rectangle",
      "x": 460,
      "y": 250,
      "width": 160,
      "height": 60,
      "strokeColor": "#e67700",
      "backgroundColor": "#fff3bf",
      "fillStyle": "solid",
      "strokeWidth": 3,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "db-text",
      "type": "text",
      "x": 500,
      "y": 272,
      "width": 80,
      "height": 20,
      "text": "Database",
      "fontSize": 14,
      "fontFamily": 1,
      "textAlign": "center",
      "verticalAlign": "middle",
      "strokeColor": "#e67700",
      "backgroundColor": "transparent",
      "fillStyle": "solid",
      "strokeWidth": 1,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "arrow-db-cache",
      "type": "arrow",
      "x": 460,
      "y": 310,
      "width": -180,
      "height": 30,
      "strokeColor": "#1971c2",
      "backgroundColor": "transparent",
      "fillStyle": "solid",
      "strokeWidth": 2,
      "roughness": 1,
      "opacity": 100,
      "points": [[0, 0], [-180, 30]],
      "startArrowhead": null,
      "endArrowhead": "arrow",
      "label": {
        "text": "populate cache",
        "fontSize": 11,
        "strokeColor": "#1971c2"
      }
    },
    {
      "id": "inv-panel-box",
      "type": "rectangle",
      "x": 440,
      "y": 120,
      "width": 260,
      "height": 110,
      "strokeColor": "#868e96",
      "backgroundColor": "#f8f9fa",
      "fillStyle": "solid",
      "strokeWidth": 1,
      "roughness": 1,
      "strokeStyle": "dashed",
      "opacity": 100
    },
    {
      "id": "inv-label-text",
      "type": "text",
      "x": 500,
      "y": 126,
      "width": 140,
      "height": 20,
      "text": "Invalidation Strategies",
      "fontSize": 13,
      "fontFamily": 1,
      "textAlign": "center",
      "verticalAlign": "top",
      "strokeColor": "#1e1e1e",
      "backgroundColor": "transparent",
      "fillStyle": "solid",
      "strokeWidth": 1,
      "roughness": 1,
      "opacity": 100,
      "bold": true
    },
    {
      "id": "wt-label-text",
      "type": "text",
      "x": 450,
      "y": 150,
      "width": 240,
      "height": 18,
      "text": "Write-Through: write cache + DB together",
      "fontSize": 11,
      "fontFamily": 1,
      "textAlign": "left",
      "verticalAlign": "top",
      "strokeColor": "#1e1e1e",
      "backgroundColor": "transparent",
      "fillStyle": "solid",
      "strokeWidth": 1,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "wb-label-text",
      "type": "text",
      "x": 450,
      "y": 172,
      "width": 240,
      "height": 18,
      "text": "Write-Behind: write cache, async DB",
      "fontSize": 11,
      "fontFamily": 1,
      "textAlign": "left",
      "verticalAlign": "top",
      "strokeColor": "#1e1e1e",
      "backgroundColor": "transparent",
      "fillStyle": "solid",
      "strokeWidth": 1,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "ca-label-text",
      "type": "text",
      "x": 450,
      "y": 194,
      "width": 240,
      "height": 18,
      "text": "Cache-Aside: app manages cache explicitly",
      "fontSize": 11,
      "fontFamily": 1,
      "textAlign": "left",
      "verticalAlign": "top",
      "strokeColor": "#1e1e1e",
      "backgroundColor": "transparent",
      "fillStyle": "solid",
      "strokeWidth": 1,
      "roughness": 1,
      "opacity": 100
    },
    {
      "id": "ttl-note-text",
      "type": "text",
      "x": 40,
      "y": 410,
      "width": 600,
      "height": 20,
      "text": "TTL prevents stale data; thundering herd on mass expiry",
      "fontSize": 12,
      "fontFamily": 1,
      "textAlign": "center",
      "verticalAlign": "top",
      "strokeColor": "#e67700",
      "backgroundColor": "transparent",
      "fillStyle": "solid",
      "strokeWidth": 1,
      "roughness": 1,
      "opacity": 100
    }
  ],
  "appState": {
    "gridSize": null,
    "viewBackgroundColor": "#ffffff"
  },
  "files": {}
}

%%