DEV Community

Cover image for There's a Judge for Algorithms. I Built One for System Design
Aditya Reddy
Aditya Reddy

Posted on Edited on AI-assisted

There's a Judge for Algorithms. I Built One for System Design

You draw the system, press Start, and a full day of traffic hits it in about two and a half minutes. Then it tells you what broke and what it cost.

TL;DR: I built System Designer, a free and open-source game for practicing system design in your browser. You pick a problem (82 of them, from 15 industries), draw the architecture with 99 parts, press Start, and a full 24-hour day of traffic runs through it in about two and a half minutes. Flash crowds at 7 pm, a database failover, bots, the works. Then the debrief scores uptime, speed, data safety and cost out of 1,000 and tells you in plain words where the points went. There's a daily challenge, and "beat my design" links for your group chat. You can play for free as a guest. Sign in to sync progress or post a score. Public guides and lessons show a preview and ask for an email to read the rest. Play it at systemdesigner.io.

Concert tickets go on sale at 10:00. This is what 25 times the normal traffic looks like.

Concert tickets go on sale at 10:00. This is what 25 times the normal traffic looks like.

Why I made it a game

For algorithms there's LeetCode. You get a problem, write code, a judge runs it and a few seconds later you know. System design has nothing like that. You read a chapter on caching, draw a load balancer and three boxes on a whiteboard, nod, and move on. Nobody ever sends 8x traffic at your three boxes at 7 pm to check if they hold.

That's the bit I wanted, so I built System Designer. Think of it as a judge for system design where the test case is a whole simulated day of traffic.

It covers the whole industry on purpose, link shorteners, bank ledgers, the login code your bank texts you. And it had to look good. Watching your own design light up and then go red when the flash crowd hits sticks with you way longer than a static diagram does.

Anyone can play it for free, whether you're a student, prepping for interviews, a senior engineer or a product person who just wants to know why the app went down last Friday. Got a good score? Send the link to a friend and make them beat it.

What a round looks like

Every problem walks you through five steps, roughly the order you'd answer a system design interview in.

  1. Clarify. You read the brief and tap questions. The answers matter. "A few hundred titles get most of the viewing" changes how you'd build a video service.
  2. Numbers. You guess the big figures on a slider. Peak requests per second, bandwidth, whatever the problem hinges on. Within 2x of the worked answer counts as a good guess, and then it shows you the math.
  3. Draw. Drag parts in and connect them. A cost meter ticks up as you go, and a little check tells you if it'll hold at peak.
  4. Traffic day. Press Start. The clock runs 00:00 to 24:00 with the problem's traffic curve and its events. At 1x the day is about two and a half minutes. You can pause, or push it to 8x if you're impatient.
  5. Debrief. You get a score out of 1,000, stars, and the story of each event.

A first try takes about 5 to 8 minutes and a retry about 3. Stuck? There are three levels of hints, they're free, and they don't touch your score.

Video streaming is a bandwidth problem

The Video streaming problem is "a video service like Netflix": 400 thousand subscribers, a peak of about 600 requests a second, and 80 percent of that is video chunks. The uptime target is 99.9 percent and the budget is $108,000 a month.

The Numbers step makes you do the math that actually matters here:

600 req/s x 0.8             = 480 video chunks a second
480 chunks x 2 MB           = 960 MB/s, about 7.7 Gbps
~0.5 GB/s average x a month = about 1,300 TB sent to viewers
Enter fullscreen mode Exit fullscreen mode

Through a CDN at about 4 cents a gigabyte, that's over $50,000 a month on bandwidth alone, before a single server (approx.). And the day isn't calm. There's a cache stampede at noon and a cost blowout at 21:00, and at 19:00 a new season drops and traffic goes to 8 times normal in 30 seconds.

This design puts a CDN in front of every viewer. When a video chunk misses, it goes to an origin shield, which merges misses from every edge so object storage sees one request per chunk and not thousands. App servers only handle sign-in, browsing and play events, with a cache and a read replica in front of the database. Before the day even starts the game projects about $78,406 a month plus usage, and says it holds at the normal peak and in the 8x flash crowd.

Traffic day at 19:06, in the middle of the flash crowd: 100% success.

Traffic day at 19:06, in the middle of the flash crowd: 100% success.

Every part has a bar that fills up as it gets busy. When one hits its limit it turns red and shows how many requests it's rejecting. At 19:07, right in the flash crowd, this design is at 100 percent success with a p99 of 249 ms.

What under-building looks like

The weak design at 19:06, six minutes in. The app servers are already turning requests away.

The weak design at 19:06, six minutes in. The app servers are already turning requests away.

