The architecture notebook / 01

Explain a system-design diagram, one request at a time.

A useful diagram shows where a request goes, where the data lives and what happens when a dependency fails. Practice those explanations on a small URL shortener before adding more boxes.

4 paths to explain10-minute practice taskOriginal illustrative example

01 / Draw only what you can explain

One short link. Two places to look it up.

Our fictional service maps a short code such as /r7k to a destination URL. Focus on the read path in one region. Link creation, abuse review and multi-region replication are separate design topics. Links have an expiry time; the redirect service checks it before returning a destination.

Handcrafted illustrative architecture. This is a teaching sketch, not a ClawPad screenshot or generated answer. The values below are assumptions, not measured results.

Read path and cache fallbackArrows show calls. Responses return to the caller.
A URL shortener with a cache and an authoritative link storeThe browser sends GET /r7k to the redirect service. The service looks in the cache first. On a miss, or a cache timeout within a bounded fallback policy, it queries the link store. Valid results may fill the cache. The service returns a redirect to the browser. The four paths below explain hits, misses, cache failure and database failure.BrowserRedirect serviceCacheLink storeopens /r7kchecks code + expiryreturns redirect or errortemporary copysource of truthGET /r7kA · look up cached mappingB / C · read if miss or cache downA hit avoids the link store. A failed store read is an error, not “link missing.”

Cache fills also go from the service to the cache. No cache-to-database call is implied. On small screens, scroll the diagram or use the equivalent prose below.

Read the picture aloud. The browser asks the redirect service for a code. The service checks a temporary cached mapping first and queries the authoritative link store only when needed. It validates the result and returns either a redirect or an explicit error. Each box is a logical responsibility, not a claim that one machine is enough.

02 / Follow the arrows

Tell four stories about the same diagram.

  1. A / Cache hit

    The destination is already cached.

    The browser requests /r7k. The service reads its cached mapping, checks that the link has not expired and returns HTTP 302 with the destination in the Location header. The browser then requests that destination. The link store receives no read on this path.

    Say what comes back, not only which box gets called.

  2. B / Cache miss

    The mapping exists only in the link store.

    A miss is not evidence that the link is missing. Read the store by code. If a valid mapping exists, attempt to cache it and return the redirect. Choose a cache time to live (TTL) of at most 60 seconds, shortened to the link’s remaining lifetime. A cache write failure need not discard a successful store read.

    Return “not found” only after a successful lookup finds no mapping. An expired mapping gets an explicit expired-link response.

  3. C / Cache unavailable

    Fallback needs a limit.

    After a bounded cache timeout, use the link store only within a capped fallback budget. Limit concurrent store reads and reject excess work with a temporary service error. Otherwise, a cache outage turns every redirect into a database read and can take down the remaining healthy dependency.

    Explain the timeout, admission limit and error response. “We fall back” leaves the overload behavior undefined.

  4. D / Store unavailable

    Unknown is different from missing.

    A still-valid cache hit can serve a redirect under this example’s freshness policy. A miss that reaches an unavailable store returns a temporary service error, such as HTTP 503. Do not turn the timeout into a 404 or cache it as a nonexistent code. Record cache timeouts, store failures and rejected fallback requests separately.

    If the requirements demand an authoritative check on every request, cached availability no longer buys you this behavior.

Protocol reference: HTTP 302 and the Location header in RFC 9110. This example’s 60-second TTL and fallback policy are teaching choices.

03 / Put a cost next to the choice

A cache saves reads. It also creates a freshness problem.

Assume 1 million redirects/day and a 95% cache-hit rate. Successful traffic needs about 50,000 store reads/day, or 0.58 reads/second on average. With no usable cache, the same traffic needs about 11.57 store reads/second. That is 20× the read load, before retries or traffic peaks.

These averages do not size a database. Test bursts, hot keys and fallback limits. Change the traffic assumptions with the capacity calculator.

Accept a short stale window

For editable destinations where a short delay is acceptable, update the store and invalidate the cached code. Expiry is a backstop. A concurrent reader can still refill an old value, so deletion alone does not guarantee immediate freshness.

Require immediate revocation

For a disabled link that must stop working immediately, the simple cached path is insufficient. Add an authoritative revocation check that fails closed, and define when revocation is considered complete. This adds latency and an availability dependency. Revisit it with the requirements owner.

Also specify browser and intermediary caching. For this exercise, return Cache-Control: no-store on redirects so future navigations reach the service. A 302 status alone does not define the whole caching policy. Already issued redirects cannot be recalled.

Further reading: Microsoft’s cache-aside pattern and consistency limits and the HTTP no-store response directive.

04 / Continue when the requirements change

“Make it 10 million redirects a day. Revoked links must stop.”

Original illustrative continuation by the ClawPad editorial team. Reviewed . These are assumed traffic and policy choices, not measured capacity or a generated model result.

