System Design: A Practical Guide for Software Engineers

By Arkaitz

Search system design and you get a diagram: a load balancer, a cache, a queue, a database, and a glossary. The engineers who actually operate large systems publish something else. Google SRE's Non-Abstract Large System Design chapter says deferring reliability work into design is akin to accepting fewer features at higher costs, and demands estimates instead of boxes and arrows. Two of the loudest voices in distributed systems now argue the theorem every guide opens with is nearly useless.

This is a system design guide for engineers who already ship production systems, and it argues one thing: system design is a sequence of decisions under a budget of failure. Cache, queue, sharding, replicas — those are the output of the process, not the process. To make it concrete I walk one system end to end: a multi-tenant commerce engine I designed and shipped, with names, merchants, customers and platform anonymized but the architecture intact.

Is system design even useful, or is it an interview gimmick?

Both, and the honest answer is more useful than either. True system design gets done a handful of times per product lifecycle — by architects and senior engineers — which is why it moves development cost so much, and why nobody wants to do it on every feature. It is also the mechanism most interview processes use to sort mid, senior, and staff, and what it measures is not how many boxes you draw but whether you can name what goes wrong and what it costs. That is also this post's scope boundary: this is not interview prep. The ecommerce architecture at 100 users post is the counterweight to design Twitter — real design at the small end, where the constraints are a person and a budget, not a datacenter.

The system design procedure: seven questions, in order

Write the target first, estimate second, and pick components last. Components are what everyone argues about, and they come last.

The spine is Google's NALSD loop, the cleanest published framing of design like you will operate this:

  1. Is it possible? — does a design exist in principle, ignoring RAM, CPU and money?
  2. Can we do better? — simpler, faster, smaller, cheaper.
  3. Is it feasible? — does it scale inside the money, hardware and time you actually have?
  4. Is it resilient? — can it fail gracefully, one component at a time, up to a whole datacenter?

Each answer must be a concrete estimate — machines per shard, milliseconds per write, dollars per month — and NALSD is explicit that examples of sound reasoning and assumption making are more important than any final values. The reasoning is the deliverable; the number is the receipt.

Layered on that loop, the procedure is seven questions in order: requirements and constraints (SLO written before the architecture), the numbers, the data model, the API contract, the failure modes, what you measure, what it costs. Is it feasible? is where build-versus-buy bites — why open source is a strategic necessity for senior engineers covers the version where the constraint is your own team's runway.

Start with the SLO, not the architecture

If you cannot state the indicator and the target in one sentence, you are not ready to pick a database. An SLO written after the architecture is a target you selected to justify the architecture.

NALSD's worked example sets its objectives — 99.9% of dashboard queries complete in under a second, and 99.9% of the time the displayed data is less than five minutes old — before proposing any architecture. Two corrections matter on top of that. Work backwards from what users want to what you can measure; SRE's warning is that starting from what is easy to measure ends you with less useful SLOs. In the commerce engine the objective is about what a shopper sees — a storefront page, a checkout that completes — not whether an API route returned 200. And throughput is set by your users, not you: a target picked from today's performance locks you into a system that cannot be improved without significant redesign.

The availability table turns the target into a business conversation: 99.9% is 8.76 hours of allowed downtime a year, 99.99% is 52.6 minutes, 99.999% is 5.26 minutes. Whether you design multi-region from day one is decided by which cliff you buy.

Capacity estimation is the whole job, so do the arithmetic out loud

Estimate before you choose. If the working set does not fit on one machine, the architecture just changed and you now hold the argument for it. Estimation is not preparation for the decision — it is the decision.

NALSD's chain is the model. 500,000 queries per second, 2 KB per log record, 86,400 seconds a day gives 86.4 TB per day. At 200 IOPS per disk that is 2,500 disks before a single join. To hold 100 TB of RAM at 64 GB per machine, 1,563 machines. The impossible on one box conclusion is derived, not asserted — which is what makes it survive a design review.