Now the same problem with a weak design. Two app servers, object storage and one SQL database, no CDN. At 19:28, almost half an hour into the flash crowd, the app servers are overloaded. Only 76.6 percent of requests get through against a 99.9 percent target, and p99 is 1.7 s when reads should come back in 300 ms.

And it costs more. The meter reads about $148,172 a month, way over the $108,000 budget, cause sending video straight from storage to the internet is about 9 cents a gigabyte and through a CDN it's about 4 (approx.). So here the bigger design is actually the cheaper one.

The debrief explains every number

The debrief after a full day. This one held.

The debrief after a full day. This one held.

The score is out of 1,000. Reliability is 400 of that, and speed, data safety and cost are 200 each. The reference design gets 1,000 here. Reads were inside their 300 ms target for 90 percent of requests and peaked at 378 ms. That's inside the allowance, so it still gets full points on speed. Cost gets full points at about $97,434 a month, and the card shows where the money went (about $70,083 of it is CDN usage).

The badge under the stars says "Reference design: not saved to your results". If you load the editorial's design and run it you still get the full debrief, it just doesn't count as your result.

To pass, the design has to meet the problem's uptime, latency and data safety targets and stay within budget. Duplicate work fails the run. A pass is one star, 800 or more is two, 920 or more is three.

Below the cards is the day itself: a traffic curve with the failed minutes marked, and a card for each event. The noon cache stampede card says the hit rate fell to zero, and that the CDN and the origin shield each let one request refill a key while the rest waited, so nothing broke. It also gives the real-world number behind it. With a 90 percent hit rate, an empty cache sends 10 times the normal load to the database (approx.). The 21:00 cost blowout ran usage costs at 3 times normal until midnight and added about $1,664 to the month.

The editorial, after you've tried

Once you've finished one day, the editorial opens (with a spoiler warning if you haven't passed yet). It has one to three strong designs with the reasoning, the worked numbers, the monthly cost and the trade-offs, and every design was measured by playing it through a full day in the same engine. You can load one onto your canvas, or load it and run it straight away.

The trade-offs are the part worth reading. For video, one of them is "Bandwidth cost dominates. Doubling the app servers barely changes the bill. Doubling the viewers doubles it."

Tickets go on sale at 10:00

The concert ticket drop is one of the hard ones. 40,000 seats, and a normal day is flat at about 600 requests a second. Then at 10:00 sharp it jumps to about 25 times that and stays there for 15 minutes. The bots are already there, they showed up at 09:50. At 10:07 the page stalls and everyone starts hitting refresh, which makes it worse.

10:05 with a load balancer, three app servers and one database.

10:05 with a load balancer, three app servers and one database.

The obvious first design is a load balancer, a few app servers and a database. It's cheap, about $1,407 a month against a budget of about $16,000. Five minutes into the sale it's serving 7 percent of what arrives.

Same minute with a waiting room in front of the seat database.

Same minute with a waiting room in front of the seat database.

You could add app servers, but one database primary takes about 2,000 writes a second and the rush wants about 3,600 seat holds a second. The game says it straight in the editorial, "You cannot buy your way out of a 25 times jump that lasts 15 minutes." So the design there puts people in a line. Seat holds go into a queue and workers drain it at the speed the database can take, with a CDN serving the event page and a rate limiter turning the bots away. At 10:05 that one has served 99.999 percent of the day's requests and costs about $9,995 a month.

82 problems from across the industry

Medium only, one click. 33 of the 82 problems.

Medium only, one click. 33 of the 82 problems.

Every problem is a real kind of product with real requirements. The card tells you the users, the peak requests per second, the mix of request types, a p99 latency target, an uptime target, a data safety rule and a monthly budget. Real companies show up only as comparisons, "a video service like Netflix", nothing more.

Today there are 19 Easy, 33 Medium and 30 Hard, and every industry has at least one Hard. You can filter by difficulty, industry, concept and status. Or skip the filters and follow a study path like "Surviving spikes" or "Money and safety", which pull problems from different industries.

Learn: one idea, one live demo

Lessons are live demos. Here the cache is in and the database has calmed down.

Lessons are live demos. Here the cache is in and the database has calmed down.

Never touched a load balancer? Learn is where to start. 24 short lessons, one idea each: caching, load balancing, replication lag, sharding, queues and backpressure, consistency, idempotency and retries, rate limiting, CDNs, multi-region, observability, cost, AI serving and some more. Each is about 3 minutes and the demo runs on the same engine as the game. There are also 17 longer lessons, 5 to 8 minutes each, under Go deeper and Lead the design.