Keep one region and the same destination cache. Increase demand to 10 million redirect requests/day and assume a peak of 12 times the daily average. Keep a 95% destination-cache hit rate at that peak. For the calculation, assume all requests refer to valid, active links, one lookup per step, no retries and no request combining.

Define “stop” before drawing. After a revocation write is acknowledged, every authorization check that starts later must reject that code. Checks already in flight may race with the write; redirects already issued cannot be recalled. If the requirement instead forbids every redirect response after acknowledgment, this design needs additional coordination of in-flight requests.

The revised request pathEvery redirect needs an authority check, including cache hits.
A redirect service checks revocation before using a cached destinationThe browser calls the redirect service. Step one checks a strongly consistent revocation authority on every request. An active result allows step two, destination-cache lookup, then step three, a bounded mapping-store lookup on a miss. A revoked result is denied. An unavailable authority returns a temporary error even if the cache contains a destination. Calls return to the redirect service; the authority does not call the cache.BrowserRedirect serviceRevocation authorityDestination cacheMapping storeopens /r7kcheck active firstthen look up destinationstrongly consistenttemporary mappingsource of truth for URLGET /r7k1 · active, denied or error23 · bounded miss / fallbackResponse returns through the service. No authority result means no redirect.

These are logical roles. A single database could hold both authority and mapping data; then count both access patterns against its measured capacity. The additional box does not imply an extra machine or a proven deployment.

  1. Active + hit

    The cache no longer avoids every dependency.

    Check the authoritative active/revoked state by code using a strongly consistent read. If active, read the destination cache, validate expiry and return 302 with Cache-Control: no-store. Do not cache the active decision. Unknown codes or missing authority records are denied, never assumed active.

  2. Active + miss

    Keep the existing bounded fallback.

    After the authority allows the request, read the mapping store within the fallback budget. Validate expiry, optionally fill the destination cache, and return the redirect. A mapping-store timeout returns 503; it does not mean the link is absent.

  3. Revoked / failure

    Fail closed when the new dependency is unavailable.

    A known revoked link returns an explicit disabled-link response, such as 410. A timeout or unavailable authority returns 503 even with a cached destination. With a healthy authority but an unavailable mapping store, a valid cached destination can still be served. With no usable cache, admit only bounded mapping-store traffic and reject excess work.

The revocation writer acknowledges only after the authority has committed the change. Link creation must make its mapping available before making the code active. A stale replica, cached allow decision or asynchronous revocation feed cannot satisfy the chosen check-after-acknowledgment rule.

Recalculate each dependency in requests per second

Illustrative offered load before admission limits, rounded to two decimal places
QuantityCalculationResult
Average redirects10,000,000 requests/day ÷ 86,400 seconds/day115.74 requests/s
Peak redirectsUnrounded average × 121,388.89 requests/s
Peak mapping reads with healthy cacheUnrounded peak × (1 − 0.95)69.44 reads/s
Peak authority checksUnrounded peak × 1 check/request1,388.89 checks/s
Peak mapping reads without cacheUnrounded peak × 1 read/request1,388.89 reads/s

The authority workload remains when the cache fails. Mapping-read demand rises 20 times under these assumptions. These numbers exclude writes, replication, cache fills, denied requests, retries and operational headroom. Measure sustainable throughput and latency before choosing admission limits, concurrency or a database size.

Arithmetic correction. A draft that says “10,000,000 ÷ 86,400 = 1,157.41 requests/s” is wrong. The correct average is approximately 115.74 requests/s. Keep the unrounded value for the peak calculation.

Architecture correction. “Only 69.44 database reads/s at peak” may calculate cache misses correctly and still omit every authority check. Correct arithmetic cannot detect a dependency you forgot to count.

Run the arithmetic independently

Copy this JavaScript into a local file and run it with Node.js. It checks all five displayed rates and rejects the deliberate error. It has no network calls or dependencies. This is a teaching check, not output from ClawPad’s desktop validator.

const secondsPerDay = 86_400;
const dailyRedirects = 10_000_000;
const peakMultiplier = 12;
const hitRate = 0.95;
const averageRps = dailyRedirects / secondsPerDay;
const peakRps = averageRps * peakMultiplier;
const mappingReadsAtPeak = peakRps * (1 - hitRate);
const authorityChecksAtPeak = peakRps;
const wrongAverageRps = 1_157.41; // Deliberate 10x error.
const rows = [
  ["Average redirects/s", averageRps, 115.74],
  ["Peak redirects/s", peakRps, 1388.89],
  ["Peak mapping reads/s, cache healthy", mappingReadsAtPeak, 69.44],
  ["Peak authority checks/s", authorityChecksAtPeak, 1388.89],
  ["Peak mapping reads/s, cache unavailable", peakRps, 1388.89],
];
for (const [label, actual, expected] of rows) {
  if (Number(actual.toFixed(2)) !== expected) throw new Error(label);
}
if (Math.abs(wrongAverageRps - averageRps) < 0.01) {
  throw new Error("The deliberate arithmetic error was accepted");
}
console.table(rows.map(([quantity, value]) => ({
  quantity, value: value.toFixed(2)
})));
console.log("Wrong average: 1157.41; corrected: " + averageRps.toFixed(2));
console.log("Whole-request peak rounded up: " + Math.ceil(peakRps));