Little's Law is the concurrency calculator: L = λW, John Little's 1961 result. A server handling 100 messages per second at 100 ms average latency consumes 10 threads on average — the number that sizes your consumer pool. Keep Brooker's caveat beside it: the mean hides effects caused by high-percentile behavior, and λ is often non-stationary, so steady-state L is a starting assumption.

Then build the latency budget from the network, not from hope. Consensus round-trip time is on the order of a millisecond in a datacenter, ~45 ms across the US, ~70 ms New York to London; a 10 ms random disk write caps consensus near 100 operations per second. NALSD's multiregion estimate: ~25 ms per operation gives 40 sequential operations per second, so 1.02 million queries per second needs 25,500 tasks and about 4 TB of RAM per datacenter. The Universal Scalability Law subsumes Amdahl and Gustafson: add another server is a hypothesis.

This is where the running example turns on one question: does a single merchant's working set fit on one node? Rather than estimate it and split the answer, I removed the question. The engine keeps one dedicated database per tenant on a serverless SQLite platform, plus a shared control database for tenancy and identity. No row-level security, no tenantId column on any commerce table — a query that forgets the tenant predicate cannot leak, because there is nothing to forget, and one loud merchant cannot starve another.

That store is also SQLite, so there are no interactive transactions and atomic multi-statement writes go through its REST batch endpoint — not a limitation bolted on, but the thing that decided how writes are structured.

One last hardware check, because drives are not magic: Backblaze's 2025 year-end report covers 344,196 drives at a 1.36% annualized failure rate. Vendor telemetry, but the shape holds: at that rate a 1,000-disk fleet loses about fourteen disks a year as a normal event.

Data model and storage — default to relational, and know why the alternative exists

Start relational. The reason NoSQL exists is a gap in the query interface, not a ceiling in the storage engine: relational APIs cannot express a query where ACID is relaxed, which is why every BASE system is a NoSQL system — and why NoSQL is a capability bundle rather than a category.

The default earns its keep because transactions are not optional in most relational engines — whether you ask for them or not, the engine still gives you them. The real cost of eventual consistency lands on your application instead: quoting Jeff Shute from the SRE Book, developers spend a significant fraction of their time building extremely complex and error-prone mechanisms to cope with eventual consistency, and such problems should be solved at the database level.

The running example takes the default literally: SQLite per tenant, relational, isolation architectural rather than a clause in every query. Because storefront and management are the same code path against the same database, which tenant am I in resolves from the Host header, a merchant hostname serves storefront and customer pages only, and management redirects to the platform host. One edge proxy with on-demand TLS fronts every hostname, so a merchant's domain is not a ticket. No authorization branch can get this wrong, because the host already decided. Choosing SQL versus NoSQL, sharding, and index design are their own posts.

API design — design for the failure you cannot detect

The ambiguous case is a client that timed out on an operation that actually succeeded. Design for that one, and put an Idempotency-Key on every mutating endpoint.

Stripe's taxonomy of failure windows is the cleanest available, and only the third needs an answer. A connection never established is safe to retry; a failure midway leaves work in limbo. An operation that succeeded while the connection broke leaves the client with no idea — and only an idempotency key resolves it. The key must be deterministic per logical intent, derived from the order ID rather than a fresh UUID per attempt, so a redelivered message replays the cached result. On concurrent duplicates, let the database arbitrate: record the key in the same operation that changes state, and fail fast.

The corollary is the payoff: when the external API has no idempotency primitive, exactly-once is not available at any price — you get at-most-once plus reconciliation, designed for from the start. The engine's versioned public API is API-key authenticated with scopes, per-key rate limits, and idempotency keys on mutations, because merchant integrations retry and some time out after you already wrote the order. Keys resolve the tenant independently of the domain, so an integration works from any hostname. Card entry happens in Stripe Checkout with destination charges, which keeps card data out of the system entirely. REST versus gRPC, versioning, and pagination are their own post.

Vertical or horizontal, and when one server stops being enough

