Requirements: Functional vs Non-Functional
Every system design starts with a question that sounds almost too simple: what are we actually building, and how well does it need to work?
Beginners skip this step. They hear "design a chat app" and immediately draw a load balancer, three servers, a Redis box and a Kafka cluster. Experienced engineers do the opposite. They spend the first part of any design — whether it is a 45-minute interview or a three-month project — pinning down the requirements, because every box on the diagram should exist because a requirement demands it.
This lesson teaches you how to find, write, measure and prioritize requirements. It is the step that comes right before System Design Characteristics, which explains the quality attributes (scalability, availability, latency and so on) in depth. Here we focus on how to turn those attributes into concrete, testable targets for your system.
What Requirements Are
A requirement is a statement of something the system must do or a property it must have, agreed on by the people who will build, run and use it.
Requirements come in two families:
| Family | Question it answers | Example |
|---|---|---|
| Functional requirements (FRs) | What does the system do? | "A user can upload a photo and add a caption." |
| Non-functional requirements (NFRs) | How well does it do it? | "95% of photo uploads complete within 2 seconds." |
A handy way to remember the difference: functional requirements are verbs (upload, send, search, pay), non-functional requirements are adverbs (quickly, reliably, securely, cheaply).
Why Design Starts Here
The cost of building the wrong thing grows the later you discover it. A misunderstanding caught during a whiteboard conversation costs five minutes. The same misunderstanding caught after launch can cost a rewrite.
| When the mistake is found | Typical cost to fix |
|---|---|
| During requirements discussion | Minutes — change a sentence |
| During design review | Hours — redraw a diagram |
| During implementation | Days to weeks — rewrite code |
| After launch | Weeks to months — migrate live data, keep users happy, possibly rebuild |
Consider a real-world style example. A team builds a messaging feature on a database that offers eventual consistency, because "chat doesn't need strong consistency." Three months later, product asks for message editing with an audit trail for compliance. Suddenly ordering and durability guarantees matter a lot, and the storage layer needs to change. Nobody asked the compliance question at the start.
The Chain: Requirements → Constraints → Decisions
Requirements are not paperwork. They are the input to every design decision.
graph LR
R["Requirements<br/>what and how well"] --> C["Constraints<br/>budget, team, regulations"]
C --> D["Design decisions<br/>databases, caching, replication"]
D --> A["Architecture<br/>the diagram"]
A -->|"validate against"| R
- A requirement says "reads must be fast for users worldwide."
- A constraint says "we have a two-person team and a small budget."
- The decision becomes "use a managed CDN and a managed database instead of running our own multi-region cluster."
Notice the arrow back: once you have an architecture, you check it against the requirements. If a box does not serve any requirement, it is probably gold-plating. If a requirement is not served by any box, the design is incomplete.
Functional Requirements
Functional requirements describe the behaviour of the system: the features, the actions users can take, and the data that goes in and comes out.
Actors, User Stories and Use Cases
Three tools help you discover functional requirements.
1. Actors. Who (or what) interacts with the system? Actors are not just end users. They include admins, support staff, other services, scheduled jobs and third-party systems.
For a ride-hailing app the actors are: rider, driver, support agent, payment provider, maps provider, and the internal fraud-detection service.
2. User stories. A short sentence in the form:
As a [actor], I want to [action] so that [benefit].
- "As a rider, I want to see my driver's location in real time so that I know when to go outside."
- "As a driver, I want to accept or reject a ride request so that I only take trips I can do."
The "so that" part is important. It explains the why, which helps you decide later whether a cheaper implementation still satisfies the need.
3. Use cases. A more detailed, step-by-step description of an interaction, including what happens when things go wrong.
Use case: Request a ride
Actor: Rider
Preconditions: Rider is logged in and has a valid payment method.
Main flow:
1. Rider enters a destination.
2. System shows price estimate and ETA.
3. Rider confirms.
4. System finds nearby available drivers and sends the request.
5. A driver accepts; system notifies the rider with driver details.
Alternative flows:
4a. No driver accepts within 60 seconds -> system widens search radius.
4b. Still no driver after 3 minutes -> system tells rider "no cars available".
3a. Payment method declined -> system asks rider to update payment.
The alternative flows are where most real complexity lives. Writing them down early surfaces questions like "what happens if two drivers accept at the same time?" — which turns out to be a concurrency problem your design must handle.
APIs as Functional Contracts
Once you know the actions, you can express them as an API. An API is a precise, testable version of the functional requirements: each endpoint is a promise about what the system does.
POST /v1/rides -> request a ride
body: { pickup, destination, payment_method_id }
returns: { ride_id, status: "searching", estimate }
POST /v1/rides/{ride_id}/accept -> driver accepts
GET /v1/rides/{ride_id} -> current status and driver location
POST /v1/rides/{ride_id}/cancel -> rider or driver cancels
Writing the API early forces you to decide details that vague sentences hide: Is cancellation allowed after the driver arrives? Does "request a ride" need to be safe to retry if the network drops? (It should — see idempotency.)
FRs become APIs, NFRs become numbers
A good habit: every functional requirement should map to at least one API call or background job, and every non-functional requirement should map to at least one number you can measure.
How to Write Good Functional Requirements
A good functional requirement is:
| Quality | Bad | Good |
|---|---|---|
| Specific | "Users can share stuff." | "A user can share a photo with followers or with a specific list of users." |
| Testable | "Search works well." | "Searching by username returns matching accounts, prefix match, case-insensitive." |
| Scoped | "Support messaging." | "One-to-one and group messaging up to 256 members. Voice and video are out of scope." |
| Prioritized | Everything listed as equal | Each item tagged must-have, should-have or could-have |
| Free of design | "Store messages in Cassandra." | "Messages are retained for 1 year and can be searched by the sender." |
The last row deserves emphasis. A requirement says what, not how. "Use Cassandra" is a design decision; putting it in the requirements locks you in before you have even compared options.
Equally important is writing down what is out of scope. An explicit "not doing" list prevents scope creep and, in interviews, shows the interviewer that you made a deliberate choice rather than forgetting.
Worked Example 1: URL Shortener
Prompt: "Design a URL shortener like bit.ly."
| # | Functional requirement | Priority |
|---|---|---|
| F1 | Given a long URL, the system returns a short URL (e.g. sho.rt/aB3x9Q). | Must |
| F2 | Visiting a short URL redirects to the original long URL. | Must |
| F3 | Users can optionally choose a custom alias. | Should |
| F4 | Links can have an optional expiry date. | Should |
| F5 | Link owners can see click counts per day. | Could |
| — | User accounts with teams and permissions | Out of scope |
| — | Editing the destination after creation | Out of scope |
API sketch:
POST /v1/links { long_url, custom_alias?, expires_at? } -> { short_url }
GET /{code} -> 301/302 redirect to long_url
GET /v1/links/{code}/stats -> { clicks_by_day: [...] }
Notice how F5 (analytics) quietly influences the design: if you need click counts, every redirect must record an event, which pushes you toward a 302 (temporary) redirect rather than a cacheable 301, or toward logging at the edge.
Worked Example 2: Chat App
Prompt: "Design a chat app like WhatsApp."
| # | Functional requirement | Priority |
|---|---|---|
| F1 | Users can send text messages one-to-one. | Must |
| F2 | Users can create groups (up to 256 members) and send messages to them. | Must |
| F3 | Messages are delivered in real time when the recipient is online. | Must |
| F4 | Messages sent while the recipient is offline are delivered when they reconnect. | Must |
| F5 | Senders see delivery status: sent, delivered, read. | Should |
| F6 | Users see whether contacts are online ("last seen"). | Should |
| F7 | Users can send images and short videos. | Could |
| — | Voice and video calls | Out of scope |
| — | End-to-end encryption key management details | Out of scope for this round |
F3 and F4 together tell you a lot: you need persistent connections for online users (for example WebSockets) and durable storage for undelivered messages. A beginner who only writes "users can chat" misses F4 and designs a system that silently loses messages.
Worked Example 3: Ride-Hailing App
Prompt: "Design Uber."
| # | Functional requirement | Priority |
|---|---|---|
| F1 | Riders can request a ride from a pickup to a destination. | Must |
| F2 | The system matches the request to a nearby available driver. | Must |
| F3 | Drivers send their location periodically while online. | Must |
| F4 | Riders see the driver's live location and ETA. | Must |
| F5 | The rider is charged when the trip ends. | Must |
| F6 | Riders and drivers can rate each other. | Should |
| F7 | Surge pricing based on demand in an area. | Could |
| — | Scheduled rides, ride sharing (pool) | Out of scope |
F3 is the hidden giant. If 1 million drivers are online and each sends a location every 4 seconds, that is 250,000 location writes per second — far more than ride requests. Requirements analysis just told you where the load is before you drew a single box.
Non-Functional Requirements
Non-functional requirements (also called quality attributes) describe how well the system must perform its functions. Two systems with identical features can need completely different architectures because their NFRs differ: a hobby URL shortener and bit.ly have the same FRs but very different NFRs.
The single most important rule:
An NFR without a number is a wish
"The system should be fast" cannot be tested, cannot be designed for, and cannot be argued about productively. "p99 read latency under 200 ms" can.
Below is each common NFR with a definition, how to make it measurable, and an example target. For the deeper theory behind each attribute, see System Design Characteristics.
Performance: Latency and Throughput
Latency is how long a single request takes. Throughput is how many requests the system handles per unit of time.
Never specify latency as an average. Averages hide the slow requests that users actually complain about. Use percentiles:
| Percentile | Meaning | Who it describes |
|---|---|---|
| p50 (median) | Half of requests are faster than this | The typical user experience |
| p95 | 95% of requests are faster | The "usually fine" boundary |
| p99 | 99% are faster; 1 in 100 is slower | Your heaviest users — they make the most requests, so they hit the tail most often |
| p99.9 | 1 in 1,000 is slower | Matters when one page triggers many backend calls |
Why the tail matters: if loading one page makes 50 backend calls, and each has a 1% chance of being slow, the chance that at least one is slow is 1 - 0.99^50 ≈ 40%. Your p99 backend latency becomes roughly your p60 page latency.
How to make it measurable: state the percentile, the threshold, the operation and the measurement point.
- Example target: "p95 latency for
GET /feedunder 300 ms, p99 under 800 ms, measured at the load balancer." - Example throughput target: "Sustain 20,000 reads/s and 2,000 writes/s at peak with headroom of 2×."
Scalability
Scalability is the ability to handle growth by adding resources rather than redesigning.
How to make it measurable: state current load, expected growth, and the time horizon.
- Example target: "Support 5 M DAU at launch, growing to 50 M within 2 years, without architectural changes; adding capacity must not require downtime."
"Must scale" on its own means nothing. "Must handle 10× today's peak within 18 months" tells you whether a single database is fine (often yes!) or whether you need sharding from day one.
Availability
Availability is the percentage of time the system is usable. It is usually expressed in "nines".
| Availability | Downtime per year | Downtime per 30-day month | Typical use |
|---|---|---|---|
| 99% ("two nines") | 3.65 days | 7.2 hours | Internal tools, batch jobs |
| 99.9% ("three nines") | 8.76 hours | 43.2 minutes | Most SaaS products |
| 99.95% | 4.38 hours | 21.6 minutes | Business-critical SaaS |
| 99.99% ("four nines") | 52.6 minutes | 4.3 minutes | Payments, core cloud services |
| 99.999% ("five nines") | 5.26 minutes | 26 seconds | Telecom, critical infrastructure |
Each extra nine costs roughly an order of magnitude more effort. At 99.99% you have about four minutes a month — less time than it takes a human to wake up, log in and read an alert. That level requires automatic failover, not heroics.
How to make it measurable: define what "available" means (which endpoints, what counts as a failure) and the window.
- Example target: "99.95% of
POST /checkoutrequests succeed (non-5xx, under 5 s) over a rolling 30 days."
Reliability
Reliability is doing the correct thing consistently — not just responding, but responding correctly. A system that is "up" but charges customers twice is available but not reliable.
How to make it measurable: error rates, correctness checks, mean time between failures (MTBF) and mean time to recovery (MTTR).
- Example target: "Fewer than 1 in 1,000,000 payments double-charged; MTTR for a failed node under 5 minutes."
Durability
Durability is the guarantee that data, once acknowledged, is not lost.
How to make it measurable: probability of loss per object per year, plus recovery objectives:
-
RPO (Recovery Point Objective): how much data you can afford to lose, measured in time. RPO = 0 means no acknowledged write may ever be lost.
-
RTO (Recovery Time Objective): how long recovery from a disaster may take.
-
Example target: "Uploaded photos have 99.999999999% (11 nines) annual durability; database RPO under 1 minute, RTO under 1 hour for a full region loss."
Consistency
Consistency describes what readers see after a write. Strong consistency means every read sees the latest write; eventual consistency means readers may briefly see stale data. See consistency models for the full spectrum.
How to make it measurable: state the guarantee per operation, plus a staleness bound when eventual is acceptable.
- Example targets: "Account balance reads are strongly consistent." "Like counts may be stale by up to 10 seconds." "A user always sees their own posts immediately (read-your-writes)."
The key beginner insight: consistency is chosen per feature, not per system. The same app can need strong consistency for payments and be happy with eventual consistency for follower counts.
Security and Privacy
Security protects the system against unauthorized access and attack; privacy governs how personal data is collected, used and shared.
How to make it measurable: turn principles into checkable controls.
- "All traffic uses TLS 1.2+; data at rest encrypted with AES-256."
- "Users can only read messages in conversations they belong to (authorization checked on every request)."
- "Login endpoint rate-limited to 10 attempts per minute per account."
- "Personal data never written to logs; access to production data audited."
See Security in Design for how these shape architecture.
Compliance
Compliance requirements come from laws, regulations and industry standards. They are non-negotiable and often have big architectural effects.
| Regulation / standard | Applies to | Typical design impact |
|---|---|---|
| GDPR (EU) | Personal data of people in the EU | Right to deletion across all stores and backups, data residency, consent tracking — see GDPR engineering |
| PCI DSS | Card payment data | Isolate card data in a small "cardholder data environment", or avoid storing it at all by tokenizing via a payment provider — see PCI DSS |
| HIPAA (US) | Health data | Encryption, access audit logs, business associate agreements with vendors |
| SOC 2 | B2B SaaS selling to enterprises | Change management, access reviews, monitoring evidence — see SOC 2 |
- Example target: "A user deletion request removes their personal data from all primary stores within 30 days."
Maintainability
Maintainability is how easily the team can understand, change and operate the system.
How to make it measurable: delivery metrics.
- Example targets: "A new engineer can ship a change to production in their first week." "Deploys happen at least daily with under 15 minutes from merge to production." "Change failure rate under 15%."
Observability
Observability is how well you can understand what the system is doing from the outside — through metrics, logs and traces. It is an NFR because without it you cannot verify any of the other NFRs.
How to make it measurable:
- Example targets: "Every request carries a trace ID across services." "An on-call engineer is alerted within 2 minutes of an SLO burn." "Dashboards show p50/p95/p99 latency and error rate per endpoint."
Cost
Cost is a real requirement, even though beginners rarely list it. Every nine of availability, every millisecond of latency and every extra replica has a price.
How to make it measurable: budget per month, or cost per unit of business value.
- Example targets: "Infrastructure under $20,000/month at launch." "Storage and delivery cost under $0.01 per active user per month."
See The Cost of Scale.
Portability and Usability (Briefly)
- Portability: how easily the system can move between environments or providers. Example: "Runs on any Kubernetes cluster; no proprietary database features outside an adapter layer." Only worth paying for if multi-cloud or on-premise deployment is a real business need.
- Usability and accessibility: how easily people can use the product. Example: "Meets WCAG 2.1 AA; the core flow works on a 3G connection in under 5 seconds." Often owned by product and design, but it affects backend choices like payload size and offline support.
NFR Summary Table
| NFR | Vague version | Measurable version |
|---|---|---|
| Latency | "Fast" | p99 GET /item under 150 ms at the edge |
| Throughput | "Handles lots of traffic" | 50,000 req/s peak, 2× headroom |
| Scalability | "Must scale" | 10× growth in 2 years without redesign |
| Availability | "Always up" | 99.95% successful requests per 30 days |
| Reliability | "Works correctly" | Under 0.01% failed jobs, MTTR under 10 min |
| Durability | "Never lose data" | RPO 0 for orders, 11 nines for blobs |
| Consistency | "Accurate" | Strong for balances, under 5 s staleness for counters |
| Security | "Secure" | TLS everywhere, authz on every request, audited admin access |
| Compliance | "Legal" | GDPR deletion within 30 days, no raw card numbers stored |
| Maintainability | "Clean" | Daily deploys, under 15 min lead time |
| Observability | "Monitored" | Per-endpoint p99 and error-rate dashboards, alert within 2 min |
| Cost | "Cheap" | Under $0.01 per MAU per month |
Making NFRs Concrete: SLIs, SLOs, SLAs and Error Budgets
Site Reliability Engineering gives us a precise vocabulary for turning NFRs into numbers. This is covered fully in SLI / SLO / SLA Engineering and Error Budgets; here is what you need as a designer.
graph TD
SLI["SLI: Service Level Indicator<br/>a measurement"] --> SLO["SLO: Service Level Objective<br/>an internal target for the SLI"]
SLO --> SLA["SLA: Service Level Agreement<br/>a contract with consequences"]
SLO --> EB["Error budget<br/>100% minus SLO"]
| Term | What it is | Example |
|---|---|---|
| SLI | A metric that reflects user experience | Fraction of GET /feed requests that return 2xx in under 300 ms |
| SLO | A target value for an SLI over a window | 99.9% of those requests meet the SLI over 30 days |
| SLA | A promise to customers with penalties | 99.5% monthly availability, or a 10% service credit |
| Error budget | The allowed failure: 100% − SLO | 0.1% of requests ≈ 43 minutes of full outage per 30 days |
Two important relationships:
- The SLA is looser than the SLO. If you promise customers 99.9% and your internal target is also 99.9%, every bad month costs money. Teams typically aim internally for a stricter SLO (say 99.95%) and promise a looser SLA (99.9%) so there is a safety margin.
- The error budget is a decision tool. If the team has spent only 10% of this month's budget, it can ship risky changes faster. If the budget is exhausted, releases slow down and reliability work takes priority. This turns the endless "features vs stability" argument into a number.
Translating Vague Words into Numbers
Stakeholders rarely speak in percentiles. Part of your job is translation.
| What they say | Questions to ask | What you write down |
|---|---|---|
| "It should be fast." | Which action? Fast compared to what? On what network? | p95 page load under 1.5 s on 4G; p99 API under 200 ms |
| "It should always be up." | What does an hour of downtime cost? Which features are critical? Is a maintenance window acceptable? | 99.95% for checkout, 99.5% for recommendations |
| "It should handle lots of users." | How many today? How many at peak? What growth? Any spikes, like launches or sales? | 2 M DAU, peak 3× average, 10× spike on sale days |
| "We can't lose data." | Which data? Is losing the last minute of analytics acceptable? | RPO 0 for orders, RPO 1 h for analytics events |
| "It must be secure." | Which data is sensitive? Which regulations apply? Who are the threats? | PII encrypted at rest, PCI scope minimized, SOC 2 controls |
A powerful trick is to ask about cost of failure instead of desired uptime. "What happens if checkout is down for 10 minutes on a Saturday?" produces a far more honest answer than "how available should it be?" — to which everyone answers "100%."
Back-of-the-Envelope from Requirements
Once you have numbers for users and behaviour, you can derive load, storage and bandwidth. This is the bridge from requirements to capacity, covered step by step in Estimation Practice and Capacity Planning.
Using the URL shortener:
Requirement: 100 M new links per month, read:write ratio 100:1
Writes: 100 M / (30 * 86,400 s) ≈ 40 writes/s (peak ~ 3x = 120/s)
Reads: 40 * 100 ≈ 4,000 reads/s (peak ~ 12,000/s)
Storage: 100 M * 12 months * 5 years * 500 bytes ≈ 3 TB over 5 years
Three numbers, one minute of arithmetic, and you already know that: writes are trivial, reads dominate (so caching is the main lever), and storage fits on a single modest database. That is a very different design than you might have drawn from "design bit.ly" alone.
The read:write ratio is a requirement
Always ask for it, or estimate it. A 100:1 read-heavy system points to caches, replicas and CDNs. A 1:1 or write-heavy system (logging, metrics, location updates) points to write-optimized storage, partitioning and queues.
Constraints vs Assumptions vs Requirements
These three words are often mixed up. They are different things and should be written in different sections of a design document.
| Concept | Definition | Can you change it? | Example |
|---|---|---|---|
| Requirement | Something the system must do or be | Negotiable with stakeholders | "p99 search latency under 300 ms" |
| Constraint | A limit on how you can build it, imposed from outside | Usually not | "Must launch by March", "Team of 4", "Budget $10k/month", "Must run on our existing AWS account", "Data must stay in the EU" |
| Assumption | Something you believe is true but have not verified | Must be validated | "Most users are on mobile", "Average photo is 2 MB", "Traffic peaks at 3× average" |
Common categories of constraints:
- Budget: cloud spend, licensing, headcount.
- Team: size, skills ("nobody here has run Kafka in production").
- Existing stack: "we are a PostgreSQL and Python shop"; integrating with a legacy system.
- Regulations: data residency, retention laws, auditability.
- Deadlines: a launch date, a contract renewal, a conference demo.
Why the distinction matters:
- Assumptions are risks. Each one should be written down with a plan to validate it. If "average photo is 2 MB" turns out to be 8 MB, your storage cost estimate is 4× off.
- Constraints often decide more than requirements. A team of three with a two-month deadline should almost always choose managed services and a monolith, even if the scale requirements could justify something fancier later.
graph TD
Q["Design question:<br/>which message queue?"] --> R1["Requirement:<br/>5,000 msgs/s, at-least-once"]
Q --> C1["Constraint:<br/>2 engineers, AWS only"]
Q --> A1["Assumption:<br/>traffic grows 2x per year"]
R1 --> D["Decision:<br/>managed SQS, revisit at 50,000 msgs/s"]
C1 --> D
A1 --> D
Prioritization
You can never satisfy every requirement perfectly. Time, money and physics get in the way. Prioritization decides what you build first and what you give up when requirements collide.
MoSCoW
The MoSCoW method sorts requirements into four buckets:
| Bucket | Meaning | Rule of thumb |
|---|---|---|
| Must have | Without it, the release is useless or illegal | Typically no more than ~60% of the effort |
| Should have | Important, but there is a workaround | Painful to drop, but the release still works |
| Could have | Nice to have; first to be cut | Small wins if time allows |
| Won't have (this time) | Explicitly out of scope | Written down to prevent scope creep |
For the chat app: sending and receiving messages (Must), read receipts (Should), message reactions (Could), video calls (Won't).
In an interview, you do the same thing in compressed form: "I'll focus on sending messages, group chat and offline delivery. Read receipts and media I'll mention but not design in detail."
Trade-offs Between NFRs
Non-functional requirements frequently conflict. Choosing one often means weakening another.
| Trade-off | Why they conflict | Typical resolution |
|---|---|---|
| Consistency vs availability | During a network partition, you either refuse requests (stay consistent) or serve possibly stale data (stay available) — the CAP theorem | Strong consistency for money and inventory; eventual for feeds, likes, counters |
| Latency vs consistency | Strong consistency across regions needs cross-region round trips (often 50–150 ms each) | Serve reads from local replicas; route writes needing strong guarantees to a leader |
| Latency vs cost | Lower latency means more caches, more regions, more replicas, bigger machines | Cache the hot path only; accept higher latency for rare operations |
| Availability vs cost | Each nine needs more redundancy: multi-AZ, then multi-region | Pay for high availability only on revenue-critical paths |
| Durability vs latency | Waiting for a write to reach multiple replicas or disks takes longer | Synchronous replication for orders; async for analytics |
| Security vs usability | MFA, short sessions and strict validation add friction | Risk-based auth: step-up MFA only for sensitive actions |
| Scalability vs simplicity | Sharding, queues and microservices add moving parts | Start simple; design so you can split later |
| Time-to-market vs maintainability | Shortcuts ship faster but cost more later | Take deliberate, documented shortcuts and revisit them |
When you make one of these trade-offs, write it down along with the reason — a decision log is the standard tool. The next engineer (or interviewer) will want to know why you chose eventual consistency, not just that you did.
Talk about trade-offs out loud
In interviews, a sentence like "I'm choosing eventual consistency for the like count because a few seconds of staleness is invisible to users, and it lets us avoid a write bottleneck" is worth more than a perfect diagram. See Discussing Trade-offs.
How Requirements Drive Architecture
This is the payoff. Once requirements are concrete, many design decisions almost make themselves.
| Requirement | Design implication |
|---|---|
| 99.99% availability | Redundancy across multiple availability zones, automatic failover, health checks, no single points of failure — see availability patterns |
| 99.999% availability or survive a region loss | Multi-region active-active or active-passive, global load balancing |
| p99 read latency under 100 ms globally | CDN for static content, cache for hot data, read replicas near users |
| Strong consistency for payments | Single-leader database with ACID transactions, idempotency keys on payment APIs |
| Eventual consistency acceptable for feeds | Async fan-out, leaderless or multi-leader replication, caching aggressively |
| 10× traffic spikes (sales, launches) | Autoscaling stateless services, queues to absorb bursts — see message queues — and load shedding |
| Read:write ratio 100:1 | Caching layer, read replicas, denormalized read models |
| Write-heavy (250,000 location updates/s) | Partitioned in-memory or write-optimized storage, batching, keep only latest location in hot storage |
| RPO = 0 | Synchronous replication to at least one other node before acknowledging writes |
| Large media files (photos, video) | Object/blob storage plus CDN, never in the main database |
| Data must stay in the EU | Region-pinned storage, per-region deployments, careful with global caches and logs |
| No raw card data stored (PCI) | Tokenization via payment provider; card details never touch your servers |
| Abuse protection | Rate limiting at the gateway, per-user quotas |
| Small team, fast delivery | Managed services, modular monolith, fewer moving parts |
| Full audit trail | Append-only event log, immutable storage, write-once retention policies |
graph LR
subgraph Requirements
NFR1["p99 reads under 100 ms"]
NFR2["99.99% availability"]
NFR3["10x traffic spikes"]
NFR4["Strong consistency for payments"]
end
subgraph Design
D1["CDN + cache"]
D2["Multi-AZ + failover"]
D3["Autoscaling + queues"]
D4["Single leader + transactions"]
end
NFR1 --> D1
NFR2 --> D2
NFR3 --> D3
NFR4 --> D4
The reverse is just as useful. When you see a component in someone's design, ask "which requirement does this serve?" If nobody can answer, it should probably go.
Gathering Requirements in Practice
At Work: Talking to Stakeholders
Requirements come from many people, each with a different view:
| Stakeholder | What they care about | Questions to ask them |
|---|---|---|
| Product manager | Features, user value, launch date | "What is the core user problem? What does success look like in 6 months? What can we cut?" |
| Users / customer support | Pain points, real workflows | "What do users complain about most? What do they do as a workaround?" |
| Business / finance | Revenue, cost | "What does an hour of downtime cost? What is the infrastructure budget?" |
| Security / legal | Risk, regulation | "What data is sensitive? Which regulations apply? Where can data live?" |
| Operations / SRE | Running it at 3 a.m. | "What are the existing SLOs? What monitoring and on-call already exists?" |
| Other engineering teams | Integrations, dependencies | "Which APIs will you call? What load will you send? What are your SLOs?" |
Useful general questions, whatever the system:
- Who are the users, and how many — today and in two years?
- What are the three most important things they do?
- What is the read:write ratio? Are there peak times or spiky events?
- What happens if the system is down for an hour? If it loses a day of data?
- Which data must be strongly consistent, and where is staleness acceptable?
- Are there legal, regulatory or contractual obligations?
- What existing systems must we integrate with or reuse?
- What is the budget, team and deadline?
- What is explicitly out of scope?
In an Interview
In an interview you have about five minutes for requirements (see the Interview Framework). A compact script:
Functional:
1. "What are the core features we must support? Let me list what I think they are..."
2. "Who are the users — consumers, businesses, internal?"
3. "Is <feature X> in scope, or can I leave it out?"
Scale:
4. "How many daily active users? What's the expected growth?"
5. "Read-heavy or write-heavy? Roughly what ratio?"
6. "Any large objects — images, video, files?"
Quality:
7. "What latency is acceptable for the main operations?"
8. "Is eventual consistency OK anywhere? Is there anything that must be strongly consistent?"
9. "Single region or global users?"
10. "Any availability target I should design for?"
Then summarize back in one or two sentences: "So we're designing one-to-one and group chat for 50 M DAU, real-time delivery, offline delivery, 99.99% availability for messaging, and media is out of scope. Sound right?" This confirms alignment and gives the interviewer an easy chance to correct you.
If the interviewer says "you decide," don't freeze. State a reasonable assumption and move on: "I'll assume 10 M DAU and a 50:1 read:write ratio."
A Requirements Document / RFC Template
At work, requirements live in a design doc or RFC. A minimal template:
# RFC: <Feature / System Name>
## 1. Context
Why are we doing this? What problem does it solve? Link to product brief.
## 2. Goals and Non-Goals
- Goals: ...
- Non-goals (explicitly out of scope): ...
## 3. Functional Requirements
| ID | Requirement | Priority (M/S/C/W) |
|----|-------------|--------------------|
| F1 | ... | Must |
## 4. Non-Functional Requirements
| ID | Attribute | Target (SLO) | How measured |
|----|--------------|---------------------------------------|---------------------|
| N1 | Latency | p99 GET /x under 200 ms | LB metrics, 30 days |
| N2 | Availability | 99.95% successful requests | SLI dashboard |
## 5. Constraints
Budget, team, deadline, existing stack, regulations.
## 6. Assumptions (and how we'll validate them)
| Assumption | Validation plan | Owner |
## 7. Estimates
Traffic, storage, bandwidth (show the arithmetic).
## 8. Proposed Design
Diagram + how each requirement is met (trace F/N IDs to components).
## 9. Alternatives Considered and Trade-offs
## 10. Open Questions
The trace from requirement IDs (F1, N2) to components in section 8 is what makes a design review productive: reviewers can check that nothing was missed.
Common Mistakes
| Mistake | What it looks like | Why it hurts | Fix |
|---|---|---|---|
| Jumping to the solution | Drawing Kafka before asking what the system does | You optimize for an imagined problem | Spend the first 10% of the time on requirements |
| Gold-plating | Designing for 1 B users when the product has 10 k | Higher cost, slower delivery, more failure modes | Design for 10× current scale, plan for 100× |
| Unmeasurable NFRs | "Fast, scalable, highly available" | Cannot be tested or traded off | Attach a percentile, threshold and window to every NFR |
| Using averages | "Average latency 100 ms" | Hides the slow tail users actually feel | Specify p95/p99 |
| Ignoring read/write ratio | Same design for a blog and a logging pipeline | Wrong storage and caching choices | Ask or estimate the ratio early |
| One consistency level for everything | "The whole system is strongly consistent" | Needless latency and cost, or unsafe payments | Decide consistency per operation |
| Forgetting failure modes | Only describing the happy path | Data loss, double charges, stuck states | Write alternative flows; ask "what if this fails halfway?" |
| Forgetting non-user actors | Ignoring admins, batch jobs, partners | Missed load and permissions | List all actors first |
| Missing compliance | Discovering GDPR deletion after launch | Painful re-architecture of storage and backups | Ask security/legal early |
| Unwritten assumptions | "Everyone knows photos are small" | Estimates silently wrong | Write assumptions down with validation plans |
| No out-of-scope list | Scope grows every meeting | Deadline slips | Maintain an explicit "won't have" list |
More interview-specific pitfalls are in Common Mistakes.
Full Worked Example: "Design a Photo-Sharing App"
Let's take a one-line prompt and turn it into a requirements specification with numbers, then see the first design implications.
Step 1: Clarify and List Functional Requirements
After asking a few questions, we settle on:
| ID | Functional requirement | Priority |
|---|---|---|
| F1 | Users can upload a photo (JPEG/PNG/HEIC, up to 20 MB) with a caption. | Must |
| F2 | Users can follow other users. | Must |
| F3 | Users see a home feed of recent photos from people they follow. | Must |
| F4 | Users can view a photo in full resolution and see its caption. | Must |
| F5 | Users can like and comment on photos. | Should |
| F6 | Users can search for other users by username. | Should |
| F7 | Users get notified when someone likes or comments on their photo. | Could |
| — | Video, stories, direct messages, ads | Won't (this round) |
API sketch:
POST /v1/photos (upload; returns photo_id)
GET /v1/feed?cursor=... (home feed, paginated)
GET /v1/photos/{id}
POST /v1/users/{id}/follow
POST /v1/photos/{id}/likes
GET /v1/users?prefix=...
Step 2: Assumptions and Scale
| Assumption | Value |
|---|---|
| Daily active users | 10 M |
| Photos uploaded per DAU per day | 0.2 (1 in 5 users uploads one photo) |
| Photos viewed per DAU per day | 50 |
| Feed refreshes per DAU per day | 10 |
| Average original photo size | 2 MB |
| Resized versions (thumbnail + medium) | ~300 KB total |
| Peak-to-average traffic ratio | 3× |
Derived numbers:
Uploads: 10 M * 0.2 = 2 M photos/day ≈ 23/s avg, ~70/s peak
Views: 10 M * 50 = 500 M views/day ≈ 5,800/s avg, ~17,000/s peak
Feed: 10 M * 10 = 100 M feed loads/day ≈ 1,150/s avg, ~3,500/s peak
Read:write ratio for photos ≈ 500 M / 2 M = 250:1
Storage per day: 2 M * (2 MB + 0.3 MB) ≈ 4.6 TB/day
Storage per year: 4.6 TB * 365 ≈ 1.7 PB/year
Egress (mostly medium images ~200 KB):
500 M * 200 KB = 100 TB/day ≈ 9 Gbit/s average, ~27 Gbit/s peak
These numbers already tell a story: photo storage and delivery dominate everything. Metadata (users, follows, captions) is tiny by comparison.
Step 3: Non-Functional Requirements with Numbers
| ID | Attribute | Target |
|---|---|---|
| N1 | Feed latency | p95 GET /v1/feed under 300 ms, p99 under 700 ms |
| N2 | Image load latency | p95 time-to-first-byte for images under 100 ms for users on major continents |
| N3 | Upload latency | p95 upload acknowledged within 2 s (excluding user network time); resized versions available within 10 s |
| N4 | Availability | 99.95% for viewing feed and photos; 99.9% for uploads |
| N5 | Durability | Zero loss of acknowledged uploads; 11 nines object durability |
| N6 | Consistency | Uploader sees own photo immediately (read-your-writes); followers may see it within 30 s; like counts may lag 10 s |
| N7 | Scalability | Grow to 50 M DAU in 2 years without redesign |
| N8 | Security & privacy | Private accounts' photos visible only to approved followers; EXIF location data stripped by default; TLS everywhere |
| N9 | Compliance | GDPR: account deletion removes photos and personal data within 30 days |
| N10 | Cost | Storage + CDN under $0.02 per DAU per month at launch scale |
| N11 | Observability | Per-endpoint p50/p95/p99 and error rate; upload pipeline lag alerting |
Step 4: Constraints
- Team of 8 engineers, launch in 6 months.
- Company already runs on a single cloud provider with PostgreSQL experience.
- EU users' data must be deletable on request (GDPR); no strict residency requirement this round.
Step 5: First Design Implications
Now trace each requirement to a decision:
| Requirement | Design implication |
|---|---|
| Storage 1.7 PB/year, N5 durability | Store images in object storage, not the database; database stores only metadata and object keys |
| Egress ~27 Gbit/s peak, N2 | Serve images through a CDN; generate thumbnail and medium sizes so most views never touch the original |
| N3 resized within 10 s | Upload stores the original, then publishes a job to a queue; workers resize asynchronously |
| 250:1 read:write, N1 | Cache feeds and hot photo metadata; read replicas for the metadata database |
| N6 followers within 30 s | Feed generation can be asynchronous (fan-out on write for most users, fan-out on read for celebrities) |
| N6 read-your-writes | After upload, the uploader's own profile reads from the primary or merges their recent uploads client-side |
| N4 99.95% | Stateless API servers across multiple availability zones behind a load balancer; database with automatic failover |
| N7 50 M DAU | Partition-friendly keys (by user ID) so the metadata store can be sharded later; no need to shard on day one |
| Team of 8, PostgreSQL experience | PostgreSQL for metadata, managed queue and managed object storage; a modular monolith rather than many microservices |
| N8 privacy | Authorization check on every feed and photo-metadata request; signed, expiring CDN URLs for private photos |
| N9 GDPR | Index all objects by owner so deletion can find them; set backup retention under 30 days or support deletion in backups |
graph TD
Client["Mobile / web client"] --> CDN["CDN<br/>images, N2"]
Client --> LB["Load balancer<br/>multi-AZ, N4"]
LB --> API["API servers<br/>stateless, autoscaled"]
API --> Cache["Cache<br/>feeds + hot metadata, N1"]
API --> DB[("PostgreSQL<br/>metadata, replicas")]
API --> OS[("Object storage<br/>originals, N5")]
API --> Q["Queue<br/>upload jobs"]
Q --> W["Workers<br/>resize + feed fan-out, N3/N6"]
W --> OS
W --> Cache
CDN --> OS
Every component on that diagram points back to a requirement ID. That is what a requirements-driven design looks like — and it is exactly what interviewers and design reviewers want to see.
What we did not add
No Kafka, no microservices, no multi-region. None of the requirements demand them yet. N7 (50 M DAU) is handled by choosing shard-friendly keys now, not by sharding now. If a future requirement says "survive a full region outage," multi-region becomes justified — and the requirements doc tells you exactly when.
Practice Exercises
Exercise 1: Functional or Non-Functional?
Classify each statement as FR or NFR. If NFR, name the attribute.
- "Users can reset their password via email."
- "Password reset emails arrive within 60 seconds for 99% of requests."
- "The system stores card numbers only via the payment provider's tokens."
- "Admins can suspend a user account."
- "The search API handles 3,000 queries per second at peak."
- "Deleted accounts are purged from backups within 35 days."
Solution
- FR — an action the system supports.
- NFR — performance (latency), stated as a percentile.
- NFR — security/compliance (PCI DSS scope reduction). It describes a property, not a user-facing feature.
- FR — the actor is an admin, but it is still a behaviour.
- NFR — throughput/scalability.
- NFR — compliance (GDPR) and data retention.
Notice that 1 and 2 describe the same feature: one says what, the other says how well. Most features have both.
Exercise 2: Make It Measurable
Rewrite each vague NFR into a measurable one for an online food-delivery app.
- "The app should be fast."
- "It should never go down."
- "Order tracking should be accurate."
- "We should handle Friday night traffic."
Solution
Example answers (your exact numbers may differ; what matters is percentile/threshold/window/scope):
- "p95 restaurant-list API latency under 300 ms; p95 checkout API under 800 ms, measured at the load balancer over 30 days."
- "Order placement: 99.95% of requests succeed over a rolling 30 days (≈ 22 minutes of budget). Restaurant reviews: 99.5%." — "never down" is split by criticality.
- "Courier location shown to the customer is at most 10 seconds old for 99% of updates; order status transitions are strongly consistent (a cancelled order is never shown as 'preparing')."
- "Sustain 4× weekday average order rate (Friday 7–9 p.m. peak) with p95 latency targets still met; autoscale from baseline to peak within 5 minutes."
Exercise 3: SLO and Error Budget Arithmetic
A team sets an SLO of 99.9% successful requests over 30 days for an API that serves 200 million requests per month.
- How many failed requests does the error budget allow?
- A bad deploy causes a 100% failure for 20 minutes during a period when traffic is evenly spread. What fraction of the budget is spent?
- The company wants to sign an SLA with customers. Should the SLA be 99.9%, 99.95% or 99.5%? Why?
Solution
- Budget = 0.1% of 200 M = 200,000 failed requests.
- Requests per minute ≈ 200 M / (30 × 1,440) ≈ 4,630. Twenty minutes ≈ 92,600 failed requests ≈ 46% of the budget. One bad deploy used nearly half the month's budget, which is a strong argument for canary releases and fast rollback.
- 99.5%. The SLA should be looser than the internal SLO so there is a margin between "we missed our own target" and "we owe customers money." Promising 99.95% externally while only targeting 99.9% internally guarantees paying penalties.
Exercise 4: Constraint, Assumption or Requirement?
Label each item for a new internal analytics dashboard.
- "Data must not leave the company's EU cloud region."
- "Most queries will cover the last 7 days of data."
- "Dashboards load within 3 seconds at p95."
- "We have one data engineer and two months."
- "Analysts will run at most 100 queries per hour."
Solution
- Constraint (regulatory / company policy) — not negotiable.
- Assumption — needs validation (e.g. look at query logs from the old tool). If wrong, partitioning and caching choices change.
- Requirement (NFR, latency).
- Constraint (team and deadline) — pushes strongly toward managed tools.
- Assumption — sounds like a requirement but is a belief about usage; validate it before sizing the cluster.
Exercise 5: Requirements to Design
For each requirement, name the first design choice it suggests.
- "Users in Australia and Europe get product pages in under 150 ms p95."
- "A flash sale can bring 20× normal traffic for 15 minutes."
- "An inventory count must never go negative, even with concurrent purchases."
- "We must be able to answer 'who changed this record and when' for 7 years."
Solution
- CDN + edge caching for product pages and images, plus regional read replicas or caches for dynamic data. A single-region origin cannot meet 150 ms from both continents on every request.
- Queue the writes (orders go into a queue and are processed at a sustainable rate), autoscale stateless tiers, pre-warm caches, and add load shedding / waiting room for overflow.
- Strong consistency with transactions on a single-leader database: conditional update (
UPDATE ... SET stock = stock - 1 WHERE stock > 0) or row locking; plus idempotency keys so retries don't double-decrement. - Append-only audit log with immutable (write-once) storage and a retention policy of 7 years, separate from the operational database. See audit logging.
Exercise 6: Full Mini-Spec
Prompt: "Design a pastebin" (users paste text and get a shareable link). Write: 4 FRs with priorities, 5 NFRs with numbers, one constraint, two assumptions, and two design implications.
Solution
FRs
- F1 (Must): A user can paste text up to 1 MB and receive a unique short link.
- F2 (Must): Anyone with the link can view the paste.
- F3 (Should): Pastes can expire after 10 minutes, 1 day, 1 week or never.
- F4 (Could): Syntax highlighting chosen by the user.
- Won't: accounts, editing pastes, comments.
Assumptions
- 1 M new pastes/day, read:write 10:1, average paste 10 KB.
Estimates: ~12 writes/s, ~120 reads/s average; storage 1 M × 10 KB = 10 GB/day ≈ 3.6 TB/year.
NFRs
- N1: p95 view latency under 200 ms.
- N2: 99.9% availability for viewing.
- N3: Zero loss of acknowledged pastes until expiry.
- N4: Links are unguessable (at least 8 random base62 characters, ~2.2 × 10^14 combinations).
- N5: Expired pastes are unreadable within 1 minute of expiry and deleted within 24 hours.
Constraint: one developer, must run for under $200/month.
Design implications
- Text content in object storage (or the DB if small enough at this scale), metadata in a single relational database; at ~3.6 TB/year a single database plus object storage is plenty.
- Cache popular pastes behind a CDN with TTL no longer than the paste's remaining lifetime, so N5 still holds; check expiry on read and run a periodic cleanup job.
Interview Questions
1. What is the difference between functional and non-functional requirements? Give an example of each for a ride-hailing app.
Functional requirements describe what the system does: "a rider can request a ride and get matched with a nearby driver." Non-functional requirements describe how well it does it: "a match is found within 30 seconds for 95% of requests in supported cities" or "location updates show up on the rider's map within 5 seconds." Both are needed; the FRs define the features, the NFRs largely define the architecture.
2. Why do you ask about requirements before designing?
Because the same features can need completely different architectures depending on scale, latency, consistency and availability targets. Asking first prevents over-engineering (designing for a billion users when there are a thousand) and under-engineering (eventual consistency for payments). It also shows structured thinking, which is what interviewers evaluate.
3. Why are percentiles better than averages for latency requirements?
Averages hide the slow tail. A service with a 50 ms average can still have a p99 of 2 seconds, and the users hitting that tail are often the most active ones. Also, when a page fans out to many backend calls, the backend tail becomes the page's typical latency. Requirements should state p95/p99 thresholds.
4. What are SLIs, SLOs and SLAs, and how do they relate?
An SLI is a measurement of user experience (e.g. fraction of requests succeeding under 300 ms). An SLO is the internal target for that SLI over a window (99.9% over 30 days). An SLA is an external contract with penalties, usually looser than the SLO so there is a safety margin. The gap between 100% and the SLO is the error budget, which the team spends on releases and experiments.
5. How would you turn "the system must always be available" into a real requirement?
Ask what downtime costs and which features are critical. Then set different targets per feature — for example 99.99% for checkout, 99.9% for browsing, 99% for recommendations — define precisely what counts as "available" (successful, non-5xx, under a latency threshold), and pick a measurement window. Note that each extra nine roughly multiplies cost and complexity, so 100% is never the answer.
6. Give three examples of NFRs that conflict and how you'd resolve them.
Consistency vs availability (CAP): strong consistency for payments, eventual for counters. Latency vs cost: cache only the hot path rather than everything. Security vs usability: risk-based step-up MFA instead of MFA on every action. The resolution is usually to choose per feature rather than system-wide.
7. What is the difference between a constraint and an assumption?
A constraint is an externally imposed limit you generally cannot change — budget, deadline, team size, regulations, existing stack. An assumption is something you believe but haven't verified — average file size, peak-to-average ratio, user behaviour. Assumptions are risks and need a validation plan; constraints shape which designs are even possible.
8. How does the read:write ratio affect your design?
A read-heavy system (100:1) benefits most from caching, CDNs, read replicas and denormalized read models. A write-heavy system (logging, metrics, location updates) needs write-optimized storage, partitioning, batching and queues. Getting the ratio wrong leads to optimizing the wrong path.
9. An interviewer says "design Instagram" and nothing else. What do you do in the first five minutes?
List the core FRs and confirm them (upload, follow, feed, view; maybe likes/comments), state what's out of scope (video, stories, DMs), ask or assume scale (DAU, uploads and views per user, read:write ratio), ask about latency, availability and consistency expectations, and then summarize back in one or two sentences before estimating. See the Interview Framework.
10. What is gold-plating, and why is it a problem?
Gold-plating is adding features or capabilities that no requirement asks for — for example multi-region active-active for a product with 5,000 users, or microservices for a team of three. It increases cost, complexity, failure modes and time to market without delivering value. Every component should trace back to a requirement.
Key Takeaways
- Requirements come first. Every box in an architecture should exist because a requirement demands it.
- Functional requirements are verbs (what the system does); express them as user stories, use cases and API contracts, with an explicit out-of-scope list.
- Non-functional requirements are adverbs (how well); an NFR without a number is a wish. Use percentiles, thresholds, windows and scope.
- SLIs, SLOs, SLAs and error budgets turn NFRs into operational targets; SLAs should be looser than SLOs.
- Constraints, assumptions and requirements are different — write them down separately and validate assumptions.
- Prioritize with MoSCoW and decide trade-offs (consistency vs availability, latency vs cost) per feature.
- Requirements drive architecture: availability targets drive redundancy, latency targets drive caching and CDNs, consistency targets drive database and replication choices, and spike requirements drive queues and autoscaling.
What to Learn Next
- System Design Characteristics — the quality attributes in depth, with real-world numbers.
- Estimation Practice — turn requirements into traffic, storage and bandwidth numbers.
- SLI / SLO / SLA Engineering and Error Budgets — operating against NFRs in production.
- Interview Framework — where requirements fit in a 45-minute interview.
- From Zero to a Million Users — how growing requirements change an architecture step by step.