Five chapters, five working machines — Go and Rust, no pseudocode, no diagrams pretending to be code. This page is the showroom, and every machine below is live. Mash the buttons. Break them. They'll tell you exactly what they're doing.
Three algorithms, one honest question: how hard can you hit it before it says no? Set the budget, then hammer the button. Watch the bucket drain, the window slam shut, the log age out.
| Implemented in the repo | What it costs you |
|---|---|
| Lua-atomic Redis counters | kills the INCR/EXPIRE race — one round trip, no lost writes |
| Fail-open on Redis outage | limiter down ≠ service down; requests pass, metrics scream |
| Per-key limiting | IP · API key · user ID, same interface |
| net/http + Gin middleware | Prometheus counters wired in behind both |
240 keys live on this ring. Kill a node and watch what moves — then look at what plain hash % N would have moved instead. That gap is the entire chapter.
Ring positions from CRC-style 32-bit hashing · owner = first virtual node clockwise · O(log n) binary search on a sorted ring · sync.RWMutex in Go, RwLock in Rust for read-heavy traffic.
64 bits, no coordination, no database round trip. Hold the button down and watch the sequence counter climb inside a single millisecond — that's the only thing standing between you and a collision.
Machine ID derived from the MAC address at boot · custom epoch · clock-skew guard refuses to move backwards · sequence overflow spins to the next millisecond rather than repeating.
Paste anything long. Watch it get Base-62'd down to seven characters, hashed onto a shard by the ring from Chapter 5, then resolve it twice — once cold from Postgres, once warm from Redis.
| Short | Shard | Clicks | Last lookup | |
|---|---|---|---|---|
| Nothing shortened yet — squeeze something. | ||||
Base-62 over an auto-increment id · consistent-hash sharding across 4 Postgres shards (yes, the Ch. 5 ring) · read-through Redis cache · click analytics with GeoIP · expiry + a token-bucket limiter on writes.
50,000 real English words, weighted by real Google web-corpus counts — not a fixture, not a random string generator. The radix trie answers exact prefixes in microseconds. Then misspell one on purpose and watch what forgiveness costs.
Radix trie over bytes · every node caches max_subtree_freq, so top-K skips any subtree that cannot beat the heap cutoff · one Levenshtein DP row carried down the walk, abandoned the moment its minimum exceeds the budget. Plain Levenshtein, not Damerau — so a transposition like recieve → receive costs two edits, and at a budget of one the trie hands you relieve instead.
Query path only. The RocksDB write-behind and the multi-tenant engine need a server and are not demoed here — see the chapter repo.