Scale vertically until you have a measured reason not to, because every machine you add is a new way to be partially broken. Vertical is one machine with a ceiling, one thing to reason about, and no new network hop in your failure model. Horizontal buys a ceiling you have not hit yet at the price of N chances to be half-broken. Simple web architecture for early-stage sites covers the small-scale version, and the trigger is always a measured limit, not a projected one. The RAM apocalypse is the long argument on what state in memory costs. At cluster scale, pooled memory and the rack that stops being a server is the same argument with the box boundary moved.

Stateless services is a claim about where state lives, not about state disappearing. Horizontal scale requires shared state; shared state is a consistency problem; consistency is a latency bill — billed in the availability promise too, since Google Compute Engine publishes a 99.95% target, three and a half nines.

For N hosts each of availability A, A_system = 1 − (1 − A)N — exponential value at linear cost. Add a shared datacenter of availability D and it collapses to D × (1 − (1 − A)N), which Brooker notes doesn't look nearly as good. Correlated failure is the kryptonite: Twitter's 2011-08 SEV-0 traced to a baseboard management controller health check firing every 20 hours 40 minutes on one hardware SKU, and the cascade it started ran for two months.

Size for the failure you plan for: Google's rule of thumb is N+2, so a 5,000 QPS breaking point per cluster against a 19,000 QPS peak means approximately six clusters are needed. And adding servers does not fix the tail, it multiplies it: in Dean and Barroso's fan-out service, hedging a single read after 10 ms cut p99.9 for a 1,000-key read from 1,800 ms to 74 ms for 2% more requests.

Caching — when a latency optimization becomes a capacity dependency

A cache is a new state you can get stuck in. Before you add one, decide whether it is a latency cache — empty is survivable — or a capacity cache, where empty is an outage.

SRE's distinction is the one to learn: a latency cache lets the service sustain expected load when empty, a capacity cache cannot. The mode diagram explains the rest: one mode where the cache holds the right data, one where it is empty or wrong and you are slow or down, because the backend was never scaled for uncached traffic. That second mode is metastable — a state you will not leave on your own once traffic overwhelms the database, and behind probably a majority of the industry's biggest outages.

Twitter's decade is the same argument with receipts: 6 SEV-0s and 6 SEV-1s at least partially attributed to cache, plus 38 less severe, and the 2016-07 SEV-1 where adding 115 cache nodes at once dropped the hit rate from 99.8% to 84%. The mechanism is identical every time: a feedback loop that outlives its trigger. The constructive alternative is a complete cache — a tier holding every row has no empty-and-wrong mode, and replication warms failover targets. Invalidation, stampede protection, and eviction are their own post.

Queues versus streams, and the backlog you cannot drain

A queue distributes work to whoever is free; a stream distributes events to every interested group, and a stream with N consumer groups is a durable broadcast. Choose wrong and you end up with a queue half the organisation polls.

The failure mode nobody warns you about is a backlog that cannot be drained. AWS documents insurmountable backlogs from which a service cannot recover in a reasonable amount of time, and gives three levers: prioritization, sidelining, and backpressure. Backpressure is the concrete one — scale the inbound throttle limit inversely to backlog size, so a growing backlog closes the door. SRE's guidance is blunt: a queue ten times the thread count makes a request take 1.1 seconds, most of which time is spent on the queue — so cap concurrency, not queue length, and keep queues at 50% of the pool or less.

Netflix's pipeline carries roughly 500 billion events and 1.3 PB per day, and moved to Kafka for durability and scale at the cost of consumer-group instability: the high-level consumer can lose partition ownership and stop consuming some partitions after running stable for a while. Idempotent consumers are a precondition — record the processed message ID in the same transaction as the state change. In the engine, outbound webhooks are signed deliveries with a scheduled retry, because a failed delivery is one merchant's problem. Kafka internals, ordering, and dead-letter queues are their own post.

Consistency — ask what the user sees immediately after writing

For every piece of data, decide what a user sees reading it right after writing, and put a number on the staleness bound. Eventually consistent without a bound is a label, not a design.

