Performance · Reliability · Scalability · Maintainability
(In the simplest possible terms, making the relationships between the concepts clear)
1. What is this chapter actually about?
Beyond “the features need to work,” software systems also have to be fast, reliable, scalable, and maintainable.
This chapter introduces these four key “nonfunctional requirements”:
| Nonfunctional requirement | Purpose | Key point in this chapter |
|---|---|---|
| Performance | The system needs to be fast | Response time, throughput, percentiles, latency |
| Reliability | The system must not fail or go down | Faults vs. failures, fault tolerance, hardware/software/human faults |
| Scalability | The system can handle growing load | Describing load, scaling up/out, shared-nothing architecture |
| Maintainability | The system can be changed and managed | Operability, simplicity, evolvability |
How the four relate:
- Performance is the most immediately visible part of user experience.
- Reliability keeps the system from “suddenly dying.”
- Scalability ensures that “after it grows, it can still maintain performance and reliability.”
- Maintainability ensures that the system can keep being improved years later.
They affect and support one another:
Performance and reliability are short-term user experience; scalability and maintainability are long-term system quality.
2. Explaining these four things with a social network home timeline
The book uses a “Twitter-like timeline system” as a running example.
2.1 Basic model: follow relationships + posts
- Users can post and follow other people.
- Reads matter most: reading the “home timeline.”
2.2 Performance bottleneck: queries are too expensive
Directly querying the latest posts from the 200 people you follow → millions of heavy queries per second → impossible.
2.3 Solution: materialized timeline
Write each new post into followers’ timelines ahead of time (fan-out), so reads are fast.
3. Performance
Performance mainly looks at two metrics:
3.1 ① Throughput
How many requests the system can handle per second
(for example, 5,700 posts per second or 1 million timeline writes per second)
3.2 ② Response time
The time from when a user makes a request to when the response comes back.
Response time is not fixed; it is a distribution and should be described using percentiles (p50 / p95 / p99):
- p50 (median): the typical user experience
- p95 / p99: tail latency (a small number of slow requests)
- p999: extremely slow requests
Percentiles are more realistic than averages, because averages are easily skewed by extremely slow requests.
3.3 What makes up latency (why is it slow?)
- Service processing time
- Network latency
- Queueing delay (the most important, especially under high load)
3.4 How performance relates to scalability
When do you need to scale?
→ When throughput approaches the system limit, queues get longer, and p99 gets slower.
4. Reliability
Reliability is about:
whether the system can still provide service normally when “something goes wrong.”
Key concepts:
4.1 Fault vs. failure
- Fault: part of a component breaks (a machine goes down)
- Failure: the entire system cannot provide service (the whole website goes down)
A reliable system must be able to tolerate faults without letting them become failures.
4.2 Fault tolerance
Use redundancy, data replicas, heartbeat checks, failover, and similar techniques to make sure the system still works when some nodes break.
4.3 Three sources of faults
- Hardware faults (bad disks, machines going down, power problems)
- Software faults (bugs, memory leaks, hangs caused by leap seconds)
- Human faults (configuration errors, operational mistakes)
Software faults in particular are often “highly correlated,” which can cause large-scale outages.
4.4 Ways to improve reliability
- Redundancy, data backups
- Fault injection (chaos engineering)
- Automated operations
- Blameless postmortems
5. Scalability
Scalability is about:
whether the system can maintain performance as load grows.
5.1 How should load be described?
- Requests per second
- Number of concurrent online users
- Data growth rate
- Read/write ratio
- Extreme users (for example, a celebrity with 100 million followers)
Only after describing the load can you know where the system bottleneck is.
5.2 Two ways to scale
① Scaling up
Buy a bigger machine
Pros: simple
Cons: expensive, and there’s a ceiling
② Scaling out
Add more machines and have them cooperate through a distributed system
Pros: can scale indefinitely
Cons: complex (requires sharding, fault tolerance, distributed protocols, etc.)
5.3 Types of sharing architectures
- Shared memory: multiple threads on the same machine share RAM
- Shared disk: multiple machines use the same storage
- Shared nothing: each machine runs independently (the mainstream approach)
Shared-nothing architecture is the core of modern internet systems.
6. Maintainability
Maintainability is about:
whether the system can evolve over the long term, be easy to maintain, and avoid turning into a big ball of mud.
Maintainability has three subgoals:
6.1 Operability
Make operations easier, for example:
- Observability (logs / metrics / tracing)
- Automated deployment
- Safe rolling upgrades
- Predictable error handling
6.2 Simplicity
Reduce accidental complexity and make the system easier to understand.
This emphasizes essential complexity vs. accidental complexity:
- Essential complexity: the problem itself is hard (for example, large-scale social graph structures)
- Accidental complexity: extra trouble introduced by tools, frameworks, and implementation choices (avoidable)
Reducing accidental complexity → improving maintainability.
6.3 Evolvability
The system can be modified easily as requirements change, for example:
- Database migrations can be rolled back
- Modules are loosely coupled
- The architecture can support unanticipated use cases
The essence is:
the easier the system is to change → the more likely it is to stay viable years later.
7. Summary of how the four nonfunctional requirements relate
Here is the most important relationship diagram (in plain English):
In one sentence:
Performance determines experience, reliability ensures it won’t go down, scalability ensures it won’t go down when it grows, and maintainability ensures it can still improve in the future.
They complement one another and are shared goals of modern data-intensive systems.
8. Core takeaways from this chapter
- Performance: measure real experience with response-time percentiles
- Reliability: the key is fault tolerance, so faults don’t become system failures
- Scalability: describe load, find bottlenecks, and solve them with horizontal scaling
- Maintainability: reduce complexity, improve operability, and ensure the system can evolve
Understanding these concepts is the foundation for later chapters (replication, sharding, transactions, consistency, stream processing, etc.).