AlgoViz

The AWS Kinesis outage of 2020

medium 26 min

On 25 November 2020 a small capacity addition to Amazon Kinesis in US-EAST-1 pushed every front-end server over an operating system thread limit.

See it run

See the mesh grow, replay the event, follow it into other services and rebuild it in cells.

Operations

A write, normally

Why the shard-map decides everything.

Step 1 of 4

Put a record

Kinesis in one RegionlookupthreadsProducersFront endsmany thousandsNew front endsnot yetShard-mapcompleteCell-cluster 1Cell-cluster 2

A producer calls the front end, which checks identity and rate.

Step 1: Put a record

Who is affected
Nobody
Way out
Not needed
Front end stores
no records

Name the small part that everything passes through. Here it is a cached table.

In the real world

The same the aws kinesis outage of 2020 doing real jobs. Pick one and step through it.

The same trap in a smaller system: every app server opens 20 database connections, the database allows 500. Example numbers.

Step 1 of 4

10 servers

connectionslimit 500
10 servers20040%
20 servers
26 servers

200 connections. Fine.

Step 1: 10 servers

Common mistakes

The bugs interviewers watch for, with the fix beside each.

  • Testing only what you added

    critical

    The cost of a new server can land on the old ones.

    Wrong
    check(new_servers)
    Right
    check(all_servers, after=learning_delay)
  • Waiting on an optional buffer

    critical

    The request stops for data nobody needs right now.

    Wrong
    buffer.put(event)            # blocks
    Right
    try:    buffer.put_nowait(event)except Full:    dropped.add(1)
  • Alarms only on errors

    major

    A limit is silent until it is crossed, and then everything fails.

    Wrong
    alarm(error_rate > 0.01)
    Right
    alarm(threads / thread_limit > 0.5)
  • Restarting everything at once

    major

    Cold servers are slow, look unhealthy and are removed again.

    Wrong
    for s in fleet: start(s)
    Right
    for group in batches(fleet, safe_size):    start(group)    wait_until(map_complete, group)

Interview tips

  • How to explain it

    • Trigger: a small addition. Cause: a thread per neighbour and a fixed limit.
    • All servers failed together.
    • Seventeen hours, twelve of them a careful restart.
  • Memory trick

    • Ribbons between dancers: hands hold four.
    • Two small circles instead of one big ring.
  • Design it in

    • Cells with a tested size.
    • Alarms on use against each limit.
    • Bounded buffers that drop.
  • Say carefully

    • AWS did not publish the fleet size or the limit.
    • The report does not call the addition the root cause.
    • Optional uses are still dependencies.