Amdahl's Law: The Bottleneck of Parallel Speedup
Amdahl's Law shows a system's speedup is limited by its sequential parts. If 10% of a task must run serially, your maximum speedup is 10x, no matter how many cores you add. This applies to CPUs, databases, and distributed jobs.
WHY IT EXISTS Amdahl's Law was created to provide a realistic model for performance improvement in multi-core and distributed systems. It counters the naive assumption that doubling the processors doubles the speed. The law formalizes why this isn't true and provides a formula to calculate the theoretical upper bound on speedup, grounding performance estimates in reality.
THE MENTAL MODEL Think of doing laundry with one washing machine and multiple dryers. The washing is a sequential task, and drying can be parallel. If washing takes 30 minutes and drying takes 30 minutes, one load takes an hour. Buying ten more dryers won't make that first load finish any faster than the 30 minutes it's stuck in the single washer. The washer is the serial bottleneck. Amdahl's Law is about finding your system's "washer" and understanding its impact.
HOW IT WORKS The law is a formula: Speedup = 1 / ((1 - P) + (P / S)). Here, P is the proportion of the task that can be parallelized, and S is the speedup factor for that portion (e.g., the number of cores). The term (1 - P) is the serial fraction that gets no speedup. As you add infinite resources (S approaches infinity), the term P/S approaches zero. The formula simplifies to Speedup = 1 / (1 - P). This reveals that the maximum possible speedup is dictated entirely by the fraction of the task that must run sequentially.
WHEN TO USE IT Use Amdahl's Law during system design, performance analysis, and capacity planning. It helps set realistic expectations for questions like, "What's the best-case speedup if we double the database cores?" or "Is it worth the engineering effort to parallelize this process?" It provides a quick, back-of-the-envelope calculation for the maximum return on investment for adding more hardware or parallelizing code.
WHEN NOT TO USE IT Amdahl's Law assumes a fixed problem size and doesn't account for real-world overheads like network latency, thread creation costs, or memory contention, which can further reduce actual speedup. It's also less applicable to problems where the amount of work scales with the resources, a scenario better described by Gustafson's Law (e.g., rendering a much larger, more detailed image with more GPUs).
ONE CANONICAL EXAMPLE A program takes 100 seconds to run. Profiling shows that 80 seconds can be parallelized (P = 0.8), but 20 seconds are inherently sequential (1 - P = 0.2), like reading an initial configuration file. The maximum theoretical speedup, even with infinite processors, is 1 / 0.2 = 5x. The total runtime will never drop below the 20-second sequential bottleneck. The best possible time is 20 seconds, no matter how much hardware you throw at the 80-second parallel part.
Read the original → en.wikipedia.org
Get five bites like this every day.
Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.