SkillSprout
Chapter 6 · Lesson 3
Intermediate
4 min read

Scalability Limits, Hot Spots and Cost

Overview

Adding machines does not give perfect growth. Some work cannot be split, machines must coordinate, and traffic is rarely spread evenly, so each extra machine adds less than the one before. This lesson explains those limits and the simple arithmetic for planning capacity.

Detailed Notes

What are scaling limits

Scaling limits are the reasons "twice the servers" does not give "twice the capacity". The main three are a serial part of the work, coordination overhead, and hot spots. Together they cause diminishing returns.

The problem it solves

A team doubles its servers from 10 to 20 for a launch and expects double the throughput. They see only 40% more. Every request still updates one shared counter in a single database row, so all servers queue behind it. And one celebrity account gets a thousand times more traffic than anyone else, overloading the one machine that holds it. Knowing the limits lets you predict this, instead of being surprised and overspending.

How it works

Amdahl's law: the serial part limits speed-up. If a fraction s of a job must happen one step at a time, no number of machines can speed it up by more than 1 / s.

text
speed-up with N machines = 1 / ( s + (1 - s) / N )
s = 10%, N = 10   -> about 5.3x
s = 10%, N = 100  -> about 9.2x (never more than 10x)

To scale further, shrink the serial part (for example, remove the single shared counter) rather than just adding machines.

Coordination overhead. When machines must agree or share data, they spend time talking to each other, and more machines means more talking. Past some point, extra machines can even reduce throughput. Prefer designs where machines work independently.

Hot spots. A hot spot is one part of the system receiving far more load than its peers, such as one machine, one slice of the data (a partition; splitting data is covered later) or one popular item. Adding machines does not help the hot one.

  • Skewed popularity (a celebrity profile): keep extra copies of the popular item so reads spread out.
  • A global counter or lock (a "one at a time" gate) updated by every request: split it into several parts and add them up later.
  • A poor way of splitting data, such as splitting by country when most users are in one: choose a splitting key (the field that decides which slice a record goes to) with more variety.

Cost. Scaling costs money: machines, idle capacity sized for peak, and the effort of operating more parts. Compare the cost of the next 2x of capacity with the value it brings.

Capacity planning with simple arithmetic:

  1. Estimate peak requests per second. With 10 million requests per day, the average is 10,000,000 / 86,400 = about 116 RPS. If peak is about 10x the average, that is roughly 1,160 RPS.
  2. Measure one server's safe capacity, say 200 RPS.
  3. Servers needed = 1,160 / 200 = about 6. Add 30-50% headroom plus a margin for failures: plan for 9-10.

Load testing means sending realistic simulated traffic and raising it until performance degrades. It reveals the real limit, the first bottleneck and whether the system slows gently or collapses, before your customers find out.

A simple example

Painting a house with more painters helps only for jobs that can run in parallel. If one person must wait for plaster to dry (the serial part), ten painters do not finish in a tenth of the time. If everyone shares one ladder (a hot spot), they queue. And more painters need a foreman to coordinate.

System design example

A social app finds that one popular account's profile makes a single machine run hot. The team keeps extra copies of that profile so reads spread across machines, and replaces a global "like count" row with several smaller counters that are summed when displayed. Then they load test, find each server handles 200 RPS, and size the fleet with headroom.

Summary

  • Serial work caps speed-up (Amdahl's law): shrink it, don't just add machines.
  • Coordination between machines costs time and can reverse gains.
  • Hot spots overload one part while others idle; spread or copy the hot item.
  • Plan capacity with peak RPS divided by per-server capacity, plus headroom.
  • Load test to find real limits before users do.

Architecture Diagram

Hot spot in a partitioned system
Architecture
Users
App Servers

Data partitions

Partition 1light
Partition 2HOT: celebrity key
Partition 3light

One overloaded partition while the others sit idle.

  1. 1Requests are routed to a partition by key.
  2. 2One very popular key sends most traffic to Partition 2.
  3. 3Adding more servers does not relieve that single partition.

Common Interview Questions

Chapter quiz

Scalability · 5 questions

  1. 1.Which is a downside of vertical scaling?

  2. 2.What makes a server stateless?

  3. 3.Why are sticky sessions fragile?

  4. 4.If 10% of a job is serial, the best possible speed-up with unlimited machines is:

  5. 5.What is a hot spot?

0 of 5 answered

Finished this lesson?

0 of 91 lessons done · 0% of the course