---
title: Warehouse-scale computers
heading: Data centers as one computer, PUE, energy proportionality, tail latency, failures and cost of ownership
eyebrow: S4 · Lesson 39 · Warehouse-scale computers
xp: 50
---

::: hook
A large internet service runs on a warehouse of tens of thousands of servers that behaves like one enormous computer. Its architecture questions are quantitative, but the quantities are new: dollars per month of electricity, the fraction of power lost to cooling, how much power a server burns doing nothing, how often some server somewhere fails (several times a day), and how one slow machine out of a hundred can make most user requests slow. Luiz Barroso and Urs Hölzle's work at Google framed these questions, and their answers shaped how servers, networks and software are designed.
:::

::: play
- Energy efficiency (work per watt, relative to a fully loaded server) against utilization, when a server draws a fraction i of its peak power while idle: $\frac{u}{i + (1 - i)u}$.
- Servers in large services typically run between 10% and 50% utilization. With i = 0.5, a server at 30% load does its work at only 46% of its peak efficiency.
- An **energy-proportional** server (i near 0) would be efficient at every load. Lower i to see how much is at stake.
:::
:::

```sim plot
view: graph
x: u = 0.01..1
y: e = 0..1
slider: i = 0..0.8 = 0.5
plot: u/(i + (1 - i)*u) | samples: 300 | label: efficiency relative to full load
plot: u | dashed | color: ch2 | label: a server that idles at full power
readout: efficiency at 30% utilization = 0.3/(i + (1 - i)*0.3)
```

::: predict
## A user request fans out to 100 servers and must wait for all of them. Each server is slow (over a second) 1% of the time, independently. What fraction of user requests are slow?

- [ ] 1%
- [ ] 10%
- [x] About 63%
- [ ] 100%

::: reveal
$1 - 0.99^{100}$ = 63%. A rare slowdown on one machine becomes the common case once a request touches enough machines, so services fight the tail: they send backup requests after a short wait, cancel the slower duplicate, and design for the 99th-percentile latency of each server, not its average.
:::
:::

::: nameit
## Power and cooling

- **PUE** (power usage effectiveness) = total facility power / IT equipment power. Older facilities ran near 2; efficient ones run near 1.1.
- Server power at utilization u: $P = P_\text{idle} + (P_\text{peak} - P_\text{idle})u$, with $P_\text{idle}$ often 30 to 60% of peak.
- Monthly energy cost = average IT power × PUE × hours × price.

## Total cost of ownership

TCO = capital expenses (buildings, power and cooling equipment, servers), amortized over their lifetimes (often 10 to 15 years for the facility, 3 to 5 for servers), plus operating expenses (electricity, staff). Servers usually dominate, so raising utilization lowers the cost of every unit of work.

## Failures are routine

With N servers each failing on average every MTTF hours, the facility sees about $N \times 24/\text{MTTF}$ failures a day. Software replicates data and work, so hardware failures don't stop the service.

## The tail at scale

If each of k parallel sub-requests is slow with probability p, the whole request is slow with probability $1 - (1 - p)^k$.
:::

::: example
## 50,000 servers peak at 300 W and idle at 150 W, running at 30% utilization, in a facility with PUE 1.1, paying 70 dollars per MWh. What's the monthly electricity bill (730 hours)?

::: solution
1. **Average server power.**
   $$150 + 150 \times 0.3 = 195\ \text{W}$$
2. **IT and facility power.** IT power is 50,000 × 195 W = 9.75 MW, and with PUE 1.1 the facility draws 10.7 MW.
3. **Energy per month.**
   $$10.725\ \text{MW} \times 730\ \text{h} = 7{,}829\ \text{MWh}$$
4. **Bill.** At 70 dollars per MWh that's about 548,000 dollars a month.
5. **Energy proportionality.** A fully energy-proportional server would average 90 W at 30% load, cutting the bill by more than half.

**Answer:** the monthly electricity bill is about 548,000 dollars.
:::
:::

::: example
## The same 50,000 servers each have an MTTF of 5 years (43,800 hours). How many fail per day? What efficiency does a server reach at 30% load if it idles at 50% of peak, and at 10%?

