Visualizers

Learn by moving things

Interactive explainers for the ideas behind retrieval, embeddings, and agents. A formula tells you what is true; dragging a vector shows you why. Each one also appears inside the article it belongs to, and runs entirely in your browser, so drag, poke, and break it.

Portrait of Sachin Gupta rendered in binary

Cache and database start in sync; a write updates the database but not the cache, so reads return a fast, confident, wrong answer. The fix: delete the cache key on write, so the next read refetches.

Stale reads, and the fix: delete on writeauto
in syncnow staleinvalidaterefilled
readcachev1databasev1serves v1: correct

Cache and database agree: both hold v1. Reads hit the cache and get the right answer, fast.

The cache key carries a version. When data changes you bump the version instead of editing in place; readers ask for the new key (miss, fill fresh) while the old one is orphaned and ages out. No stale window.

Versioned keys: bump, do not editauto
readers ask foritem:42?v=1current version: v1
item:42?v=1active, fresh
item:42?v=2

The cache key carries a version: item:42?v=1. Reads ask for it, hit, and get fresh data.

A hot key expires and every request misses in the same instant, all flooding the database at once. Not steady load, a synchronized spike that can take the database down on its own.

The stampede: everyone misses at onceauto
requestscachecached, TTL tickingdatabaseidle

The hot key is cached, so all five requests hit it, cheap and fast. The database is idle.

Visualizers — Sachin Gupta