Course contents

01. System Design Fundamentals Lesson 2 of 8

Functional and Non-Functional Requirements

See how measurable latency, throughput and availability targets turn a one-server design into a load-balanced N+1 design, and trace every box to a requirement.

12 minBeginner8 steps
Loading the interactive simulation…
Loading the knowledge check…

Summary

  • Functional requirements describe behaviour; at low load almost any design satisfies them.
  • Non-functional requirements are measurable targets: P95 latency at a stated load, peak throughput, availability, durability, cost.
  • The same design is correct at 20 req/s and wrong at 150 req/s: correctness is relative to the targets.
  • Requirements interact: enough capacity for the peak is not enough to survive a failure at the peak.
  • Every component should trace to a requirement; a component that traces to none is cost without a reason.
Deep diveHow it works, trade-offs, failure modes, misconceptions and the interview angle.

What it is

Functional requirements describe what a system does: its features, the inputs it accepts and the outputs it produces. "A user can create a note", "a user can list their notes", "an admin can delete any note".

Non-functional requirements (also called quality attributes) describe how well it does those things and under which constraints: latency, throughput, availability, durability, consistency, security, compliance, cost, operability. They are the requirements that decide the architecture. A single process on a laptop can implement every feature of most products; it cannot serve 50,000 requests per second, survive a data-centre fire or keep personal data inside the EU.

Why it exists

Without explicit targets, design discussions turn into arguments about taste. Should there be a cache? A queue? A second region? Each answer depends on numbers that nobody wrote down. Non-functional requirements turn those arguments into checks: does the design meet P95 under 200 ms at 150 requests per second? If yes, the cache is optional; if no, something must change.

Writing them down also exposes conflicts early. Low latency, strong consistency across regions and low cost pull against each other; a product team that wants all three has to choose before the design is built.

How it works

1. Collect the functional scope. List the core use cases and decide which are in scope. In an interview this is two to five features; in a real project it is a backlog, but the architecture is usually driven by a handful of hot paths (read a feed, write a message, check out a cart).

2. Turn every quality into a number. A useful non-functional requirement names a metric, a threshold, a percentile or period, and the load it applies to:

Vague Measurable
"Fast" P95 latency of GET /notes under 200 ms at 150 req/s
"Scalable" 150 req/s at peak, growing to 600 req/s within 18 months
"Always up" 99.9% of requests succeed per 30 days; losing one server or one zone causes no outage
"Doesn't lose data" An acknowledged write survives the loss of any one machine (RPO 0); restore from backup within 4 hours (RTO)
"Secure" All traffic over TLS 1.2+; personal data encrypted at rest; stored only in EU regions

Percentiles matter because averages hide the slow tail that users notice. The load matters because latency at 20 req/s says nothing about latency at 150 req/s.

3. Estimate. Back-of-the-envelope numbers connect requirements to resources: requests per second at peak (daily volume ÷ 86,400 × a peak factor), data growth per year, bandwidth, and the capacity of one instance. In the lesson one server handles about 125 req/s, so a 150 req/s peak needs two, and surviving one failure needs three.

4. Design to the targets, and test the design against them. Each non-functional requirement adds, sizes or rules out a component. In the lesson the throughput target added a load balancer and a second server; the availability target added a third. Then check every requirement against every failure you care about: a design that meets throughput with all servers healthy can still miss availability.

5. Keep the trace. Write the requirement next to the component it justifies. This makes reviews faster, shows what can be cut when budgets shrink, and tells the next engineer which numbers to re-check when the requirements change.

When to use it

Always, but proportionally. A weekend prototype needs one line of requirements; a payment system needs a document. In system design interviews, spend the first few minutes on functional scope and the key numbers (users, read/write ratio, peak load, latency target, availability, data size). Interviewers grade this step explicitly, and every later choice is easier to defend against it.

When not to

  • Do not invent precision you do not have. If nobody knows the peak load, state an assumption, label it as one and design so it can change.
  • Do not freeze requirements for a product still searching for users. Write the ones that are expensive to change later (data model, durability, compliance) and keep the rest loose.
  • Do not list every "-ility". A requirement nobody will measure or pay for is noise that hides the ones that matter.

Trade-offs