::: solution
1. **Failures per day.**
   $$50{,}000 \times 24/43{,}800 = 27$$
   so repairs are a continuous process.
2. **Efficiency with a 50% idle draw.**
   $$\frac{0.3}{0.5 + 0.5 \times 0.3} = 46\%$$
3. **Efficiency with a 10% idle draw.**
   $$\frac{0.3}{0.1 + 0.9 \times 0.3} = 81\%$$

**Answer:** about 27 servers fail each day; at 30% load the efficiency is 46% with a 50% idle draw and 81% with a 10% one.
:::
:::

::: example
## A search request fans out to 100 leaf servers and must wait for all of them. Each leaf is slow (over a second) 1% of the time. How often is the whole request slow, and with 2000 leaves?

::: solution
1. **100 leaves.**
   $$1 - 0.99^{100} = 63\%$$
   of requests wait on at least one slow leaf.
2. **2000 leaves.** Essentially all requests do.
3. **What services do.** A rare slowdown on one machine becomes the common case at scale, which is why services send hedged requests, use backup replicas and cancel the stragglers.

**Answer:** 63% of requests are slow with 100 leaves, and essentially all of them with 2000.
:::
:::

::: check
given: T = 12 | 30; I = 8 | 20
answer: T/I
tolerance: 0.5%

## A data center draws {T} MW in total while its IT equipment draws {I} MW. What's its PUE?

::: right
Right. {answer}.
:::

::: misses
- [I/T] PUE is total over IT, so it's at least 1.
- [any] Not yet. Facility power over IT power.
:::
:::

::: check
given: p = 200 | 400; i = 0.3 | 0.6; u = 0.2 | 0.5
answer: p*i + (p - p*i)*u
unit: W
tolerance: 0.5%

## A server peaks at {p} W and idles at {i} of that. What does it draw at {u} utilization?

::: right
Right. $P_\text{idle} + (P_\text{peak} - P_\text{idle})u$ = {answer} W.
:::

::: misses
- [p*u] It draws its idle power even with no work.
- [any] Not yet. Idle power plus the load-dependent part.
:::
:::

::: check
given: u = 0.1 | 0.3 | 0.6; i = 0.2 | 0.5 | 0.7
answer: 100*u/(i + (1 - i)*u)
unit: %
tolerance: 0.5%

## A server idles at {i} of its peak power. At {u} utilization, what's its energy efficiency relative to full load?

::: right
Right. $\frac{u}{i + (1 - i)u}$ = {answer}%.
:::

::: misses
- [100*u] The server's power doesn't fall in proportion to its load.
- [any] Not yet. Work per watt at u over work per watt at full load.
:::
:::

::: check
given: N = 10000 | 50000; P = 180 | 250; E = 1.1 | 1.5; c = 50 | 100
answer: N*P*E/1e6*730*c
tolerance: 0.5%

## {N} servers average {P} W in a facility with PUE {E}. At {c} dollars per MWh, what does a 730-hour month of electricity cost, in dollars?

::: right
Right. {answer} dollars.
:::

::: misses
- [N*P/1e6*730*c] Multiply by the PUE.
- [any] Not yet. Average facility power × hours × price.
:::
:::

::: check
given: p = 0.002 | 0.01 | 0.02; k = 20 | 100 | 500
answer: 100*(1 - (1 - p)^k)
unit: %
tolerance: 0.5%

## A request fans out to {k} servers and waits for all. Each is slow with probability {p}, independently. What fraction of requests are slow?

::: right
Right. $1 - (1 - p)^k$ = {answer}%.
:::

::: misses
- [100*p] The request is slow if any one of the k is slow.
- [100*k*p] Probabilities can't exceed 1: compute the chance all are fast.
- [any] Not yet. One minus the chance every server is fast.
:::
:::

::: check
given: N = 20000 | 100000; M = 3 | 5 | 10
answer: N*24/(M*8760)
tolerance: 0.5%

## A data center has {N} servers, each with an MTTF of {M} years. How many fail per day, on average?