In the caching lesson 12,000 requests a second hit 14 app servers and one SQL database, and 95 percent of them are reads. The database is nearly full. You drop a cache in between, and the goal is to keep the database at or under 70 percent busy for a full minute. It sneaks the numbers in while you play:

  • a read from memory in the same zone is about 0.5 ms, a database read about 5 ms (approx.)
  • read-heavy data usually gets an 85 to 95 percent hit rate
  • at 90 percent only misses reach the database, so about 11,400 reads a second turns into about 1,140

Then a three-question check. One of them asks what a long TTL costs you. Answer: you might hand back stale data.

Interview mode and twists

Interview mode. The clock starts at 45 minutes.

Interview mode. The clock starts at 45 minutes.

Hints are free in the normal game. That's fine when you're learning, but in an interview nobody hands you the clarifying questions, so Medium and Hard problems have an Interview mode where you type your own, with a 45-minute clock running and no hints. You write the requirements and the estimates too, and you have to defend the design in writing.

Twists are the other part. After a finished day you can ask for one and it changes the demand and the budget on the design you just built. For video streaming it's "Demand has settled at about 150 requests/s" with a new ceiling of about $43,000 a month. Pass a twist without hints and the problem counts as mastered.

Challenge: show off to your friends

Every day there's a new seeded challenge, and it's the same for everyone that day. The date picks the problem and a twist. On 3 November it was Real-time fraud detection, card fraud checks at a bank that have to answer in about 150 ms, with every event moved 45 minutes earlier, 23 percent stronger, and a surprise cold start thrown in. You can't edit during the day in Challenge, so it's a pure design test, and you get personal bests and a streak.

Then the fun part. After any finished day, Share makes a "beat my design" link. The whole architecture, the seed and the score are in the URL itself, and nothing gets uploaded. The one for the card below is 538 characters. Your friend sees your score as the target and can show your design as a faint ghost while they build. When they finish, their browser replays your design on the same traffic and marks your score verified if it matches, so nobody gets to just type in 1,000.

The 1200 by 630 result card, drawn in the browser.

The 1200 by 630 result card, drawn in the browser.

The card is a 1200 by 630 image drawn right in the browser. This one held the day at 999 out of 1,000: about 100 percent success against a 99.9 percent target, nothing lost and about $97,574 a month against a $108,000 budget, with a thumbnail of all 17 parts. It uses your phone's share sheet when there is one, or you can download it.

Signing in

You can play System Designer for free without an account. Sign in with Google or GitHub to sync your progress across devices or post a score to the public leaderboard. The guides and public lesson pages show the first part and ask for an email to read the rest.

The leaderboard doesn't trust any score a browser sends. The server takes the same payload a "beat my design" link carries, rebuilds that day's exact scenario, replays the full day with the game's own engine and keeps its own score. The editorial's designs aren't listed, and neither is anything with the same wiring, so loading the answer and changing a few sizes won't get you on the board. It can't tell who drew a design though, so one copied from a friend's link still counts, and the board says that plainly.

Signing in stores your provider id, a display name, your avatar link, your progress and your scores, and you can delete all of it any time.

About the numbers

Accuracy comes before flash in this game. Every price, capacity and latency is a rounded real-world approximation, shown with ≈ and labelled as one. Prices follow the public list prices of the big cloud providers, and capacities and latencies follow commonly published figures. Problem budgets and targets were measured by playing each reference design through a full simulated day. Real systems vary a lot, so treat them as a sense of scale and not a quote.

A few of the figures the game uses:

Part Rough price Rough capacity
App server (4 vCPU, 16 GB) ≈ $140 a month ≈ 1,000 requests a second for a typical JSON API
Cache node (about 13 GB) ≈ $150 a month ≈ 100,000 operations a second
SQL primary (4 vCPU, 32 GB) ≈ $450 a month ≈ 8,000 simple indexed queries a second
CDN ≈ $0.04 per GB sent ≈ 2 million requests a second
Idempotency store ≈ $100 a month ≈ 50,000 checks a second
WebSocket gateway node ≈ $200 a month ≈ 100,000 open connections

The traffic engine is a flow model that moves in fixed 10-second ticks. It treats traffic as rates rather than individual requests, and the lessons say so. It's also deterministic, which is what lets a friend's browser, and the leaderboard, replay your design and check your score.

How to play

It works on a phone too.

It works on a phone too.

Play it at https://systemdesigner.io. If you've never heard of a load balancer, start with the 3-minute intro. If you have, try the URL shortener first and then go break video streaming. And if you hold the concert ticket drop, send the link to a friend and make them try.

The code is on GitHub under the MIT license: https://github.com/adityareddy-dev/system-designer. It's a static site with no build step.

Top comments (0)