How to Practice System Design When You Know the Components

Suppose a URL shortener receives 1,000 redirects per second, but its database can handle only 300 reads per second. You add Redis. How much traffic will still reach the database, and what happens when the cache fails?
Try the exercise as you read: open the Archinario architecture board, add an application, a database, and a cache, then label the request path. Put your predicted database read rate beside the diagram. The walkthrough below gives you a calculation and a failure scenario to compare with your attempt. Paper works too.
This tutorial was prepared for Archinario, a project with an architecture board and interactive learning labs. The board keeps your diagram and notes editable. The capacity calculation uses explicit assumptions; drawing a connection does not simulate the service.
Try the problem before reading the walkthrough
Set aside a session you can finish, perhaps 30 minutes. Treat that as a timebox for one attempt.
Use these requirements:
- A user submits a destination URL and receives a short link.
- Opening the short link redirects the visitor to that destination.
- Acknowledged mappings survive an application restart.
- The first version does not support destination edits or click analytics.
- For a separate read-capacity calculation, assume 1,000 redirects per second and a database capacity of 300 reads per second. Exclude link creation from that calculation.
These numbers are exercise inputs, not database benchmarks.
Before continuing, write down the creation and redirect paths. Draw where each mapping lives, estimate the database read rate, and propose a change that handles the assumed traffic. Then describe what happens when the component you added becomes unavailable.
Keep your first attempt. If you get stuck, record the specific question: “What hit rate am I assuming?” is a useful next research task.
Make your assumptions visible
A worked example has already settled choices you must make yourself. Does a short link expire? Can its owner change the destination? How quickly must a deleted link stop working?
Those choices affect the design. A cached destination becomes a freshness problem when the product allows it to change.
The System Design Primer starts its interview approach with use cases, constraints, and assumptions. For solo practice, leave that reasoning beside your diagram. It gives you something concrete to review later.
Follow one request to its result
Start with an application and persistent storage.
For creation, the application generates a key and saves the key-to-URL mapping. It returns success after storage acknowledges the write. Decide how to detect collisions; a unique constraint with another generation attempt is one possible starting point.
For a redirect, the application looks up the key and returns a redirect response. An unknown key needs a defined response too.
In the exercise, each redirect requires one database read. That produces 1,000 reads per second against a capacity of 300. The excess is 700 reads per second. Requests accumulate if the system keeps waiting; bounded waiting or admission limits cause some requests to fail. Specify which behavior your design uses.
Adding application instances does not reduce this database read count. A load balancer may address an application capacity or availability requirement, but that needs its own explanation.
Calculate what the cache changes
Consider a cache-aside read path. The application checks the cache, reads storage on a miss, and stores the retrieved value in the cache. Microsoft documents this pattern and its limitations.
Assume a warm cache serves 80% of redirects. The remaining 20% reach the database:
1,000 × (1 − 0.8) = 200 database reads per second.
That leaves 100 reads per second of headroom within the assumed capacity. This calculation assumes the cache can handle every lookup and the application is not a bottleneck. Cache-fill overhead and link-creation writes are outside its scope.
Compare these cases before deciding the design works:
| State | Redirects served by cache | Database reads per second | Against a capacity of 300 |
|---|---|---|---|
| No cache | 0% | 1,000 | 700 above capacity |
| Warm cache | 80% | 200 | 100 of headroom |
| Lower hit rate | 50% | 500 | 200 above capacity |
The threshold is a 70% hit rate. Exactly 70% leaves no capacity headroom, and this arithmetic does not predict latency or burst behavior.
The 80% assumption needs evidence in a real service. Measure a representative request distribution. A cache's expiration policy and available memory also affect which requests it can serve.
For comparison, consider increasing database capacity. It may avoid depending on cache hits to absorb the read load, but its cost and achievable capacity require measurement. Write down what would make you choose that option.
Change one condition
First, make the cache unavailable. Sending every request to storage restores the original 1,000 reads per second.
Choose the service's behavior. You might cap requests admitted to the database, bound waiting, and return temporary failures for excess traffic. That sacrifices some successful redirects during the outage. Serving the entire stream requires sufficient capacity or another design.
Next, allow owners to delete links. State how quickly a deleted link must stop redirecting. If cached entries live for ten minutes, waiting for expiration may miss that requirement. Cache-aside alone does not guarantee consistency between the cache and storage.
For another session, consider a timeout during link creation. The write may have succeeded even though the caller never received the response. AWS explains this retry risk and why idempotency matters. Decide whether another short link for the same destination is acceptable and how you recognize a retry of one operation.
Work through one failure case completely before expanding the exercise.
Review your design without a partner
Compare assumptions before comparing diagrams. Another solution may support editable destinations or regional failures. Its extra components may follow from those requirements.
Use a short decision record for your own design:
Input: 1,000 redirects per second; database capacity of 300 reads per second.
Choice: a warm cache with an assumed 80% hit rate.
Calculation: 200 database reads per second.
Limit: below a 70% hit rate, database capacity is insufficient. Cold start remains untested.
Next check: cache unavailability with bounded database admission.
Give this record and your diagram to a reviewer. Ask them to find an assumption that would invalidate the calculation.
If you use an AI assistant, save your attempt first. Ask it to check the arithmetic, identify a missing failure case, and separate your stated assumptions from its own additions. Verify technical claims against documentation or an experiment.
Keep the diagram editable with an agent
You can build the exercise on the Archinario architecture board, label connections, and put assumptions in notes. Projects save in the browser; JSON exports preserve an editable project, while SVG exports provide an image.
Archinario Agent connects your own AI client to an explicitly shared diagram. One local binary provides a command-line interface (CLI) and a Model Context Protocol (MCP) server. They expose operations for reading and editing the board.
To connect, open File → Board agent → Allow diagram access. Give the copied connection prompt only to your trusted agent: it contains a temporary key for the selected diagram. Close the connection dialog and keep the board tab open.
A practice request could be:
Read my URL-shortener diagram. Propose where to add a cache and explain the cache-miss path. Show the plan first. After I approve it, update the diagram and add a note about cache failure.
You can continue editing manually and undo an agent's batch as one action. The AI model runs in your chosen client. The CLI and MCP package is open source in the archinario-agent repository, with installation and configuration instructions.
The board's animated connections visualize routes. They do not calculate your service's capacity.
Finish with something you can check
Keep your initial diagram, the revised version, and the calculation that motivated the change. On the next attempt, check whether you can:
- Tie each component to a requirement or calculation.
- Follow a request through to the result a user sees.
- Explain at least one failure and the service's response.
- Name the assumptions that still need measurement.
For a focused experiment, Archinario's System Design Foundations course includes a caching lab where you can change workload and cache settings, then compare database traffic, errors, and latency.
The lab uses a simplified model of one mechanism. It does not validate the entire URL shortener or replace a load test. Write down a prediction before changing one parameter, then explain any difference you observe.
Comments
Join the discussionNo comments yet. Be the first to comment.
