Challenges
Grow one design through linked stages. Each stage adds traffic or limits. A final hidden test ends the run.
Exactly-once streams
Ad click aggregator
Ingest 1M clicks/s, count them per minute on hot ads, wait for late events, write each settlement exactly once, and serve the totals to advertisers.
- Ingest 1M clicks/s
- Hot ad counters
- Wait for late events
- Exactly-once writes
- Advertiser dashboards
- Final test
Real-time ML
Card fraud detection
Score every card payment before it reaches the card network. Start with rules, move to a model, give it features as of the payment time, set its threshold with money, and retrain it when attackers change.
- Rules at 5,000 payments/s
- A better model in 50 ms
- Features as of the payment
- One threshold per stream
- Retrain when attacks change
- Final test
Cost, latency and capacity of LLM serving
Chat assistant
A chat assistant answers users with a language model. Start with a hosted model and its token bill, stream the answer, self-host on GPUs, add long documents, then survive a viral spike with a router and a fallback.
- Pick a tier and cache the prefix
- Stream the first token
- Own GPUs for quality and cost
- Long documents and KV memory
- Router, fallback and a viral spike
- Final test
Sandboxed execution
Code judge
Judge contest submissions. Queue the test runs, run untrusted code in a sandbox, survive the final rush, and share the judges between contest and practice.
- Queue the test runs
- Run code in a sandbox
- The contest rush
- Share the judges fairly
- Final test
Agent reliability
Coding agent
An agent that fixes issues in a code repository: it calls a model and tools in a loop. Make it run its steps, run generated code in a sandbox, survive a crash, stop tasks that never end, and wait for a person before it merges.
- A step runner for the agent loop
- Run generated code in a sandbox
- Resume after a crash
- Cap the tries
- Approve before merge
- Final test
Custody and withdrawals
Crypto exchange
An exchange credits deposits after enough confirmations, keeps most funds in cold wallets, signs withdrawals with approvals and survives a bank run. Tune each chain, wallet and approval.
- Confirmations per chain
- Hot and cold wallets
- Approvals on the hot wallet
- A bank run
- Final test
Fan-out and message storage
Discord: giant servers
Serve a server of 1M members. Load member lists by window, fan out late, store messages by channel and time, and cool a hot channel in a live event.
- Load a window, not the list
- Fan out late
- Store messages by channel and time
- A hot channel in a live event
- Final test
Real-time media over UDP
Discord: voice
Run voice rooms over UDP. Replace a mesh with an SFU, keep the playout queue short, put a server in each region, and relay only the users behind strict firewalls.
- Voice through an SFU
- The playout queue
- A voice server per region
- Relay only the stuck users
- Final test
ML serving with fresh features
DoorDash: ETA
Serve delivery time predictions for a food delivery app. Run the model fast and cheap, keep its features fresh, retrain it when the weather changes, and test a new model on live traffic.
- Serve in 50 ms
- Fresh features
- Retrain on rain
- Shadow a new model
- Final test
Chunking, dedup and conflicts
Dropbox: sync
Sync files between devices. Send data straight to storage, cut files into blocks, tell devices about changes by push, keep both sides of a conflict, and keep the egress bill in check.
- Whole-file uploads
- Blocks and dedup
- Change notifications
- Conflicting edits
- Egress bill
- Final test
Keys across devices
Encrypted chat
An encrypted chat app: serve prekeys for offline phones, link a new device with its history, rekey groups in batches, and back up chats so that no server key can read them.
- Prekeys for offline phones
- A new device and its history
- Rekey in batches
- Backups nobody can read
- Final test
Real-time state sync
Multiplayer game
Run a 64-player game. Send ticks over UDP, shrink snapshots, queue the joins of a match, and put a server in each region.
- Send ticks over UDP
- Snapshots on a diet
- A waiting room for matches
- A server in each region
- Final test
Real-time collaboration
Google Docs: collaboration
Autosave 45,000 edits/s on sharded stores, merge edits from two data centers, throttle cursors under a bandwidth cap, absorb an offline reconnect wave, and serve one viral document.
- Autosave at scale
- Merge live edits
- Presence under a cap
- Offline reconnect wave
- One viral document
- Final test
Image storage pipeline
Instagram: photos
Store, resize and serve photos at the scale of 10B. Keep photo bytes off the API, resize in the background, serve from the edge and read cold originals without duplicates.
- Upload path
- Resize in the background
- Serve from the edge
- Cold originals
- Final test
Time-series ingestion
Metrics platform
Take in 500,000 samples/s, keep 90 days within the disk, downsample in the background, isolate a noisy team and answer alert queries fast.
- Ingest 500,000 samples/s
- Keep 90 days in the disk
- Downsampling needs CPU
- Limit a noisy team
- Alert queries
- Final test
Retrieval and ranking
Music recommendations
Recommend tracks on a home screen for millions of listeners. Start with a popular list, then retrieve candidates with a two-tower model, rank them, keep listening features fresh, and give new tracks a chance to be heard.
- Serve the popular list
- Two-tower retrieval
- Rank the candidates
- Fresh listens
- Give new tracks a chance
- Final test
CDN placement and pre-positioning
Netflix: edge
Stream 10,000 viewers from the edge. Cache segments, put an edge in each region, fill the edge stores inside a night window and steer viewers around a lost edge.
- Cache segments at the edge
- An edge in each region
- Fill the edges at night
- Steer viewers around a lost edge
- Final test
Multi-channel delivery
Notification service
Send push, email and SMS through providers with hard limits. Absorb bursts, honor preferences, retry without double sends, and keep urgent traffic ahead of campaigns.
- Providers have limits
- Check preferences first
- Retries and duplicates
- Share the provider
- Final test
Retrieval quality and latency
RAG support bot
Answer support questions from 10,000 help articles with a language model. Make retrieval find the right text, keep cached answers fresh when articles change, test releases without hurting users, and fit it all on two GPUs.
- Retrieve before you answer
- Hybrid search and a reranker
- Fresh answers when docs change
- Run evals off the live path
- Only two GPUs
- Final test
Distributed counting
Rate limiter service
Protect a shared API from one noisy key. Start with one token bucket, then run several limiters without losing the count, split the limit between two regions, and keep the limits up when a limiter fails.
- One token bucket
- One count for many limiters
- A limit per region
- When a limiter fails
- Final test
Crawling and inverted indexes
Web search: crawl and index
Crawl the web politely, skip URLs you know, build an inverted index in a batch window, and answer 36,000 queries/s from a sharded index that survives the loss of a box.
- One pace per site group
- Bloom filter for seen URLs
- Build the index in parallel
- Shard the index, keep two copies
- Final test
A game backend under tight limits
Ship Cogore
Run a small game backend with tight game limits. This is an exercise, not the real Cogore layout. Serve the site, verify runs, sync boards, survive the daily drop and keep a backup.
- Site at the edge
- Verify the runs
- Sync and snapshots
- The daily drop
- Backups and RPO
- Final test
Inventory reservations
Online shop: flash sale
Sell a limited product in a flash sale. Keep stock in a database, split the hot product row, make every reservation survive a node loss and charge each order once.
- Stock in the database
- One hot product
- Durable reservations
- Idempotent orders
- Final test
Bandwidth and CDN
Spotify: playback
Stream audio to 50,000 listeners on a budget. Share the catalog load, cache in two tiers, fit 4G phones, keep downloads off the stream path and survive an album drop.
- Share browse load over two boxes
- Two cache tiers for the library
- Phones on 4G
- Downloads get their own path
- Album drop
- Final test
Yearly batch analytics
Spotify: Wrapped
Build a yearly summary pipeline. Log billions of listens, roll up a year of data before a deadline, serve 500 million summaries, and render share cards before launch.
- Log the listens
- Roll up the year
- Serve 500M summaries
- Render before launch
- Final test
Finality in payments
Stablecoin processor
Take stablecoin deposits from two chains: index blocks within a provider quota, credit only after finality, send payouts in nonce order, and ride out a provider outage.
- Follow the chain
- Credit when final
- Payout order
- Two chains
- Final test
Deterministic low latency
Stock exchange
Build an exchange in four steps: an order gateway on one host, a journal that survives engine restarts, market data for 8 subscribers, and a trade store with a standby.
- Order gateway
- Order journal
- Market data
- Trade store
- Final test
Idempotency and ledgers
Stripe: payments
Charge cards once with idempotency keys, post double entries on a hot account, deliver signed webhooks, reconcile a bank file, and ride out a card network outage.
- Idempotency keys
- Double-entry ledger
- Webhooks to merchants
- Reconciliation
- Card network outage
- Final test
Contention and waiting rooms
Ticketmaster: the drop
Sell 60,000 seats to 2M fans at 10:00:00. Serve the seat map, never sell a seat twice, hold the crowd in a waiting room and keep the bots out.
- Seat map reads
- No double sales
- Waiting room
- Bot defense
- Final test
Microseconds over distance
Trading link: Chicago to New Jersey
A trading firm sends orders to the futures exchange near Chicago and to the stock exchanges in New Jersey, 1,190 km away. Each stage takes microseconds or milliseconds off the order path, and the last one keeps the orders flowing in a storm.
- Colocate the order gateway
- Fiber to New Jersey
- Microwave towers
- Rain fade and fast failover
- Final test
GPU fabric and failures
GPU training cluster
Train a 30B model on 5 servers of 8 H100. Each stage asks more of the cluster: fit the model, spread it over the rails, save it without stalls and keep a long run alive.
- Fit the model in one server
- Data parallel on the rails
- Checkpoints without stalls
- A straggler and a failed server
- Final test
Live video latency
Twitch: live
Carry live streams to millions of viewers. Give the ladder to top streams, purge playlists, pay for low latency and keep chat in order.
- Give the ladder to top streams
- Purge the playlist
- Pay for low latency
- Keep chat in order
- Final test
Per-keystroke latency
Search box: typeahead
Show 10 suggestions on every keystroke. Index the lookups, answer repeats from memory, cache near the users and keep trending lists fresh within a minute.
- Prefix index
- Answers from memory
- Edge cache
- Trending every minute
- Final test
Geospatial updates and matching
Uber: dispatch
Run the live core of a ride service. Take a million location pings, find the nearest drivers, give each ride one driver even when the network splits, and survive a stadium crowd.
- A million pings
- Nearby search
- One driver per ride
- Hot cell
- Final test
Ids and read-heavy redirects
URL shortener
Build a short-link service on three small boxes. Create links, hand out ids that never collide, answer 20,000 redirects/s from a cache, and count every click without slowing the redirects.
- Create and redirect
- Ids without collisions
- A cache for 100 reads per write
- Count clicks later
- Final test
WebRTC scaling
Video meetings
Scale video calls. Send video straight between two people, add an SFU for ten, give phones a low-quality copy, and run one media server per region.
- Call them directly
- An SFU for ten
- Two qualities for phones
- A media server per region
- Final test
Latency of a streaming voice pipeline
Voice agent
A phone agent listens, thinks and speaks. Build the chain of speech to text, model and text to speech, stream every stage, stop talking when the caller cuts in, and place a pipeline in each region.
- The serial turn
- Stream every stage
- Stop when the caller cuts in
- A pipeline in each region
- Final test
Delivery guarantees
WhatsApp: delivery
Deliver chat messages between phones. Hold 2M open sockets, keep messages for offline recipients, stop repeats, send to groups of 1,000, and give each of 4 devices its own copy.
- Sockets in memory
- Store and forward
- Receipts and repeats
- Groups of 1,000
- One copy per device
- Final test
Safe job delivery
Work queue
Build a queue for workers that run at the same time. Recover failed work and retain jobs that cannot finish. Keep the full design within 48 USD/mo.
- One owner
- Finish once
- Retry failed work
- Recover expired work
- Reject old receipts
- Retain failed jobs
- Final test
Fan-out on write or on read
X: home timeline
Build the home timeline of a social network. Gather it on read, then build it on write, then handle accounts with huge follower counts, and last fit the timelines in a memory budget.
- Gather on read
- Fan out on write
- Big accounts
- Timeline memory
- Final test
Media pipelines
YouTube: upload
Build the pipeline behind a video site. Send uploads straight to storage, dead-letter corrupt files, fan out the steps, restore cold videos and absorb a new viral video.
- Upload chunks straight to storage
- Dead-letter corrupt uploads
- Fan out the steps
- Restore cold videos on demand
- A new video goes viral
- Final test