System design paper · 2013

The tail at scale

Dean and Barroso · Communications of the ACM 2013

Why rare slow answers become common when one request needs many servers, and how sending a backup copy of a slow request cuts the slowest ones.

A server that is slow 1 time in 100 slows 1% of the requests that use one server, but 63% of the requests that must wait for 100 of them. With 2,000 servers that are each slow 1 time in 10,000, 18% are slow.

You’ll learn to

  • Work out how often a request is slow when it must wait for many servers at once.
  • Explain how sending a backup copy of a slow request, and cancelling the loser, shortens the slowest responses without doubling the load.
  • Name the longer-term fixes: smaller pieces of data, extra copies of popular data and sidelining slow machines.
  • Say how common infrastructure and databases use these ideas today.

The idea in short

A server that answers in 10 ms but takes a full second one time in 100 sounds healthy. Now suppose one user request needs answers from 100 such servers and cannot finish until the slowest one replies. Then 63 of every 100 requests take a second or more. Rare slowness on each machine becomes ordinary slowness for the user.

Dean and Barroso argue that you cannot remove every cause of slowness in a shared data centre, so you should design around it, the way you design around machines that fail. The main tool is to send the same request to a second copy of the data after a short wait, use whichever answer arrives first and cancel the other. In one Google test, a lookup that fetched 1,000 values from a table spread over 100 servers took 1,800 ms in its slowest 1 case in 1,000. With a 10 ms wait before the backup copy, that fell to 74 ms, for 2% more requests.

The problem

Systems that answer within about 100 ms feel fluid to the people using them. The authors, two Google engineers, point at Google search, which updates its results while you type: it predicts the likely query from what you have typed so far, searches and shows results within a few tens of milliseconds.

To answer that quickly, one request is split across many machines. Each machine holds a slice of a huge dataset. A root server sends the request out to a large number of leaf servers and merges their replies, usually through a tree of middle servers. This splitting is called . Every leaf must reply within a strict deadline, or the service feels slow.

Each leaf has a , the time it takes to reply. It is never constant. Most replies are quick and a few are not. To talk about the slow ones, people use . The 99th percentile is the time that 99 of every 100 replies beat. The slow end of the distribution is called .

Percentiles matter because the average hides the tail. Google’s reliability book gives an example: a service with a 100 ms average at 1,000 requests a second can still have 1% of its requests take 5 seconds. Users who hit those requests do not care about the average. The same book adds that when a page depends on several such services, one backend’s 99th percentile can easily become the median response of the frontend. That is the effect the rest of this guide is about.

The paper lists where the slow replies come from:

  • Shared resources. Machines are shared between applications, which fight over CPU cores, memory bandwidth and network bandwidth. Even requests inside one application contend with each other.
  • Background programs. A background service that uses little on average can still cause a hiccup of several milliseconds when it runs.
  • Shared infrastructure. Machines also compete for network switches and shared file systems.
  • Maintenance. File systems rebuild data. Storage systems such as BigTable run periodic , which merges files in the background. Languages with pause now and then.
  • Queueing. Requests wait in lines on servers and network switches, and several layers of lines make every other delay bigger.

Hardware adds more. CPUs slow down after running above their long-term power limit for a while. Flash drives, which tidy up old blocks from time to time, can read slower by a factor of 100 even under modest writing.

None of this is a bug in the usual sense. Each cause is small, short and rare. The question the paper answers is: when a rare slow reply on one machine is a normal event somewhere among thousands, how do you build a service that stays fast?

The design choices

The authors’ answer starts with something they refuse to do. They do not try to remove every source of slowness. In a shared data centre, they argue, it cannot be done: even if a single environment were perfectly behaved, machines that share resources will fluctuate in ways application developers cannot control. Careful engineering still matters, but it is not enough alone. Fix what you can find, and design the system so that what you cannot fix does not reach the user.

Our biggest sale ever · Black Friday

Flat 50% Off

Pro

Continue reading

Unlock every course, now and later

  • System Design, live
  • AI Engineering, live
  • Data Engineering, live
  • Machine Learning Engineering, live
  • Inference Engineering, coming soon
  • AI Research, coming soon
  • Performance Engineering, coming soon
  • Agent & Harness Engineering, coming soon
  • LLM Fine-tuning, coming soon
  • LLM Pre-training & Post-training, coming soon
  • Reinforcement Learning, coming soon
  • AI Infrastructure & Platform Engineering, coming soon
  • AI Evaluation & Safety, coming soon
  • Forward Deployed Engineering, coming soon
  • Cloud Computing, coming soon
  • DevOps, coming soon

50% off · Annual and Lifetime

BLACKFRIDAY50Applied at checkout

Choose a plan

More System design papers

All papers