Study guide · System design

Study guide: functional and non-functional requirements

Turn user journeys into testable behavior and measurable quality targets, then trace them to design decisions and evidence.

Contents
  1. ·Learning objectives
  2. §1Core concepts
  3. §2Establish scope and user outcomes
  4. §3Specify behavior as a testable contract
  5. §4Translate demand into capacity requirements
  6. §5State measurable quality targets
  7. §6Prioritize, trace, and verify requirements
  8. ·Common mistakes
  9. ·Practice questions
  10. ·Review checklist

· · Start here

Learning objectives

  1. Distinguish a functional requirement, a quality requirement, and a design constraint in a system design brief.
  2. Define system boundaries, actors, user journeys, assumptions, and non-goals before choosing components.
  3. Turn a user journey into testable behavior, including state changes, failure responses, and invariants.
  4. Calculate average and peak demand from usage assumptions and use the result to state capacity targets.
  5. Express latency, availability, recovery, consistency, durability, security, and cost as measurable requirements for specific operations.
  6. Prioritize competing requirements, trace them to design decisions, and verify them with appropriate evidence.

§1 · Definitions

Core concepts

This section defines the three kinds of statement that shape a system design: required behavior, required quality, and imposed constraints.

“A customer can place an order” names a behavior. “At least 99.9% of eligible order attempts complete correctly within 500 ms in a rolling 30-day window” names a quality target for that behavior. “Payment must use the existing provider” limits implementation choices. A useful design connects all three: it says what must happen, under what conditions, and within which boundaries.

The frequent confusion is to call any sentence without a feature verb “non-functional.” A database choice is ordinarily a proposed design decision, while a mandated database is a constraint. “Fast” is an aspiration until the operation, percentile, threshold, load, and measurement point are stated. Requirements describe what the design must satisfy; the architecture is the proposed way to satisfy it.

§2 · Scope and outcomes

Establish scope and user outcomes

Begin with the actor and the outcome. An online shop may let a customer search for a product, reserve stock, pay, and receive an order confirmation. A warehouse system and a payment provider cross the system boundary, so the design must say which side owns each transition and what happens when an external response is delayed. Naming the boundary prevents a dependency's behavior from being mistaken for a guarantee the shop itself can make.

The diagram maps a journey to the boundary and the two external dependencies.

System flow
Customer → Shop: browse → submit order → receive confirmation
                 │             │
                 │             ├──→ Payment provider: authorize payment
                 └─────────────└──→ Warehouse system: reserve stock

Read the top line as the customer-visible outcome; the lower calls are supporting work whose ownership and failure behavior need separate requirements. The diagram does not prescribe synchronous calls or a service layout. Those choices come after the outcome and quality targets are known.

State assumptions and non-goals where they affect the design. For example, assuming that a customer can hold only one active basket changes the data model; excluding international delivery removes tax and shipping paths. Confirm high-impact assumptions with stakeholders or usage data before treating them as facts. A non-goal should bound the current scope, not hide an unresolved requirement.

§3 · Behavior contracts

Specify behavior as a testable contract

A functional requirement needs more than a feature name. Specify the trigger, required input, authorization, result, state change, and responses to expected errors. “Place order” becomes: an authenticated customer submits a basket; the system creates one order with a stable identifier, reserves available stock, records the payment outcome, and returns a confirmation only after the promised state is durable. If stock is unavailable, the customer receives a clear rejection and no payment is captured. The exact sequence is a domain decision to validate, but the requirement must resolve it.

The state diagram shows the allowed order outcomes for this example.

System flow
Basket submitted → Pending → Confirmed
                      │           │
                      └→ Rejected  └→ Cancelled

The branches separate rejection before confirmation from cancellation afterward. For each arrow, name who can trigger it and which side effects must occur. An invariant might say that confirmed quantity never exceeds reserved quantity; another might say that the same customer command does not create two paid orders. These rules are often more informative than a list of endpoints because they expose where concurrency, retries, and external failures threaten correctness.

Worked examplerefine a feature request

Consider the request “customers can cancel an order.” Assume cancellation is permitted only before shipment, and assume a captured payment must be refunded. The actor is the customer; the trigger is a cancellation command carrying an order identifier. An acceptance criterion is: if the order is confirmed and not shipped, the system records a cancellation and starts a refund exactly once; if it is already shipped, the system rejects cancellation with a reason; repeating the same command returns the existing cancellation outcome. Check the requirement by testing the confirmed, shipped, and repeated-command cases. The assumptions about shipment and refunds must be agreed with the business before implementation.

§4 · Demand and capacity

Translate demand into capacity requirements

