AlgoViz

The AWS outage of December 2021

medium 26 min

On 7 December 2021 an automated scaling activity in US-EAST-1 triggered a surge of connections that overwhelmed the devices between two AWS networks.

Video lesson · Chapter 1 of 5

The running instance and the launch button

0:00 / 3:51

The December 2021 AWS outage in 75 seconds

1:15Reel coming soon

Theory

Read or listen first. About 2 min.

What it is

AWS runs most services and all customer applications on its main network. A separate internal network hosts foundations: monitoring, internal DNS, authorization and parts of the EC2 control plane. Networking devices connect the two.

On 7 December 2021 an automated activity to scale one service in the main network triggered unexpected behaviour from a large number of clients in the internal network. Their surge of connections overwhelmed the devices between the networks. Delays caused errors, errors caused more attempts, and the congestion stayed.

Every fact and time here comes from the report AWS published. Times are Pacific Standard Time (PST), in the Northern Virginia Region, US-EAST-1.

Why it exists

It shows a persistent overload: the trigger was short, but the retries kept the system in its bad state until people removed load. That pattern is the reason interviewers ask about backoff, jitter and load shedding.

It also shows the difference between a control plane, which creates and changes things, and a data plane, which does the everyday work. Running servers kept running. Starting new ones failed. Designs that need no change to survive were much better off.

A short history

  1. January 1984

    RFC 896 describes congestion collapse: hosts resend so much that the network does little useful work, and the condition is stable.

  2. 4 March 2015

    The AWS Architecture Blog publishes an article on exponential backoff and jitter.

  3. 25 November 2020

    An earlier event in the same Region also affects monitoring and status posts.

  4. 7 December 2021

    The network congestion described on this page.

Words to know

Control plane
The part that creates, changes and lists resources.
Data plane
The part that does the daily work of those resources.
Congestion
More traffic than a path can carry, so queues and delays grow.
Retry storm
Failed requests tried again by many clients, adding load to what is already full.
Backoff
Waiting longer after each failure.
Jitter
A random part in the wait, so clients do not return together.
Static stability
Staying correct without having to make any change when something fails.
NAT
Network address translation: rewriting addresses where two networks meet.

How it works

Step through the idea, or press Play.

Step 1 of 3

A surge between two networks. An automated activity triggers many connections at once

Understand it

Start here

The footpath to the map office

One narrow footpath joins a village to its map office. Two people pass easily. When many set off at once and everyone who is stuck turns back and tries again, the path never clears, and the map that shows where the jam is lies at the far end.

A jam that feeds itself
VILLAGEMAPSA quiet footpath

The first rush was short. The turning back made it last.

Background

Two networks and a narrow place

Where the networks meet

Customers send API calls to AWS services and requests to customer apps, both in the main network. AWS services send traffic to devices that do routing and NAT. The devices lead to the internal network with part of EC2 control, internal DNS, authorization and monitoring.
Arrows show one direction. Traffic flows both ways, and clients in the internal network open connections as well.
  • Main network

    Most AWS services and all customer applications. It was not affected itself.

  • Internal network

    Foundations: monitoring, internal DNS, authorization services, parts of the EC2 control plane.

  • Devices between

    Multiple, geographically isolated, scaled well ahead of need. They route and translate addresses.

  • Clients

    Programs with tested backoff behaviour. A latent issue kept them from backing off enough this time.

Redundancy was there: several devices in separate places. But they served the same clients. A surge that comes from everywhere fills all of them, and spare devices do not help against a load that grows with every failure.

What happened

The timeline

7 December 2021, PST

TimeEvent
7:30 AMAutomated scaling of a main-network service triggers a connection surge. Route 53 APIs impaired
7:33 AMEC2 APIs show errors and delays. Support cases are hard to create
8:22 AMThe Service Health Dashboard can be updated
9:28 AMInternal DNS traffic has been moved off the congested paths; DNS errors recover
12:35 PMOperators disable EventBridge delivery to reduce load
1:15 PMEC2 API errors begin to improve
1:34 PMCongestion significantly improved
1:35 PMAPI Gateway starts to recover; most container API errors are back to normal
2:22 PMAll network devices recovered. Console access restored
2:35 PMEventBridge delivery re-enabled
2:40 PMLaunches of new EC2 instances recover
4:28 PMSTS fully recovered
4:37 PMAPI Gateway largely recovered
4:41 PMAmazon Connect normal
5:00 PMFargate API errors begin to return to normal
6:40 PMEventBridge delivery delays end, after the backlog
All from the AWS report.

The network and the tail