Requirement pushed harder Typically costs
Lower latency (P99 instead of P95, tighter thresholds) Caching and its staleness, more replicas closer to users, more capacity headroom
Higher availability (each extra nine) Redundancy in every tier, multi-zone or multi-region deployment, more operational work and money
Stronger consistency Higher write latency, lower availability during partitions (see CAP and PACELC)
Higher durability Synchronous replication or quorum writes, which add latency
Lower cost Less headroom, slower recovery, fewer regions

The job is not to maximise every quality but to meet the stated targets at acceptable cost, and to make the trade-offs visible to the people who set the targets.

Alternatives

  • User stories with acceptance criteria: functional scope plus testable conditions; non-functional criteria can be attached as "definition of done" rules.
  • Quality attribute scenarios (from the SEI's architecture methods): "when one server fails at peak, the system keeps serving with under 1% errors". These are non-functional requirements phrased as testable stimuli and responses.
  • SLOs: once a system runs, its non-functional requirements become service level objectives measured from real traffic, with error budgets that decide when reliability work beats feature work.

Failure modes

  • Unmeasurable requirements: "fast" and "scalable" cannot fail a review, so they never shape the design.
  • Averages instead of percentiles: an average of 80 ms can hide a P99 of two seconds.
  • Targets without load: latency measured on an idle system passes, then fails at the peak.
  • Testing only the happy path: throughput is met with every server healthy, and the first failure at peak becomes an outage.
  • Over-building: multi-region active-active for an internal tool with ten users. Cost and complexity without a requirement behind them.
  • Requirements drift: traffic grows tenfold, but nobody re-checks the design against the new number until it breaks.

In production

Teams express non-functional requirements as SLOs (for example, 99.9% of requests under 300 ms over 30 days), measure them as SLIs from real traffic and alert on burn rate. Load tests check throughput and latency targets before launch and after big changes; failure tests (stopping instances, failing a zone) check availability targets. Architecture decision records link each significant component to the requirement that drove it, so it can be revisited when that requirement changes.

Common misconceptions

  • "Non-functional means optional." They are often the hardest requirements to meet and the most expensive to retrofit.
  • "If it works, the design is right." It works at today's load and with every component healthy. Correctness is relative to the targets and the failures you must survive.
  • "More components make a better design." Each component should earn its place through a requirement; the rest is cost and operational risk.
  • "Availability comes from the load balancer." The balancer only routes around failures; the survivors still need capacity for the whole load.

Interview angle

Start every design by asking for scope and numbers: core features, daily active users, read/write ratio, peak requests per second, latency target and percentile, availability target, data size and retention, consistency needs. Write them on the board. Then, as you add each component, say which requirement it serves ("two servers for the 150 req/s peak, a third so we survive one failure"). When the interviewer changes a number, re-check the design against it out loud. That habit is what separates a design from a diagram.

Model assumptions

The simulation is a simplified model, not a benchmark. Each app server has 8 workers with a lognormal service time of 50 ms mean (cv 0.3) and room for 30 waiting requests; a worker also waits for its database call, so it is tied up about 60 ms per request, roughly 125 req/s per server. The database has 10 connections, 7 ms reads and 15 ms writes; 20% of requests are writes. Users are 10 ms from the service, internal hops take 2 ms. Arrivals are random (Poisson). The load balancer uses least connections and probes every 500 ms (2 failures eject, 2 successes restore). Utilisation is the fraction of busy workers, not CPU. The targets (P95 < 200 ms, 150 req/s, survive one server loss) are illustrative.

The lesson as textEvery step of the simulation, written out.
  1. 1. What the system must do

    We are building a notes service. Its functional requirements say what it does: users can create a note and read their notes back. Nothing about speed, size or failure.

    One app server and one database meet that completely. At 20 requests per second the server is about 15% busy, every request succeeds and P95 latency is around 100 ms. If functional requirements were all we had, we would be done.

    Scene: Users send 20 requests per second to one app server backed by a notes database. The server is lightly loaded, every request succeeds and P95 latency is about 100 ms.

    Key idea: Functional requirements describe behaviour: the features and the inputs and outputs. Almost any design can satisfy them at low load.

  2. 2. How well it must do it

    Non-functional requirements (quality attributes) say how well: how fast, how much, how often it may fail. They only help a design if they are numbers you can test. “Fast and always up” is a wish; these are requirements:

    - Latency: P95 under 200 ms - Throughput: 150 requests per second at peak - Availability: losing any one server must not cause an outage

    Today’s design meets the latency target, but only because traffic is 20 req/s. Nobody has checked it against the peak yet.

    Scene: The same one-server design, now labelled with three measurable targets: P95 under 200 ms, 150 requests per second at peak, and no outage when a server fails. It still serves 20 requests per second comfortably.

    Key idea: A non-functional requirement is a measurable target with a percentile or a load attached, not an adjective.

  3. 3. Test the design at the peak

    One second in, traffic climbs to the required 150 requests per second. One server can finish only about 125 per second (eight workers, each tied up about 60 ms per request).

    The queue fills, P95 shoots far past 200 ms and, once 30 requests are waiting, the server rejects the rest with 503. The functional behaviour has not changed at all; the throughput requirement alone makes this design wrong.

    Scene: Traffic rises to 150 requests per second. The single app server saturates, its queue fills, P95 latency rises far above 200 ms and some requests are rejected.

    Key idea: A design is only correct relative to its non-functional targets: the same boxes pass at 20 req/s and fail at 150.

  4. 4. The throughput target adds components

    To meet 150 req/s we add a second app server and a load balancer in front. Two servers can do about 250 req/s, so at the peak each is around 60% busy.

    P95 drops back to roughly 100 ms and nothing is rejected. Both new boxes exist because of one line in the requirements: *150 requests per second at peak*. That link is worth writing down next to the diagram.

    Scene: A load balancer spreads 150 requests per second over App 1 and App 2. Each is about 60% busy, nothing is rejected and P95 latency is back near 100 ms. Labels tie both new components to the throughput target.

    Key idea: Every component should trace back to a requirement. The balancer and App 2 trace to the throughput target.

  5. 5. The availability target is still unmet

    Now check the third requirement. One and a half seconds in, App 1 crashes. The balancer’s health checks take it out of rotation within about a second.

    But App 2 alone can do about 125 req/s and the peak is 150. Even after the balancer has done its job, App 2 is saturated and keeps rejecting requests. Two servers meet the throughput target, and miss the availability target.

    Scene: App 1 crashes. After the load balancer ejects it, App 2 receives all 150 requests per second, saturates and keeps rejecting requests.

    Key idea: Requirements interact: capacity that is just enough for the peak leaves nothing for a failure at the peak.

  6. 6. The availability target adds a spare

    App 1 is repaired and we add App 3: three servers where two would carry the peak. That is N+1: N servers for the load, plus one for failure.

    Same crash, same moment. Requests sent to App 1 before it is ejected still fail (the detection window), and then the two survivors carry 150 req/s at about 60% each. Errors stop and P95 stays under 200 ms. App 3 traces to the availability target, not to throughput.

    Scene: Three app servers share the load. App 1 crashes; a few requests fail until it is ejected, then App 2 and App 3 carry all 150 requests per second with no errors and P95 under 200 ms.

    Key idea: N+1 capacity is what turns “survive one failure” into a component on the diagram.

  7. 7. Every box has a reason

    All three servers are healthy again, at the full 150 req/s. Read the labels: each component points at the requirement that put it there.

    - Notes DB: functional (notes must be stored) - Load balancer, App 2: throughput (150 req/s) - App 3: availability (one server may fail)

    This is how you defend a design in a review or an interview. It also shows what to remove: a component that traces to no requirement is cost without a reason.

    Scene: Users, a load balancer, three app servers and the notes database, each labelled with the requirement it satisfies. At 150 requests per second every request succeeds and P95 latency is about 100 ms.

    Key idea: Draw the requirement next to the component it justifies. No requirement, no component.

  8. 8. Requirements drive the design

    Functional requirements fixed *what* the service does; one server did that. The non-functional ones fixed *how well*, and each one changed the picture: the throughput target added a balancer and a server, the availability target added a spare.

    Ask for the numbers first: peak load, the latency percentile that matters, the availability target, data size and retention, consistency needs, budget. Then design to them, and no further. Over-building for a requirement nobody has is as much a design error as missing one.

    Scene: The final design at 150 requests per second: a load balancer, three app servers and a database. Every request succeeds and P95 latency is well under 200 ms.

    Key idea: Ask for numbers first, then let each number justify (or rule out) a component.