The functional journeys identify the operations to count. Convert daily users and actions into separate read and write rates, then estimate the peak for the relevant time window. Record payload sizes, storage growth, and fan-out where they matter. An average alone is a poor capacity target because users arrive unevenly, and a single global request rate hides the component that receives disproportionate work.

Worked exampledaily actions to peak rates

Consider a service with 2 million daily active users. Assume each user makes 12 reads and 2 writes per day; assume a peak hour whose per-second rate is four times the full-day average. Daily reads are 2,000,000 × 12 = 24,000,000; daily writes are 2,000,000 × 2 = 4,000,000. A day has 24 × 60 × 60 = 86,400 seconds, so average rates are 24,000,000 ÷ 86,400 ≈ 278 reads/s and 4,000,000 ÷ 86,400 ≈ 46 writes/s. Applying the assumed peak factor gives about 278 × 4 = 1,112 reads/s and 46 × 4 = 184 writes/s. Using unrounded values gives about 1,111 reads/s and 185 writes/s; those are the better sizing figures. The read-to-write ratio is 24,000,000 ÷ 4,000,000 = 6:1. Check: the peak rate is four times each unrounded average, and the daily counts preserve the same 6:1 ratio.

If a write stores 2 KB of new data, assume decimal kilobytes for this estimate. New logical data is 4,000,000 × 2,000 bytes = 8,000,000,000 bytes, or 8 GB per day. Over 365 days that is 8 × 365 = 2,920 GB, or 2.92 TB, before indexes, replicas, backups, and retention rules. State a headroom target and a growth horizon separately; neither follows automatically from the peak factor.

§5 · Quality targets

State measurable quality targets

Qualities must attach to a named operation and a measurement rule. A search response might have a p99 latency target under a stated peak load while checkout has a slower limit and stricter correctness rule. The percentile needs a population and measurement point; averaging host-level p99 values does not produce the fleet p99. An SLO for checkout should count eligible attempts and define a good result, since an HTTP success response can still hide a missing order.

Reliability targets are distinct. Availability describes delivered service during the measurement window. RTO and RPO describe recovery after a specified disruption. A service can meet a monthly availability target and still lose an unacceptable amount of data, so state each separately. Consistency likewise belongs to an operation: a customer reading an accepted order may require the latest committed state, while a product popularity count may tolerate a specified delay. Durability should say whether an acknowledged order survives a process restart, zone loss, or another named event.

Security and privacy also need observable rules. Specify who may perform each sensitive operation, which data may be stored, how long it is retained, when it is deleted, and whether an audit record is required. Where regulation applies, identify the actual obligation rather than writing “compliant” as a placeholder. Cost can be a constraint or a quality target, such as a maximum monthly spend at a stated workload; making that workload explicit keeps the target testable.

The following comparison helps separate targets that are often conflated.

Requirement Example of a testable statement Evidence
Latency Checkout p99 is under 500 ms at the agreed peak arrival rate. End-to-end latency distribution under representative load.
Availability At least 99.9% of eligible checkout attempts are good in a rolling 30-day window. Count of good and eligible attempts at the user-facing boundary.
RTO Service is restored within 30 minutes after a zone outage. Timed failover exercise.
RPO No more than 5 minutes of accepted writes are lost after that outage. Reconciliation after a recovery exercise.
Consistency A confirmed order is visible to its customer on the next read. Concurrent write/read and failover tests.

The evidence column turns each statement into a design obligation. A proposed cache, replica, queue, or failover path is credible only if it can be checked against the relevant rule. The example targets are illustrative and must be set from product needs and measured behavior, rather than treated as universal thresholds.

Worked exampleinterpret an availability target

Consider a time-based target of 99.9% availability over an assumed 30-day month. The unavailable share is 1 − 0.999 = 0.001. The window has 30 × 24 × 60 = 43,200 minutes; the allowed unavailable time is 43,200 × 0.001 = 43.2 minutes. Check: 43,200 − 43.2 = 43,156.8 available minutes, and 43,156.8 ÷ 43,200 = 0.999. This time budget does not equal a request-based error budget unless traffic is uniform and both definitions count the same failures.

§6 · Trace and verify

Prioritize, trace, and verify requirements

Requirements can conflict. A strict freshness guarantee can add coordination latency; a short RTO may require standby capacity that raises cost; aggressive retention can conflict with a deletion obligation. Resolve these by identifying the affected journey, choosing the acceptable trade-off, and recording who agreed to it. Rank the core behaviors and the qualities that protect them before optimizing an edge case. An assumption with large architectural consequences should be validated early, even when its priority appears low.

Trace a small set of consequential requirements through the design. For example, “a confirmed order is visible on the next read” implies an authoritative read path or a way to keep any cache current; a test should issue a write followed immediately by a read under normal operation and during failover. “Checkout p99 under 500 ms at peak” implies a measured end-to-end path and a load test with the agreed read/write mix. When a test fails, revise either the design or the requirement through an explicit product decision. Do not silently weaken the measurement rule.

