Skip to content

The thundering herd flow

At T+0 the key expires; at T+0.001 N requests hit the DB; at T+0.5 the DB is saturated.

sequenceDiagram
  participant C as Clients (N)
  participant Cache
  participant DB
  Note over Cache: T+0 key expires
  C->>Cache: GET
  Cache-->>C: MISS
  C->>DB: query (N times)
  Note over DB: CPU saturates
  DB-->>C: slow or timeout
  Note over Cache: One refill succeeds
  C->>Cache: GET
  Cache-->>C: HIT