::: right
Right. $N \times 24/\text{MTTF}$ = {answer}.
:::

::: misses
- [N*24/M] Convert the MTTF from years to hours.
- [any] Not yet. Failure rate per server times N.
:::
:::

::: check
kind: parts
given: N = 10000 | 100000; P = 300 | 500; i = 0.3 | 0.5; u = 0.2 | 0.5; E = 1.1 | 1.5; c = 50 | 100

## {N} servers peak at {P} W and idle at {i} of peak, running at {u} utilization in a facility with PUE {E}; electricity costs {c} dollars per MWh.

::: part
answer: P*i + (P - P*i)*u
unit: W
tolerance: 0.5%

### What does each server draw?

::: misses
- [P*u] Idle power is paid even with no work.
- [any] $P_\text{idle} + (P_\text{peak} - P_\text{idle})u$.
:::
:::

::: part
answer: N*(P*i + (P - P*i)*u)*E*730/1e6*c
tolerance: 0.5%

### What is the monthly electricity bill, in dollars (730 hours)?

::: misses
- [N*(P*i + (P - P*i)*u)*730/1e6*c] Multiply by the PUE for cooling and power losses.
- [any] Servers × power × PUE × hours × price.
:::
:::
:::

::: check
kind: parts
given: k = 10 | 100 | 1000; p = 0.001 | 0.01; N = 10000 | 100000; M = 3 | 5

## A request fans out to {k} servers, each slow with probability {p}. Separately, a facility has {N} servers with an MTTF of {M} years.

::: part
answer: (1 - (1 - p)^k)*100
unit: %
tolerance: 0.5%

### What fraction of requests are slow?

::: misses
- [any] $1 - (1 - p)^k$.
:::
:::

::: part
answer: N*24/(M*8760)
tolerance: 0.5%

### How many servers fail per day?

::: misses
- [any] $N \times 24/\text{MTTF}$ in hours.
:::
:::
:::

::: check
kind: derivation
vars: i = 0.1..0.7, u = 0.05..1

## A server's idle power is a fraction i of its peak; it runs at utilization u.

::: step
answer: i + (1 - i)*u

### What fraction of peak power does it draw?
:::

::: step
answer: u/(i + (1 - i)*u)

### What is its work per watt, relative to running flat out?
:::

::: right
Right. At low utilization a server with high idle power wastes most of its energy: the case for energy proportionality.
:::
:::

::: explain
## Why does energy proportionality matter so much more for warehouse-scale computers than for a laptop?

::: model
A laptop mostly sleeps or runs a single user's bursts, and its power-saving modes switch whole components off when idle. Data center servers almost never sit fully idle, because they must answer requests within milliseconds, but they rarely run near full load either: services are provisioned for peak traffic and spread load for reliability, so typical utilization is 10 to 50%. A server that draws half its peak power at zero load spends most of its energy in that idle floor, doing its work at a fraction of its peak efficiency. Across tens of thousands of servers and the cooling that comes with them, that idle floor is millions of dollars a year, so servers whose power falls in proportion to their load save more than almost any other improvement.
:::
:::

::: practice

::: check
given: p = 250 | 500; i = 0.4 | 0.55; u = 0.15 | 0.45
answer: p*i + (p - p*i)*u
unit: W
tolerance: 0.5%

## Server power: peak {p} W, idle {i}, utilization {u}?

::: misses
- [any] $P_i + (P_p - P_i)u$.
:::
:::

::: check
given: p = 0.005 | 0.02; k = 50 | 200
answer: 100*(1 - (1 - p)^k)
unit: %
tolerance: 0.5%

## Slow requests: fan-out {k}, each slow with {p}?

::: misses
- [any] $1 - (1 - p)^k$.
:::
:::

::: check
given: u = 0.2 | 0.4; i = 0.3 | 0.6
answer: 100*u/(i + (1 - i)*u)
unit: %
tolerance: 0.5%

## Efficiency at {u} utilization, idle at {i}?

::: misses
- [any] $u/(i + (1 - i)u)$.
:::
:::
:::