The diagram shows the feedback loop from statement to evidence.

System flow
User outcome → requirement → design decision → test or measurement
      ↑                                             │
      └──────────── revise with evidence ──────────┘

Read the loop as an ongoing design process, not a one-time sign-off. Measurements can overturn a peak-factor assumption, a failure drill can expose an RTO miss, and a changed product journey can alter which operations need strong consistency. Keeping the links visible makes later changes explainable.

· · Review

Common mistakes

Calling a solution a requirement. A team may write “use a distributed cache” before it knows the read latency, freshness, or load target. This happens because a familiar component feels concrete. State the required outcome and quality first, then compare solutions against it; use a mandated component only when it is truly a constraint.

Writing qualities as adjectives. “Highly available” and “fast” omit the affected operation, load, measurement point, and window. They cannot be tested, so design discussions settle on different hidden assumptions. Define a good result and numeric target for the journey that matters.

Sizing from daily averages alone. Dividing daily requests by 86,400 is useful, but it conceals peaks, skewed keys, and background fan-out. Separate reads and writes, apply a justified peak assumption, and test the design at that mix with headroom.

Omitting failure and repeated-command behavior. A happy-path requirement can pass while retries create duplicate orders or partial failures leave a payment without a confirmation. Specify state transitions, invariants, and observable error outcomes, then test those paths as part of the functional contract.

Treating every quality target as global. Search, checkout, and reporting often need different freshness and latency guarantees. A single universal target either raises cost unnecessarily or leaves the important journey underprotected. Attach each target to the operation and failure class it is meant to govern.

· · Exercises

Practice questions

These questions mix recall, calculation, and application across the guide; each answer is collapsed beneath its question to be opened after working out an answer.

Question 1 · distinction

Classify these statements: “A customer can return an item,” “Returns complete within 2 seconds at p99 under peak load,” and “The system must use the existing payment provider.”

Answer

The first is a functional requirement because it specifies behavior. The second is a non-functional requirement because it sets a measured quality of that behavior, although the peak rate and measurement point still need values. The third is a design constraint because it restricts the permitted implementation.

Question 2 · application

A customer submits an order, receives a timeout, and retries. Which details belong in the functional contract before an endpoint is designed?

Answer

Define whether the first attempt may have succeeded, how the retry identifies the same logical command, whether one or two orders may be created, what payment and stock state must hold, and what response the retry returns. A useful invariant is that one logical order command creates at most one paid order. Test both a timeout before the order commits and a timeout after it commits.

Question 3 · calculation

A service has 900,000 daily users making 8 reads and 1 write each. Assuming a peak rate three times the daily average, estimate peak reads and writes per second and the read-to-write ratio.

Answer

Daily reads are 900,000 × 8 = 7,200,000 and daily writes are 900,000 × 1 = 900,000. Dividing by 86,400 gives about 83.33 reads/s and 10.42 writes/s on average. At the assumed threefold peak, the rates are 83.33 × 3 ≈ 250 reads/s and 10.42 × 3 ≈ 31.25 writes/s. The ratio is 7,200,000 ÷ 900,000 = 8:1. The peak rates retain that ratio: 250 ÷ 31.25 = 8.

Question 4 · misconception

Why does a 99.9% availability objective not by itself guarantee that a confirmed order survives a zone outage?

Answer

Availability measures whether the defined service result is delivered during a window. It does not state what accepted data survives a failure. The design needs a durability rule and an RPO for the zone outage, plus recovery evidence that checks the acknowledged orders against the restored state.

Question 5 · open-ended

An online shop adds a flash sale and promises that a confirmed order is immediately visible, while product popularity counts may lag. Describe the requirements you would clarify, two design consequences, and how you would verify them.

Answer

Clarify the flash-sale peak arrival rate, read/write mix, p99 targets, inventory oversell rule, meaning of confirmation, permissible popularity-count lag, and failure behavior when payment or stock reservation is delayed. The immediate order read requires an authoritative or coherently updated read path; the popularity counter can use asynchronous updates with a bounded freshness target. Peak demand may also require admission control or capacity headroom. Verify the order invariant and read-after-confirmation behavior with concurrent requests and failover tests, then load-test at the stated peak mix while measuring end-to-end latency and counter lag.

· · Finish

Review checklist

Without consulting notes, identify actors and the system boundary; separate behavior, quality targets, and constraints; turn a journey into state transitions, errors, and invariants; calculate average and peak rates with explicit assumptions; state operation-specific latency, availability, recovery, consistency, durability, security, and cost rules; and connect each consequential requirement to a design decision and a test. A reader who can do all of these has covered the material.