Sitemap
Level Up Coding

Coding tutorials and news. The developer homepage gitconnected.com && skilled.dev && levelup.dev

Invalidation got faster; computing it got 540x slower

It worked in dev · Episode 19 · technique: multi-source BFS

11 min readOct 28, 2026

--

Press enter or click to view image in full size

When a cached value changes, the invalidation gossips out from the nodes that took the write, one hop per round. The ops dashboard shows how many rounds until every node in the cluster has it.

A write landing on one node: 9 rounds, and the dashboard computed that in 0.50 ms. A region-wide deploy landing on 1,000 nodes at once: only 6 rounds, because it starts from everywhere. The dashboard took 269 ms to say so, 540x longer, for an invalidation that finished sooner.

The problem

// peers[n] holds the nodes n forwards an invalidation to. Two-way, one round per hop.
type Cluster [][]int

Given the origins — the nodes where the invalidation starts — return how many rounds until every node has it, or -1 if some node never does.

Press enter or click to view image in full size

What you would write

The dashboard already had HopsFrom: pick a node, see how many rounds a change there takes to reach every other node. A plain BFS, tested, drawn on a page.

--

--

Archit Agarwal
Archit Agarwal

Written by Archit Agarwal

PMTS @ Oracle | Golang | Docker | Kubernetes| Typescript | Node.js | .NET | Angular | AWS Certified Cloud Practitioner | Educator