Codelays: Design architectures that survive production
Build with real components like load balancers, Redis, Kafka and PostgreSQL. Send real traffic through them, inject real failures, and fix the incident before your users notice. No code required.
107 problems from real production incidents, 8 topics with hands-on labs, 52 components.
Topics
Problems
- URL Shortener — Easy — A read-heavy redirect service loses its cache. Watch the database melt.
- YouTube: Viral Video — Medium — A video goes viral: 4× traffic and an exploding transcoding backlog.
- Uber: Rush Hour — Hard — A poison message stalls ride matching, then rush hour doubles traffic.
- Payment System — Hard — A third-party fraud API slows down and drags the whole payment flow with it.
- WhatsApp: Message Delivery — Medium — A flaky network link to Kafka, then a Cassandra compaction storm.
- E-commerce Flash Sale — Hard — Black Friday: 5× traffic, and every order hits a single MySQL primary.
- Twitter: Celebrity Tweet — Medium — A celebrity tweets: traffic doubles and one Redis key gets half of all reads.
- Ticketmaster: Stadium Tour On-Sale — Hard — The biggest tour of the year goes on sale at T+20s: six times the fans, a scalper botnet, and every seat of the show in one database partition. Be ready before the doors open.
- Notification Service: Breaking-News Push — Hard — A breaking story multiplies notifications by eight for the rest of the hour, then the SMS vendor browns out. Alerts must still land within a minute.
- Dropbox: Monday 9 a.m. — Hard — Monday morning: sync traffic ×2.5, uploads ×2.5 — and at T+90s the metadata primary dies. Every request counts, so the system must be ready before nine.
- Netflix: Season Premiere at Midnight — Hard — Midnight premiere: five times the viewers, every edge cold for the new episode, an origin that cannot scale — and then recommendations slow to a crawl.
- Search Autocomplete: The Name Everyone Types — Hard — News breaks: searches triple, a third of them start with the same name, and the trending pipeline floods the index with updates. Suggestions must stay fast and fresh.
- Live Leaderboard: The World Final — Hard — The world final starts: four times the spectators on live connections, twice the score updates, and the final’s leaderboard becomes the hottest partition in DynamoDB.
- Ad Click Aggregator: The Big-Game Commercial — Hard — A commercial airs to 100 million viewers: clicks ×6 for the rest of the hour, and then every advertiser opens the live dashboard at once. Two consumer groups, one shard limit, one analytical database.
- DoorDash: Friday Dinner Rush — Hard — Dinner rush triples orders for three minutes — more writes than the orders primary can take — and halfway through, the payment provider browns out.
- Stock Exchange: The Opening Bell — Hard — At the opening bell order flow doubles for a minute and four times the retail users stream quotes. Orders must be acknowledged within 45 ms at p99, and nothing can boot in time.
- Booking.com: Holiday Search Surge — Hard — Holiday deals go live: searches ×5. The search index, the search tier’s threads and the availability database’s connections all run out — each for a different reason.
- Slack: The All-Hands Announcement — Hard — The CEO posts in #general: everyone comes online at once, #general becomes the hottest partition in Cassandra, and then a zone of the gateway fleet disappears.
- E-commerce Checkout: The Gray Zone — Hard — Zone B’s network starts dropping packets — health checks still pass — and the inventory service slows down behind three layers of retries.
- Instagram: The Celebrity Post — Hard — A celebrity posts a photo: one image takes 70% of image traffic, and the post’s reads and likes all land on one Cassandra partition — likes cannot be cached.
- Web Crawler: When the Web Slows Down — Hard — The sites you crawl slow to 1.5 s per page and a transit link starts dropping packets. Your fetchers have idle CPUs and a growing frontier — and you cannot add machines.
- AI Assistant: Launch Day — Hard — The assistant goes viral: five times the questions, a vector database that cannot grow this week, an LLM provider with a hard quota — and then that provider slows down.
- LeetCode: Weekly Contest Start — Hard — The contest starts: eight times the coders for two minutes, every one opening the same four problems and submitting — and each submission holds a serverless execution for its whole judge run.
- Multi-Region: Losing us-east-1 — Hard — The primary region goes dark. The standby region has the data — but half the capacity, and its API still calls the identity service in the region that just died.
- Digital Wallet: Payday Friday — Hard — Payday: balance checks and transfers ×2.5 on a distributed SQL ledger with a per-node connection limit — then the bank’s top-up API slows to a crawl behind two retries.
- Datadog: The Agent Reconnect Storm — Hard — A network blip ends and a million agents flush their buffers at once — while every engineer opens the same dashboards to see what happened.
- Stripe: The Noisy Tenant — Hard — One integration starts a runaway backfill at 15× its normal rate, and then the identity provider that validates every API key goes down for fifteen minutes.
- Planned FLUSHALL — Easy — A key-format migration will flush Redis in 20 seconds. Postgres can absorb a fifth of the reads — not all of them.
- Celebrity in 15 Seconds — Easy — In 15 seconds a celebrity posts and 70% of reads ask for one key. Adding Redis nodes cannot save the node that owns it.
- Launch Day, One Hot Item — Easy — A launch multiplies catalog reads by 5 and half of them ask for one item. A Redis cluster tops out below the load at any size.
- The CMS That Cannot Scale — Easy — In 40 seconds a reindex job multiplies reads 8×. The vendor CMS serves 22,000 requests/s — and that is all it will ever serve.
- GameDay: Lose a Zone — Easy — The chaos team takes down a zone at T+20s. The session grid rejects what it cannot hold, and restarting it logs everyone out.
- The Primary’s Disk Is Dying — Easy — SMART errors say the primary’s disk will fail within a minute. A restart is 30 s of total outage; a failover is 6 s — still too long on its own.
- Replicas Don’t Take Writes — Easy — A flash sale triples orders for 90 seconds. MySQL’s primary is the only node that can write — and it has 151 connections.
- One Seller, One Shard — Easy — Traffic doubles and 15% of all writes go to one viral seller, whose listings live in one chunk range. Doubling the shards is nowhere near enough.
- Readers on Demand — Easy — A deploy will change the cache key prefix at T+20s: every read misses for a minute. Aurora can add readers in moments — if you add enough.
- Search Goes Prime Time — Easy — A TV spot quadruples searches. Primary shards are fixed at index creation, indexing keeps running, and search-api’s threads wait on every slow query.
- Too Many Parts — Easy — Every service inserts its events into ClickHouse one row at a time. A traffic spike doubles the inserts and the merges cannot keep up.
- The Supernode — Easy — A celebrity joins and half of all friend-of-friend traversals touch their node. Adding cluster members barely raises the ceiling.
- The Devices Come Back — Easy — A regional network outage ends and a million sensors flush their buffers at once — 4× the normal write rate, with firmware that retries three times.
- The Chatbot Went Viral — Easy — The support chatbot trends on social media: 6× the questions, most of them the same few. Each answer needs a 30 ms nearest-neighbour search.
- Month-End Close — Easy — Month-end: five times the BI queries, each taking seconds. The warehouse queues, then the BI API runs out of threads waiting on it.
- More Members, Same Leader — Easy — A fleet-wide rollout floods etcd with status writes. Every write goes through one leader and a quorum — adding members will not help.
- Poison Pill — Easy — One malformed order is retried forever and the order pipeline stops moving — but every API call still succeeds.
- Two Consumer Groups — Easy — The analytics consumer crashes. Orders keep flowing — but analytics falls minutes behind.
- Idle Consumers — Easy — Traffic doubles. Autoscaling adds consumers, CPU looks fine — and lag keeps growing.
- Producers Rejected — Easy — A flash sale doubles writes and a third of checkouts fail at publish time. The consumers are idle.
- Absorb the Burst — Easy — A one-minute burst of writes overloads the database. There is no Kafka yet — add it.
- Publishers Blocked — Easy — Order placement starts failing — at the API. Nothing is wrong with the API: RabbitMQ hit its memory alarm because the consumers slowed down.
- Two Million Records, One Afternoon — Easy — A partner dumps 60× its normal import volume for two and a half minutes. The Lambda importers hit their concurrency limit and the partner’s retries make it worse.
- ProvisionedThroughputExceeded — Easy — A firmware update makes 2M devices report 80% more often. The stream’s shards throttle — and every rejected device retries three times.
- Lose the Local Cluster — Easy — The local Pulsar cluster goes down mid-day. A geo-replicated cluster in the other region is healthy — but nothing publishes to it.
- Twelve Seconds to the Open — Easy — The market opens in 12 seconds and order flow will double. The risk engine cannot scale in time, and the gateway’s p99 budget is 45 ms.
- Firehose on GCP — Easy — A live show doubles an 80,000 events/s clickstream for a minute, 12 seconds from now. The enrichment service cannot scale in time, and you run on GCP.
- Drain Without Drowning — Easy — A seller bulk-upload floods the order queue for 90 seconds. The workers must catch up within 100 seconds — and their autoscaler is about to drown the database shoppers read from.
- Every Click Is a Row — Easy — A campaign doubles the clickstream. The writer inserts one ClickHouse row per click, ClickHouse falls behind — and the lag never stops growing.
- Gray Failure — Easy — The network to pool B drops 85% of packets. Every instance there is healthy, so the health checks keep sending it half of all traffic.
- Skip the Hop — Easy — A webhook burst triples traffic for a minute. The ingest service in front of SQS cannot boot new instances in time — and partners retry every failure twice.
- The Canary Is Coughing — Easy — Half of traffic runs the new release, and its new dependency just slowed down. v2 fails about a third of requests — not enough to trip a breaker, plenty to break the SLO.
- The Load Balancer Is the SPOF — Easy — GameDay at peak: the chaos team kills one zone while a launch adds 50% traffic. Your single HAProxy lives in that zone.
- One Partner, Everyone’s Outage — Easy — A partner’s batch job hits the API at 15× its usual rate. The shared backend saturates and the premium partners fail with it.
- Connections, Not Requests — Easy — A live final brings 3× the viewers online — and 15 seconds in, a zone drops half of the gateway fleet. CPU stays low the whole time.
- Idle CPU, Full Threads — Easy — The payment vendor gets 10× slower. checkout’s CPU drops, the autoscaler scales nothing — and a quarter of the requests are rejected.
- Cold-Start Cliff — Easy — A push notification sends 8× traffic in one second. Lambda scales — but every new execution spends seconds in a cold start.
- Retries All the Way Down — Easy — The inventory vendor slows down for 30 seconds. The app retries 3×, the Envoy sidecar retries 3× — and the outage outlives the blip.
- The Reindexer Ate the Catalog — Easy — An internal reindex job calls catalog-api 40× harder than usual. Shoppers share the same API and database — and the job’s client retries every 429.
- Vendor Brownout — Easy — The payment processor slows to 1.5 s and loses half its capacity. You cannot fix it, cannot skip it — and every order needs it.
- Auth Is a Total Outage — Easy — Every request validates its token with the auth service. Its database migration will take it down at T+70s — and 12 seconds without auth is 12 seconds without a product.
- Logs in the Hot Path — Easy — Every event the API ingests writes a log line to Elasticsearch synchronously. The log cluster slows to 200 ms — and so does every request.
- Trace Everything — Easy — Every request exports its trace synchronously at 100% sampling. A spike triples traffic and the tracing backend cannot ingest it — so requests fail.
- A Metric per Request — Easy — The API pushes one metric sample per request to Prometheus. A spike quadruples traffic, Prometheus saturates — and the pushes fail the requests.
- Autoscaling Ate the Database — Easy — A promo ×2.5 makes the API autoscale — and every new instance opens 20 Postgres connections. Raising max_connections makes Postgres slower, not faster.
- Three Hundred Seats at MySQL — Easy — A traffic spike autoscales orders-api past MySQL’s 300 connections. A proxy fixes the count — but with its default pool it caps throughput below the load.
- Reshard Under Load — Easy — A write-heavy spike needs three times the primaries. Vitess can split shards online — and vtgate’s pool becomes the next bottleneck.
- One Viral Video — Easy — A clip goes viral: traffic doubles and 70% of it asks for one object, which lives on one Varnish node. More Varnish nodes barely move the ceiling.
- Above the CDN’s Limit — Easy — A launch pushes static traffic 60% over your CDN contract. The CDN cannot be scaled, and every extra miss lands on an S3 bucket already near its limit.
- Evacuate the Region — Easy — us-east-1 goes dark. A full standby stack runs in us-west-2 — but every user’s app is pointed at us-east.
- Credential-Stuffing Botnet — Easy — A botnet sends 1.6M login attempts per second at your load balancer. Real users drown — and nothing behind the uplink can drop the flood in time.
- Uploads Through the API — Easy — Every 200 MB video upload holds an API thread for 1.5 seconds. Upload traffic is about to multiply by 2.5 — and new instances take two minutes to boot.
- The Live Chat Room — Easy — A live event doubles chat traffic and a third of it lands in one room’s partition. More Cassandra nodes cannot spread one partition.
- Writes That Postgres Couldn’t Take — Easy — A promo doubles write-heavy traffic and the API autoscales into the per-node connection limit. Every CockroachDB node is a writer and a gateway.
- Throttled at 30,000 RCU — Easy — A flash-sale item makes 40% of reads and writes hit one partition key. Reads and writes throttle separately — and raising RCU makes the reads worse.
- Cloudflare: The Regex That Took Down the Edge — Hard — A managed WAF rule with a catastrophic regex pins every edge CPU, and half a minute later a botnet notices. You have seconds — and the WAF cannot simply be switched off for everyone.
- AWS S3: The Day the Object Store Went Dark — Hard — The region’s object store goes down for fifteen minutes. Three different parts of your system depend on it — one of them is your status page — and nothing new can boot.
- Fastly: When the CDN Disappeared — Hard — Your only active CDN returns errors worldwide. A second CDN is under contract but cold, the origin can serve a fifth of the traffic, and every second counts.
- Slack: Return-to-Work Monday — Hard — The first Monday after the holidays: logins ramp from 8:50, everyone is back at 9:00, instances take three minutes to provision and the transit network starts dropping packets.
- GitHub: Forty-Three Seconds — Hard — A 43-second partition made the database fail over to the other coast. Every query now crosses the country, the new primary is still catching up — and background jobs want the same write capacity as users.
- Netflix: Christmas Eve — Hard — On Christmas Eve the primary region’s load balancers lose their state. The other region has half the instances, a cold cache, a small recommendations fleet — and two seconds to take everyone.
- Roblox: The Service Registry Meltdown — Hard — The service registry every call depends on slows to a crawl, health-check agents keep writing to it, and restarting it does not help. Players must keep playing.
- AWS us-east-1: The Endpoint That Vanished — Hard — The regional database endpoint stops resolving. Two services depend on it, the replica is 75 ms away, and nothing new can launch until the database is back.
- Microservices: The Cascade — Hard — A deploy drops an index: one database gets slow. Three layers of retries, timeouts below the new latency and a non-critical dependency on the critical path turn it into a full outage.
- Pokémon GO: Fifty Times the Plan — Hard — Launch day brings eight times the worst case you planned for. Clients retry three times, one park has every spawn, the world database is write-bound and map tiles melt their API.
- Fortnite: 3.4 Million Concurrent — Hard — A new season launches: three times the players at once. The profile database runs out of write capacity, the presence service out of connections, and every login hammers the token service.
- Hotstar: Twenty-Five Million for the Final Over — Hard — A cricket final: traffic doubles at the toss and jumps fivefold when the star walks in. Autoscaling is minutes too slow, ranking cannot scale at all, and everyone reads the same live score.
- Coinbase: The QR Code Commercial — Hard — A bouncing QR code during the big game: a hundred times the visitors for one minute, sign-ups calling a slow identity vendor, and existing customers checking prices at the same time.
- Healthcare.gov: Launch Day — Hard — Six times the expected visitors on day one: plan browsing that was never cached, a synchronous identity vendor, a data hub that waits on three agencies, and an autoscaling tier with a fixed database.
- Shopify: The Celebrity Flash Sale — Hard — A celebrity’s product drop brings eighty times their usual traffic onto the shared platform. No other merchant may notice, no fan’s order may be lost — and the drop starts in one minute.
- Black Friday: The Whole Day — Hard — Doors open at T+150s — and then the payment provider browns out, the catalog cache crashes and a zone disappears, one after another. Instances take two minutes to boot. One plan has to survive all of it.
- Cutover Night: Migrating the Core — Hard — Move all traffic from the legacy core to the new stack tonight. The new stack is cold, its first real traffic exposes a latent bug, the morning starts at T+240s, and the legacy hardware is switched off at T+300s.
- The Outage Is Over — Now Bring It Back — Hard — The database comes back after ten minutes down — cold, at half capacity. Two million devices flush their offline queues at once, the cache has expired, and the backlog must be gone before the next shift. Recover too fast and you are down again.
- Uber: New Year’s Eve at Midnight — Hard — At midnight, five times the riders open the app in the same few city blocks, drivers double their pings, surge prices update on one hot partition — and the payment provider throttles. You know exactly when it starts.
- Betting Exchange: The Last-Minute Goal — Hard — A goal in the last minute: six times the punters for forty seconds, all on one market, with a 120 ms latency budget. Nothing boots in time, the ledger cannot grow, and a lost bet is a regulatory incident.
- Active-Active, Half-Broken — Hard — Two regions share the traffic. East starts dropping packets to its database — health checks stay green — the evening peak arrives, and then West’s cache restarts. Moving everyone to West is the trap.
- Inference Platform: The GPU Shortage — Hard — A viral demo quintuples the free tier, a customer starts a batch backfill, and then half the GPUs disappear for ninety seconds. There are no more GPUs anywhere — and the paid customers have an SLA.
- Social Network: Election Night — Hard — Results night: three times the readers, five times the posts, half of all timeline reads on two candidates, and the push provider slows down. Fan-out, hot keys, search and notifications all at once.
- Payments: The Hot Merchant Account — Hard — A merchant goes viral: payments double and a third of them update one balance row. Then the fraud vendor browns out, and month-end reconciliation starts scanning the ledger. Every payment must be exact.
- SaaS: The Enterprise Onboarding — Hard — Your biggest customer ever starts importing ten years of data on a Tuesday afternoon — on the shared stack — while half your customers’ webhook endpoints slow down. Existing tenants must not notice.
Codelays runs in your browser: turn on JavaScript to use it.