The unrounded peak is 1,388.888… requests/s. Rounded up to whole requests, it is 1,389 requests/s. That rounding still supplies no spare capacity.

What does ClawPad’s on-device capacity check establish?

The structured system-design validator checks specific supplied fields. Peak requests per second must match daily requests multiplied by the peak factor, divided by 86,400, then rounded up. Peak bytes per second must equal that whole-request rate multiplied by the supplied average payload bytes.

That consistency check does not measure traffic, prove that payload assumptions are realistic, check every calculation in prose, or certify the architecture. It is not a general consulting or finance calculator. Managed AI answer generation still uses cloud services; a local arithmetic check does not mean screenshots, audio or submitted profile context stay on device.

05 / Your turn · 10 minutes

Remove one box. Explain what changes.

Sketch the four boxes from memory for two minutes. Spend three minutes narrating a hit and a miss. Then take three minutes for this follow-up: “The cache is down during a traffic spike. What do users see?” Use the final two minutes to compare your explanation with the feedback.

Open the feedback after your attempt

A stronger answer names a limit and an outcome.

“I stop waiting at the cache deadline. I admit only bounded fallback traffic to the store, then return a temporary error when that budget is exhausted. I do not retry indefinitely. I track store saturation and fallback rejections, and test recovery before restoring full traffic.”

Choose the actual deadline and concurrency cap from measured store capacity and a response-time target. There is no universal safe number in this sketch.

  • If you only named a database replica, trace how traffic reaches it and how you know it has capacity.
  • If you promised every request succeeds, add the overload response and explain the availability tradeoff.
  • If you returned 404 on timeout, distinguish a failed lookup from a successful lookup with no result.
  • If you covered all three, add concurrent requests for one hot code. Discuss combining duplicate in-flight lookups and the scope of that coordination.

For a wider exercise with requirements, capacity and key generation, continue to the full URL shortener blueprint. This page focuses on explaining the diagram.

From the notebook to the desktop

Use ClawPad’s diagrams as material to question.

ClawPad can present structured architecture diagrams and database views alongside staged system-design guidance. Diagram views support pan and zoom. Available content depends on the answer, and generated designs can contain mistakes. Check the request paths, assumptions and failure behavior yourself.

Try a practice prompt, explain the diagram without reading the answer, then change one constraint. ClawPad presents written guidance; it does not speak the answer for you. Where audio is supported and ready, explicitly started Live Assist can process spoken questions. Get permission before processing anyone else’s speech. The exercise above works on paper too. Use only where assistance is explicitly permitted.

Questions about system-design diagrams

How does ClawPad present system-design diagrams?

ClawPad can render structured architecture nodes and connections alongside a staged system-design answer. Supported diagram views include pan and zoom. The generated design still needs your review; a diagram is not proof of correctness or production readiness.

Can ClawPad show database schemas?

When the answer includes structured database information, ClawPad can display entities, fields and relationships. The exact tables and components depend on the answer. Not every response includes every view.

Is this walkthrough a ClawPad screenshot or generated answer?

No. This is a handcrafted illustrative teaching example by the ClawPad editorial team. It is not an app screenshot, a live generated result or a performance benchmark.

How does changing a constraint change the diagram?

Update the request path, dependency load and failure response together. In this illustrative continuation, immediate revocation adds an authoritative check to every redirect, including cache hits. Cache-miss arithmetic alone no longer describes the workload.

Do on-device math checks prove the design is correct?

No. ClawPad’s structured system-design validator checks particular capacity fields for arithmetic consistency. It does not verify the workload assumptions, measure real capacity or certify architecture, consulting cases or financial conclusions. Managed AI generation still uses cloud services.

What should I explain when walking through a system-design diagram?

Start with the user action, trace the request and response, name the source of truth, then change one assumption. Explain a cache miss, an unavailable dependency and the tradeoff you would accept. Component names alone do not explain behavior.

Editorial method. We created this scenario to teach request tracing and checked the protocol explanations against the linked references. Product descriptions were checked against ClawPad’s diagram and answer renderers and structured capacity validator. The added October 13 continuation is an editorial scenario; its arithmetic can be reproduced with the supplied code. This illustrative example is not a product performance benchmark.

Find your next practice session →