How the lessons are tested
An animation can be internally consistent and still teach the wrong behavior. So the lessons' scenarios also run against the real software, configured with the exact snippet the lesson shows, and a test fails whenever the animation and the real program disagree.
nginx 1.31.6HAProxy 3.4.6Redis 7.2.5PostgreSQL 14.15MySQL 9.2.0Node 22.22.0Chrome 154OpenSSL 4.0.2OpenJDK 18.0.2.1
A test takes a lesson step, say “web-2 crashes under load”, and runs it through the lesson's own simulation, the code that draws the animation.
The same step runs against real nginx, HAProxy, Redis, PostgreSQL, MySQL, Node or Chrome, using the config printed in the lesson. The only edits are mechanical: example IPs become local ports, certificates become a throwaway test one.
Status codes, ordering, timing, which server got what. When they disagree, the lesson changes, not the test. Snippets that pass carry a tested on … badge.
The animation said users get 502 Bad Gateway while a crashed server is still in rotation. Real HAProxy answers 503 Service Unavailable, after retrying the dead server three times, a second apart.
The animation now shows the three retries, then the 503.
Crashing a server in the playground produced a steady stream of errors. Real NGINX, running the exact config the playground shows, served every request: it retries the next server and skips the dead one for 10 seconds.
The playground now fails over the way NGINX does, and all servers down gives 502, as on the real thing.
Three nginx.conf examples used listen 443 ssl without a certificate. nginx refuses to start with that config.
Added the ssl_certificate lines.
The HAProxy example had no balance line. Since HAProxy 3.3 the default is random, not the least connections the animation shows.
The example now says balance leastconn.
NGINX’s ip_hash only reads the first three numbers of an IPv4 address, so Alice and Carol (both 198.51.100.x) always land on the same server.
The lesson says so next to its simplified hash.
The nginx example said a 10 MB zone remembers about 160,000 client IPs. Fed 200,000 addresses, real nginx kept about 81,000: each entry takes 128 bytes on a 64-bit machine.
The note now says about 80,000.
The retry example multiplied Retry-After by 1000. When the header is an HTTP date, which the lesson says it can be, that gives NaN, and the client retried at once instead of waiting.
The example now handles both forms, and runs against servers that send each.
The CDN lesson animates stale-while-revalidate: a stale copy goes out at once while the edge checks with the origin (a 304). Real nginx, with the edge config as printed, re-downloaded the whole file and made the visitor wait.
Added proxy_cache_revalidate and proxy_cache_background_update. With them, nginx matches the animation request for request.
The animation keeps a no-cache response and revalidates it before reuse. nginx never stores a no-cache response at all: every request went to the origin in full.
The lesson now says caches differ here, and what nginx does.
The same missing certificate broke examples in the CDN and TLS lessons, and all 8 configs the HTTP versions playground can print: nginx refused every one.
Added the certificate lines; all 8 now load.
The note said plain hash (without consistent) remaps nearly every URI on any server change. Editing the server list moved about 4 in 5, but a crashed server that stays in the list only lost its own keys.
The note now says both.
The lesson said tasks run first come, first served. In real Chrome, a click that arrived after a timer had come due still ran before the timer: browsers favor input.
The text and the simulation now let a waiting click go ahead of timers, as Chrome does.
The lesson said scheduler.yield() does the job "even better". Running the lesson’s own code in Chrome, clicks did get through and the work finished sooner, but only 34 to 39 of 90 frames were painted.
The lesson now states the trade-off. The simulation also clamped nested timers one call too early; it now matches Chrome.
The MutationObserver example never fires: it creates the observer but never calls observe(). The cheat sheet’s “nextTick runs before promise microtasks” is also false in an ES module.
Added the observe() call and reworded the cheat sheet.
The note said Math.imul(h, 31) reproduces Java’s String.hashCode(). On its own it doesn’t: for "xfjfxtz" it gives 2147483668, Java gives -2147483628.
The note now shows the full expression, which matches Java on every test string.
This step exists to show async replication losing a confirmed write when the leader crashes. Run headlessly, the animation lost none: the follower was never far enough behind. A real async PostgreSQL pair lost 2 confirmed writes in the same crash.
The follower now lags as a real one does, so the crash always loses a write.
This step shows a reader seeing time go backwards when refreshes hit different followers. The animation could never do it: its lag was shorter than the time between refreshes. Real followers did (125 → 105 → 125).
The lagging follower is now far enough behind that it happens, several times a minute.
The pg_rewind command, as shown, brought the old leader back as a writable leader again: a second split brain.
Added --write-recovery-conf, and a note that pg_rewind needs wal_log_hints (or checksums) set before the failover.
MySQL refused to start with the semi-sync settings as shown: the plugin has to be loaded first.
Added the plugin-load-add lines for the source and the replica.
Two MySQL leaders with the lesson’s settings took two concurrent deposits and ended at different balances (120 and 150), with no error anywhere. MySQL doesn’t resolve conflicts.
The note now says so.
The two-phase commit step said anything that touches the locked rows is stuck. In PostgreSQL a plain SELECT came back in 2 ms, with the old balances.
It now says writes are stuck and plain reads still see the old balances.
The caching playground prints a live redis.conf. Real Redis refused to start with it: redis.conf doesn’t allow a comment after a setting, and a SET command sat among the settings.
Comments now sit on their own lines. All 576 configs the playground can print start a real server.
The lesson evicts by exact LRU. Real Redis samples a few keys instead: on the lesson’s ten reads, 30 runs with the default settings gave 15 to 17 different outcomes, and only 1 matched the lesson. Some evicted a key the moment it was written.
A new aside shows what Redis actually does, and that raising maxmemory-samples to 10 made every run match.
Redis has no FIFO policy, and the playground stood in allkeys-random, whose hit ratio swung between 56% and 62.5%. Measured instead: volatile-ttl with the same TTL on every key matched FIFO in 8 of 8 runs. The LFU example’s counter numbers were off too.
The playground now uses volatile-ttl for FIFO, and the LFU comments show measured counts: about 10 after 100 reads, 255 by a million.
The Redis example said small hashes stay a flat list up to 128 entries “because that is faster”. Redis 7.2.5’s default is 512, and the flat list isn’t faster: it uses a third of the memory and slows down as it grows.
The example now shows 512 and says what the flat list really buys.
Open a lesson to see each comparison: what the real program did, next to what the lesson shows.