Skip to content
ML SystemPart 1: Core ConceptsChapter 1
Foundations CH.01 ~20 min

Foundations

Scalability vs Performance, Latency vs Throughput, and CAP Theorem.

scalabilityperformancelatencythroughputCAP 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

Definition

Performance

How fast a system completes a task for one unit of work (e.g., one request).

Definition

Scalability

The capability of a system to handle a growing workload (e.g., number of users) by adding resources.

Different Problems

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

Comparison of Latency and Throughput.
MetricDescriptionAnalogy
LatencyTime for one actionTravel time for one car from A to B
ThroughputNumber of actions per timeHow many cars pass per hour

Comparison of Latency and Throughput.

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.
A Difficult Choice

If you choose high Consistency, the system may have to reject requests (sacrificing Availability) during a network failure to avoid sending old data.

Definition

Eventual Consistency

Data might be different temporarily, but it will definitely be the same everywhere in a short time (usually milliseconds).

Key Takeaways

  1. 1Understand the difference between performance (speed) and scalability (capacity).
  2. 2High throughput doesn't always mean low latency.
  3. 3The CAP Theorem is a law of nature in distributed systems that requires us to choose priorities.
  4. 4Horizontal scaling is usually preferred for modern web systems due to its flexibility.

CH.01

Chapter Complete

Up next:Infrastructure

Chapter Progress

Reading
Exercise

Interact with the visualization

Quiz

Scalability Foundations Quiz

Test your understanding of the differences between performance, scalability, and the CAP Theorem.

Ready to test your knowledge?

5 questionsRandomized from pool70% to pass