Simulation lab
Each experiment isolates one engineering principle. Change a setting, watch the queue, latency and errors respond, and read why. Every run is deterministic, so you can repeat an experiment exactly.
Traffic model · 5 scenarios
One server drowning in traffic. Add a load balancer, more servers, health checks and auto-scaling, and watch the numbers respond.
“Spreading requests across several servers raises total capacity and removes the single point of failure — but only if the balancer knows which servers are healthy.”
Step-by-step sequence · 2 scenarios
Follow one click from the address bar to pixels on screen — every lookup, handshake, request and response, with its real cost in round trips.
“Most of a page load's time is spent waiting for messages to cross the network, so removing round trips matters more than making the server faster.”
Step-by-step sequence · 2 scenarios
Watch a resolver find the address for a name by asking the root, the top-level domain and the domain's own name server — then answer instantly from cache.
“DNS scales because it is split into a hierarchy that delegates authority, and because answers are cached for as long as their TTL allows.”
Traffic model · 2 scenarios
A database that cannot keep up with reads. Put a cache in front of it, tune size and TTL, then survive a cache stampede.
“Most reads ask for the same few items, so a small, fast copy of them absorbs most of the load — until it empties all at once.”
Traffic model · 4 scenarios
Viewers spread across a continent, one origin data centre. Turn on edge caching and watch latency, origin load and cost change.
“Serving popular content from servers near the user cuts latency and shields the origin, because most requests never travel that far.”
Step-by-step sequence · 3 scenarios
Watch the database find one row among a million, then a week of orders among fifty million — by reading everything, or by walking a B-tree.
“An index turns "read every page" into "follow a few pointers", but only pays off when the query matches a small share of the rows.”
Step-by-step sequence · 1 scenario
Count the round trips it takes just to start talking to a database, then see what a connection pool removes.
“Opening a database connection costs several network round trips and a server process; reusing open connections makes that cost disappear from every request.”
Step-by-step sequence · 3 scenarios
Crash an app halfway through a money transfer, sell the last ticket twice, and lock two transactions in a deadly embrace — then fix each one.
“A transaction makes a group of changes all-or-nothing, and locks make concurrent transactions take turns; both are only as good as the boundaries and the order you choose.”
Traffic model · 2 scenarios
A read-heavy app swamps its only database. Add replicas to spread the reads, wait for them to copy the data, then watch them fall behind when writes surge.
“Replicas multiply read capacity, but every replica must replay every write, so they never help with writes and can lag behind the primary.”
Traffic model · 2 scenarios
Sign-ups wait on a slow email provider until a queue takes the email off the request path. Then producers outrun the workers, and you choose between an endless backlog, rejecting work or slowing producers down.
“A queue lets a request hand slow work to workers and return at once, but it only absorbs bursts — if producers stay faster than consumers, something has to give.”
Traffic model · 2 scenarios
One buggy client floods an API and every user suffers. Give each client a token bucket at the load balancer, then size the bucket so real users' bursts still get through.
“A per-client token bucket caps each client's average rate while allowing short bursts, so one client can't use up capacity everyone shares — but set it below real traffic and you reject your own users.”
Traffic model · 2 scenarios
A slow payment provider ties up every app-server thread and takes the whole shop down. Contain it with a timeout, a circuit breaker and a fallback — then watch naive retries turn a short provider outage into one that never ends.
“A slow dependency is worse than a dead one, because waiting callers hold resources; timeouts and circuit breakers turn slowness into fast failures, and retries need backoff so they don't keep a struggling service down.”
Traffic model · 2 scenarios
Split one database's data across several shards. Shard orders by date and every new order lands on one shard; shard by user and the load spreads — until a celebrity's account overloads its shard anyway.
“Sharding multiplies capacity only if the shard key spreads the load; a key that sends new or popular data to one place leaves one shard on fire while the rest sit idle.”
Partitioned log · 2 scenarios
A Kafka-style topic split into partitions. Add consumers until some sit idle, crash one mid-stream, and watch keys keep an order's events in order — or not.
“A topic scales by splitting into partitions; each partition is read by one consumer per group, in order — so partitions cap your parallelism, and only events with the same key keep their order.”
Step-by-step sequence · 2 scenarios
Watch the messages a browser and a server swap before a single byte of the page moves — the TCP handshake, a lost packet being resent, and the TLS handshake that adds encryption.
“Every new connection pays round trips before any useful data moves, so the distance to the server, not its speed, sets the price of setup. Reusing and resuming connections removes that price.”
Step-by-step sequence · 1 scenario
Follow one request through the front door of a website. See where TLS ends, how the proxy picks a server by path, and what a cache hit at the proxy removes.
“A reverse proxy can only cache, route by path and filter requests if it can read them, so ending TLS at the proxy is what makes its other jobs possible.”
Step-by-step sequence · 1 scenario
A live cricket score changes three times in 30 seconds. Keep a phone up to date by polling, long polling or a WebSocket, and count the wasted requests and the delay.
“A browser that polls has to guess when news will arrive, so it either asks too often or hears too late; a WebSocket lets the server send news the moment it exists.”
Step-by-step sequence · 1 scenario
Save one price change with write-through, then with write-behind. Compare how long the admin waits, then crash the cache before it flushes.
“Writing the database before replying costs a round trip and a disk commit; replying first is faster, but the write lives only in cache memory until it is flushed.”
Step-by-step sequence · 2 scenarios
Rewind a database to the second before a bad DELETE, watch an untested restore eat the afternoon, then lose a whole region and fail over to another.
“How much data you lose depends on what you copied and where you kept it; how long you are down depends on what is already running and on whether you have practised.”
Step-by-step sequence · 1 scenario
Sign in, load a page twice, then sign out on another device. Compare a session looked up on every request with a signed token the server checks on its own.
“A session costs a lookup on every request but can be revoked at once; a signed token needs no lookup, so the server cannot take it back before it expires.”
Step-by-step sequence · 1 scenario
A shopping app's home screen needs data from three services. Watch an API gateway route, check tokens, enforce a rate limit and combine three calls into one, and count the mobile round trips.
“Every round trip over a mobile network is expensive and every hop inside the data centre is cheap, so a gateway that checks requests once at the door and fans out inside saves the phone the most time.”
Step-by-step sequence · 1 scenario
Place one order and watch in-process function calls turn into network hops when the app is split into services, then win the time back with parallel calls and a queue.
“Every synchronous hop adds a round trip to the request, so a chain of calls is as slow as its sum and only as available as the product of its parts; call independent services in parallel and move work the user need not wait for onto a queue.”
Step-by-step sequence · 1 scenario
Change your display name, refresh, and watch the old name come back when the read lands on a lagging follower. Then fix it three ways and see what each fix costs.
“A read only sees a write if it reaches a copy that already has it. Every fix either sends the read to such a copy or waits for one, and pays for it in latency or in load on the leader.”
Step-by-step sequence · 1 scenario
Three nodes keep one replicated log. Crash the leader, force a split vote or cut the leader off with a partition, and watch a majority elect a new leader for a new term.
“A Raft group acts only with a majority and numbers every leadership with a term, so a term has at most one leader and a cut-off old leader can never commit on its own.”
Step-by-step sequence · 1 scenario
Place one order that touches four services, each with its own database. Run it as a saga, run out of stock, lose a payment reply, then try two-phase commit and crash its coordinator.
“A saga commits one local transaction per service and undoes finished steps with compensating actions when a later step fails; two-phase commit keeps every step open and locked until one coordinator decides.”
More experiments — replication, sharding, queues, rate limiting, circuit breakers — are planned and will appear here as they are published.