14:22−07:30=6 h 52 min18:40−07:30=11 h 10 min14{:}22 - 07{:}30 = 6\text{ h }52\text{ min} \qquad 18{:}40 - 07{:}30 = 11\text{ h }10\text{ min}
The devices were healthy after almost seven hours. The last service with a stated time needed over four hours more, to replace servers and work through backlogs.

Cause

Congestion that feeds itself

The loop

Remove the first box and the loop still turns. That is what persistent congestion means.
  1. 1

    Trigger

    An automated activity scaled capacity of one service hosted in the main network.

  2. 2

    Unexpected behaviour

    A large number of clients in the internal network opened connections. This behaviour had not been observed before.

  3. 3

    Overload

    Devices between the networks were overwhelmed, so communication was delayed.

  4. 4

    Amplification

    Delays raised latency and errors, which led to even more attempts and retries.

  5. 5

    Persistence

    Clients have tested backoff, but a latent issue in a code path that had been in use for many years kept them from backing off enough.

How retries multiply load

A=∑i=0m−1pi=1−pm1−pp=0.5,;m=4:;1.875p→1:;md layers: up to mdA = \sum_{i=0}^{m-1} p^{i} = \frac{1-p^{m}}{1-p} \qquad p = 0.5,; m = 4:; 1.875 \qquad p \to 1:; m \qquad d \text{ layers: up to } m^{d}
pp is the chance that a try fails and mm the most tries per request. With three layers that each try 3 times, one request can become 27. Example values.

Three kinds of client in our model

After a failureSurge of 1,500 at onceWhy
Try again at onceAll 1,500 still waiting after 300 ticksThe whole surge returns every tick, and refusing it uses all the work
Wait 2, 4, 8 ... ticks, no jitterAll 1,500 still waitingLong pauses, but everyone returns in the same tick
Wait a random time up to 2, 4, 8 ...0 waiting, refusals in 40 ticksThe surge is spread out, and each tick finishes some of it
From the Code tab: capacity 100 per tick, 40 new requests a tick, a refusal costs a fifth of a success. Invented numbers, real shape.

What a good client decides after a failure

Every path ends. A client without the second question can loop for hours.

Diagnosis

Repairing with the lights off

Monitoring data travels across the same devices. Operators relied on logs and first saw raised internal DNS errors. DNS is a foundation for all services and part of the load, so they moved it away first. That helped several services but did not end the congestion.

What the operators could and could not do

Two dependencies of the repair, monitoring and deployment, were behind the problem.
Reason it was slowIn the reportWhat to take from it
Little visibilityMonitoring data was not availableKeep a small independent view of shared devices
Slow deploymentsDeployment systems run in the internal networkHave a deployment path for emergencies
Deliberate careMuch was still working, and changes could have harmed itPrefer actions that remove load and can be undone

What removed the load

  1. 1

    Move internal DNS

    Its traffic left the congested paths. Finished at 9:28 AM.

  2. 2

    Isolate the largest sources

    Top sources of traffic were identified and moved to dedicated devices.

  3. 3

    Switch heavy traffic off

    Some services with heavy network traffic were disabled. EventBridge delivery was off from 12:35 to 2:35 PM.

  4. 4

    Add capacity

    More networking capacity was brought online.

Effects

What failed and what kept working

Control plane and data plane

During the event customers trying to create or change things, such as changing a DNS entry or launching an instance, met errors in the control plane. Customers using running instances and DNS answers in the data plane were unaffected.
Using things worked. Changing them did not.
ServiceAffectedStill worked
EC2APIs to launch and describe instancesRunning instances
Elastic Load BalancingProvisioning, registering instancesExisting load balancers
Route 53Changing entries, 7:30 AM to 2:30 PMExisting entries and answers
ContainersRestarting a task or pod that failedRunning tasks and pods
LambdaNot affectedAPIs and invocations, all day
API GatewayErrors; many servers had to be replacedNothing is stated
S3 and DynamoDBAccess through VPC endpointsNormal access
RDS, EMR, WorkSpacesCreating new resources, since it needs EC2 launchesNothing is stated
STSSlow for third-party identity through OIDC, until 4:28 PMNothing is stated
CloudWatchDelays; a small amount of data missingThe rest of the data
Amazon ConnectCalls, chats and tasks failed more oftenNothing is stated
Console, supportLogin failures; creating cases impairedNothing is stated
From the report, which also says that applications not using the affected features saw minimal impact.

Did well that day

  • Enough servers already running
  • DNS failover set up in advance
  • Cached credentials with time left
  • More than one Region in use