Verification beats documentation. Jepsen has analyzed two dozen databases and queues since 2013 and has found replica divergence, data loss, stale reads, read skew, lock conflicts, and much more. The YugaByte DB 1.3.1 report is the clean case: linearizability can be violated when clock skew exceeds the configured threshold, which defaults to 50 ms — and the violations did not show up in general-case register tests, which run at lower throughput. The label on the box is not the guarantee; the operating envelope is.

Distributed consensus is not optional for critical state: for leader election, critical shared state, or distributed locking, SRE says use distributed consensus systems that have been formally proven and tested thoroughly, because informal approaches can lead to outages, and more insidiously, to subtle and hard-to-fix data consistency problems. Replica count is a maintenance decision, not an availability one: 2f+1 tolerates f failures, so three is the floor, and most system downtime is a result of planned maintenance. The full taxonomy is its own pillar.

CAP is a correction, not a chapter

Stop labelling databases CP or AP. The theorem says that in the asynchronous network model you cannot guarantee both availability and atomic consistency in all fair executions, including those where messages are lost — and the authors later noted that the definitions rarely match what engineers mean by the words. The misuse is worse than imprecision: PostgreSQL's SSI gives serializability but not linearizability and Oracle gives neither, so per Kleppmann they are neither 'CP' nor 'AP', they are just 'P', and ZooKeeper in read-only mode is CAP-available and therefore neither. He asks readers to retire all references to the CAP theorem.

Brooker's version targets practitioners building cloud systems: CAP is nearly irrelevant for almost all of them, because routing sends clients to the healthy side of a partition, so most cloud systems offer both strong consistency and high availability. His replacement list is the useful one: durability versus write latency, consistency versus latency, latency versus throughput, consistency versus throughput, isolation versus throughput — plus, for anything cross-region, what the system does in the ordinary case, not the partition case.

Availability and failure handling — assume failure is the normal case

Dynamo's design makes the stance explicit: failure handling is the normal case, handled without impacting availability or performance. Overload, not a disk or a deploy, is the most common cause of cascading failure.

Start with the correction most sizing advice needs: QPS is a bad capacity metric. SRE says modelling capacity as queries per second often makes for a poor metric — a moving target makes a poor metric for designing and implementing load balancing — and recommends CPU consumption instead. Note the reconciliation: it's a common mistake to assume that an overloaded backend should turn down and stop accepting all traffic. Four mechanisms fix it:

  1. Adaptive client-side throttling — self-regulate when requests > 2 × accepts, because rejection has a cost.
  2. Retry budgets — 3 attempts per request, capped at 10% of a client's traffic, turning 3× retry amplification into 1.1×.
  3. Criticality classes — CRITICAL_PLUS, CRITICAL, SHEDDABLE_PLUS, SHEDDABLE, propagated through the RPC layer so overload never eats interactive traffic.
  4. Load shedding and graceful degradation — including the counter-intuitive move from FIFO to LIFO or CoDel, because a user who gave up on a ten-second request will not read the answer.

Retry amplification is the best failure story in a design doc. If the database, backend, frontend, and JavaScript layers each issue 3 retries, a single user action may create 64 attempts (4³) on the database. The fix is deadline propagation rather than an invented deadline at each hop, plus capped exponential backoff with jitter — retries are, as AWS puts it, selfish.

The 5% fault that produces an 80% error rate

Bimodal latency is invisible in averages and catastrophic in reality. With 5% of requests hanging, a 100-second deadline, and 1,000 worker threads, only 19.6% of requests get served — an 80.4% error rate from a 5% fault — and it may not be clear that bimodal latency is the cause of an outage when you're looking at mean latency. Fail fast rather than adding threads: hung requests occupy the workers healthy traffic needs.

Error budgets only work if they change behaviour. Roughly 70% of Google's outages come from changes to a live system, so the rollback path is part of the design, built with the feature, not at 2 a.m. SRE's policy: burn the four-week budget and you halt all but P0 and security fixes.

Then the idea nobody puts in a design document: you can be too reliable for your own architecture's good. Chubby was so reliable that teams built dependencies assuming it would never go down, so Google now synthesizes a controlled outage every quarter when no real failure has already dropped availability below target. SRE generalizes it: SLOs should be met not 100% of the time, because insisting on it can reduce the rate of innovation and deployment, require expensive, overly conservative solutions, or both.

