Skip to content
Tutorials Center
My learning

Topics

Lesson 2 of 65 ยท Thinking in Systems

Functional and Non-Functional Requirements

Turn a vague idea into testable functional and non-functional requirements: scope, SLOs, constraints and a checklist, with a Python requirement checker.

Most failed designs fail before any box is drawn, because nobody agreed on what the system must do or how well. "Build a photo-sharing app" can mean a weekend project or a company. Requirements turn the vague idea into statements you can design against, test and argue about.

Requirements come in two families. Functional requirements say what the system does. Non-functional requirements (NFRs) say how well it does it: how fast, how reliable, how secure, how big. Functional requirements decide which components exist; non-functional requirements decide how they are built and how many you need.

Functional requirements

A functional requirement describes a behavior a user or another system can observe. Good ones are short, specific and testable.

  • "A user can upload a photo up to 10 MB."
  • "A user can follow another user and see their photos in a feed."
  • "The system sends an email when someone comments."

Write them as actors doing things. A helpful template is "As a <role>, I can <action> so that <value>". Then sort them into must-have, should-have and out of scope. Declaring what you will not build is just as important: it prevents a design that tries to do everything.

In an interview or a design review, spend the first five minutes asking questions and writing down the scope. Choosing two or three core features and saying "I will leave notifications for later" is a sign of experience, not weakness.

Non-functional requirements

NFRs are the qualities that make a design hard. The most common are:

The big five qualities

Performance Latency and throughput targets.
Scalability Growth in users, data and traffic.
Availability How much downtime is acceptable.
Reliability Correct results, no lost data.

Also: security, consistency, cost, maintainability.

1 / 2

Each quality should become a number or a rule:

Quality Vague wish Measurable requirement
Latency "Fast" p95 read latency under 200 ms
Availability "Always up" 99.95% monthly uptime
Durability "Don't lose photos" No acknowledged upload is ever lost
Scalability "Handles growth" Supports 10x traffic with config changes only
Consistency "Correct" A user sees their own post immediately
Security "Safe" All traffic over TLS; passwords hashed
Cost "Cheap" Under $0.02 per active user per month

SLI, SLO and SLA

Three abbreviations come up constantly:

  • SLI (service level indicator): a measured number, such as "fraction of requests answered under 300 ms".
  • SLO (service level objective): the target for that number, such as "99% of requests under 300 ms".
  • SLA (service level agreement): a contract with consequences, such as a refund if uptime falls below 99.9%.

An SLO is usually stricter than the SLA so you notice trouble before you owe money.

Constraints and assumptions

Besides qualities, write down the constraints that shape the design: the team size, the budget, the existing technology, laws (for example, where user data may be stored), and deadlines. Then write down your assumptions, such as "most users read, few write" or "photos are never edited". When an assumption turns out wrong, you will know exactly which part of the design to revisit.

Read-heavy or write-heavy?

One question decides a lot: what is the read-to-write ratio? A news site is perhaps 1000 reads per write, so caches and replicas pay off hugely. A logging system is mostly writes, so you worry about ingestion rate and storage layout. A chat app is balanced and cares about delivery latency. Always ask for the ratio, or state an assumption.

Making requirements checkable

Requirements you can test are requirements you can keep. The snippet below keeps a small requirements list as data and checks measured results against it. This mirrors how teams track SLOs.

Python A tiny SLO checker

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The error rate misses its target, so the system is not "done" even though latency looks great. That is the whole value of numeric requirements: arguments become measurements.

Percentiles: why averages hide pain

Latency targets are almost always given as percentiles. The p50 (median) is the typical request, p95 means 95% of requests are faster, p99 means 99% are faster. A few very slow requests barely move the average but ruin the experience for the unlucky users, and when one page makes many backend calls, those slow calls are hit far more often than you would guess.

Python Average versus p99

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The average (about 90 ms) looks acceptable and the median is excellent, yet the p99 is about two seconds, forty times the median. If you only watched the average you would never notice the slow tail. This is why serious latency requirements quote p95 or p99.

A requirements checklist

When you start a design, walk through these questions:

  1. Who are the users, and how many (daily and peak)?
  2. What are the three to five core features? What is out of scope?
  3. Read-heavy or write-heavy? Roughly what ratio?
  4. What latency is acceptable for reads and for writes?
  5. How available must it be? What happens during an outage?
  6. Can data be lost? Can it be stale for a few seconds?
  7. How much data is stored, and for how long?
  8. Where are the users? One region or the whole world?
  9. What are the security and legal constraints?
  10. What is the budget and the team's skill set?

The answers feed straight into capacity estimation, the next lesson.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Which of these is a non-functional requirement?

    It describes how well the system performs, not what feature it offers.
  2. 2. What is the difference between an SLO and an SLA?

    Teams set SLOs to stay safely inside the SLA they promised customers.
  3. 3. Why do latency requirements quote p95 or p99 instead of the average?

    The slow tail is where users suffer, and the average hides it.
  4. 4. Why should you state what is out of scope?

    Scope boundaries keep the design small enough to finish and review.

Summary

  • Functional requirements say what the system does; non-functional requirements say how well.
  • Turn every quality into a number: latency percentiles, uptime, durability, cost.
  • SLI measures, SLO targets, SLA promises.
  • Record constraints and assumptions, and know the read/write ratio.
  • Percentiles reveal the slow tail that averages hide.

Next: Capacity Estimation