Did badly that day

  • Scaling out to survive
  • Creating a load balancer to fail over
  • Changing DNS during the event
  • Needing the console to act

The right-hand list is our reading of the table: each item needs a control plane. AWS's guidance calls the left-hand idea static stability: be prepared so that nothing must be created while something is broken.

Static stability in numbers

s=⌈P(z−1) c⌉ per zoneP=9000,;z=3,;c=500:;⌈90001000⌉=9;⇒;27 running instead of 18s = \left\lceil \frac{P}{(z-1)\,c} \right\rceil \text{ per zone} \qquad P = 9000,; z = 3,; c = 500:; \left\lceil \tfrac{9000}{1000} \right\rceil = 9 ;\Rightarrow; 27 \text{ running instead of } 18
PP is the peak requests per second, zz the zones and cc what one server handles. The 9 extra servers are the price of not needing a launch. Example values.

Tail

Why some services took longer

  1. 1

    Damaged servers

    Many API Gateway servers got into a state where they had to be replaced. The automatic recycling needs the EC2 APIs, so it had to wait for them.

  2. 2

    Backlogs

    EventBridge worked through stored events until 6:40 PM.

  3. 3

    Everyone restarts

    Fargate met a backlog of tasks to start, and capacity pools had to be refilled.

  4. 4

    A chain

    Amazon Connect needs API Gateway to run Lambda functions, so it recovered after it.

The order of recovery

A service cannot recover before what it needs. Know your own order in advance.

Telling customers was late as well. The dashboard tooling did not fail over properly to its standby Region because of the congestion, and was working by 8:22 AM. AWS used one banner for all services, and later learned that it made information harder to find.

Change

What AWS said it would do

ChangeState in the report
Disable the scaling activities until all remediations are deployedDone at once; capacity is sufficient without them
Fix the client issue that prevented backing offPlanned over the following two weeks
Network configuration that protects devices in a similar eventDeployed
API Gateway stays healthy without the internal network; faster recyclingIn progress
New version of the Service Health DashboardExpected early the next year
Support system that runs actively in several RegionsExpected early the next year

The shape to aim for

Services in the main network use general devices with a load limit to reach clients that back off in the internal network, and separate devices only for DNS to reach internal DNS. Operators reach the services and also see spare monitoring outside both networks.
Our drawing: a limit at the narrow place, a separate lane for DNS, clients that back off and a view from outside.

Lessons

Six lessons for your design

LessonDo thisRead more
Find the narrow placesList devices, gateways and pools that many share; watch their useLatency
Stop retry stormsBackoff, jitter, a budget, and retries in one layer onlyRetries
Include the network when scalingCheck what is downstream before an automatic changeThroughput
Limit the blast radiusCells, bulkheads and separate lanesResilience
Limit inside tooRate limits and load shedding between your own systemsRate limiting
Test automation at real scaleRun it in stages under load, with a stop buttonOperability

Three patterns that fit

  • Cells

    Independent copies with their own network paths, so a surge in one cannot fill the others.

  • Bulkheads

    Separate pools and lanes for different traffic, as in the compartments of a ship. DNS got its own lane on the day.

  • Circuit breakers

    Stop calling after repeated failures, then test gently. They turn many retries into a few probes. See circuit breaker.

For customers of a cloud

  1. 1

    Run in more than one Region

    If the cost of an outage justifies it. Keep data copied and traffic ready to move.

  2. 2

    Fail over without creating anything

    Capacity, records and permissions exist before the event.

  3. 3

    Do not let one Region be the only one

    List every global dependency that lives in a single Region.

  4. 4

    Practise

    Move real traffic regularly. See global and local load balancing.

Summary

The whole topic in one minute.

An automated scaling activity triggered a surge of connections from many clients in the internal network. The devices between the two networks were overwhelmed, clients did not back off adequately because of a latent issue, and the congestion sustained itself. It improved when internal DNS was moved away at 9:28 AM, and ended at 2:22 PM after operators isolated heavy traffic, disabled some of it and added network capacity.

Monitoring data and deployment systems were affected too, which slowed the repair. Running instances, load balancers and DNS answers kept working, while creating and changing them failed. The lessons: cap and spread retries, protect shared devices, keep monitoring independent, and design so that surviving a failure needs no new resources.

  • A scaling activity triggered a surge of connections that overwhelmed devices between two networks.
  • A latent issue kept clients from backing off, so the congestion lasted.
  • Monitoring and deployment were behind the jam, which slowed the repair.
  • Control planes failed while data planes kept working.
  • Cap and spread retries, protect narrow places, and prepare capacity in advance.

Sources