Observability — four metrics and the one that pages a human

Measure latency, traffic, errors, and saturation, and page only on things a human can act on. Google calls these the Four Golden Signals: if you can only measure four metrics of your user-facing system, focus on these four. And latency has to separate successful from failed requests, because a slow error is even worse than a fast error.

Percentiles, not averages, and the arithmetic forces it. At 1,000 requests per second with a 100 ms average, 1% of requests might easily take 5 seconds, and the 99th percentile of one backend can easily become the median response of your frontend. That is why your p99 looks fine while users complain: you measure the backend, they measure the page. The most actionable line here is free — the p99 over a short window is an early saturation signal, because it moves first.

Then alert on symptoms and apply the page test: Every page should be actionable. Every page response should require intelligence. If a page merely merits a robotic response, it shouldn't be a page. Bigtable got this wrong for a long time — an SLO based on mean performance, alerts firing voluminously, and a team that often missed the problems that actually affected users. The fix was to temporarily target the 75th percentile and disable email alerts: a team that only ships alerts forward ends with a reliable service and a burnt-out rotation.

Budget for it, because observability is headcount, not a weekend project — a Google SRE team of 10–12 has one or two people whose primary job is monitoring. Once the alerts are right, the next step is running them, which is what our eight-step incident triage pipeline is for. Tracing, OpenTelemetry, and cardinality are their own post.

Security — the two failures your design creates

Authorization and resource limits are design decisions, so per-object checks, rate limits, and field-level shaping belong in the design document, not the backlog. OWASP's 2023 API Top 10 ranks Broken Object Level Authorization first, and notes that comparing the session's user ID against the vulnerable parameter isn't a sufficient solution. Every endpoint that receives an ID of an object should implement object-level authorization checks is a design line, not a review comment.

The second is resource consumption: API4:2023 Unrestricted Resource Consumption is both a denial-of-service problem and a cost problem, because no rate limit means an increase of operational costs. The third is property-level authorization — API3:2023 Broken Object Property Level Authorization, merging excessive data exposure and mass assignment into one root cause: more fields than the function needs. Threat-model the design, not just the code, because the trust boundaries you draw are the ones an attacker enumerates. AuthN/authZ, secrets, mTLS, and encryption at rest are their own post.

What it costs, and the availability you are buying

Put the dollar figure in the design document next to the availability target, because those are the same decision wearing different clothes. AWS Well-Architected frames cost optimization as a continual process of refinement and improvement over the span of a workload's lifecycle, with an explicit trade-off against speed to market the document must resolve, not defer. The lever that belongs in system design is matching supply to demand: on-demand versus reserved versus spot, right-sizing, and geographic choice all change the economics, and stopping idle resources saves a potential 75%. That sounds like procurement until you ask the architecture question behind it: can the system survive a region being off?

The availability table is the other half of the bill. Read next to the redundancy math the total is legible: redundancy buys exponential availability at linear cost until your failures correlate, the target buys minutes of allowed downtime, and the operating cost is the on-call load the design creates — which never appears in the spreadsheet and is usually the largest. Slow productivity in software engineering is the long version of why that load compounds. FinOps, tagging, and unit economics are their own post.

The System Design pillar — start here if you already know X

This post is the map, not the manual. Nine deep dives follow, each worth reading only if you cannot already do it: scalability, CAP, consistency, distributed systems, queues versus streams, databases, caching, observability, reliability.

One more thing no guide covers: the engine shipped as eight staged, independently reversible changes, each a written spec with a rollback. The consumer-facing site is tenant number one, and it reads its own tenant database directly rather than calling the platform's public API over HTTP — an internal caller should not pay a network hop, a rate limit, and an auth check for data it already owns. The alternatives I rejected and wrote down: a big-bang rewrite, a microservices split with a separate control plane in version one, forking the codebase per merchant, and doing nothing. Every change ended in a decision record. The ultimate guide to software engineering in 2026 is the wider map of the craft this sits inside.

Related Reading