Chapter 6 · Worrying about your tail

One backend's 1% becomes the web page's median

A web service averages 100 ms at 1,000 requests per second, but 1% of requests take 5 seconds. To build one web page, a frontend server asks several backends for parts of the answer. A backend is a service like this one. The web page is ready only after every backend answers, so the slow 1% shows up on far more than 1% of web pages.

One backend's 1% becomes the web page's median First, 1,000 requests in one second: 990 fast and 10 that take 5 seconds, with an average of 100 ms. Then a frontend that asks 1, 10, or 70 backends: the share of web pages that wait 5 seconds grows from 1 in 100 to about 51 in 100. ONE SECOND · 1,000 REQUESTS TO ONE WEB SERVICE ■ fast request ■ 5 s request AVERAGE 100 ms 1% of 1,000 = 10 requests take 5 s TOTAL WAITING TIME · 1,000 × 100 ms = 100,000 ms 990 fast requests · 50,000 ms 10 × 5,000 ms = 50,000 ms 10 slow requests use half of all the time 50,000 ms ÷ 990 ≈ 50 ms each Almost no request takes 100 ms. Most take about 50 ms. A few take 5,000 ms. FRONTEND builds the web page waits for every backend BACKENDS THE FRONTEND ASKS: 1 each backend: 99 of 100 answers fast, 1 takes 5 s 100 WEB PAGE LOADS amber: at least one backend was slow Chance a web page waits 5 s Median web page
fast takes 5 s (the tail) the average, which hides the tail
Step 1 of 7