Foundations
Scalability vs Performance, Latency vs Throughput, and CAP Theorem.
- Distinguish between performance and scalability problems.
- Analyze the relationship between latency and throughput.
- Explain the consequences of the CAP Theorem in real architectures.
- Choose the right scaling strategy based on workload needs.
01 Performance vs. Scalability Viz
Performance
How fast a system completes a task for one unit of work (e.g., one request).
Scalability
The capability of a system to handle a growing workload (e.g., number of users) by adding resources.
If the system is slow for one person, it's a performance problem. If the system is fast for one person but slows down when busy, it's a scalability problem.
Vertical Scaling
Adding more power (RAM/CPU) to an existing machine.
Horizontal Scaling
Adding more machines to the system.
02 Latency vs. Throughput
| Metric | Description | Analogy |
|---|---|---|
| Latency | Time for one action | Travel time for one car from A to B |
| Throughput | Number of actions per time | How many cars pass per hour |
Comparison of Latency and Throughput.
Primary Target: Maximum Throughput, Minimum Latency.Deeper InsightBut remember, there is always a trade-off. Sometimes increasing throughput will slightly increase latency. Click to collapse
03 CAP Theorem: Physical Limits of Distributed Systems
- **Consistency**: All readers see the same latest data.
- **Availability**: Every request always receives a response (success/failure).
- **Partition Tolerance**: The system continues to function despite network failures between servers.
If you choose high Consistency, the system may have to reject requests (sacrificing Availability) during a network failure to avoid sending old data.
Eventual Consistency
Data might be different temporarily, but it will definitely be the same everywhere in a short time (usually milliseconds).
Key Takeaways
- 1Understand the difference between performance (speed) and scalability (capacity).
- 2High throughput doesn't always mean low latency.
- 3The CAP Theorem is a law of nature in distributed systems that requires us to choose priorities.
- 4Horizontal scaling is usually preferred for modern web systems due to its flexibility.
CH.01
Chapter Complete
Chapter Progress
Interact with the visualization
Scalability Foundations Quiz
Test your understanding of the differences between performance, scalability, and the CAP Theorem.
Ready to test your knowledge?