Outage21 Oct 2018

GitHub's 24-Hour Degradation

A 43-second network blip made automation move GitHub's databases across the country, and fixing it took a full day.

Severity
Status page turned red
Difficulty
advanced
Companies
GitHub
Tech
MySQL, Orchestrator, Raft, Replication, Data centers
Root cause
network control plane, dependency cascade

The story

Quick (1 min)

On 21 October 2018, GitHub was degraded for 24 hours and 11 minutes. Pages showed old or inconsistent data, and webhooks and GitHub Pages builds stopped.

It began with routine maintenance. Replacing faulty network equipment cut the link between GitHub's East Coast network hub and its main East Coast data centre for just 43 seconds.

In those seconds, GitHub's automatic database failover system decided the East Coast was gone and moved the main databases to the West Coast. When the network came back, both coasts held some writes the other didn't. GitHub couldn't simply switch back without risking user data, and its apps were too slow with a database on the other side of the country.

GitHub chose to protect data over speed. It restored from backups and resynced everything, which took a day.

The lesson: automatic failover can make a tiny problem huge if it does something your application can't handle.

Keep reading to the end to earn XP.Read. XP earned.

Engineer (2 min)

Setup. GitHub stored metadata (issues, pull requests, authentication and so on) in many MySQL clusters, each with a primary for writes and many read replicas. Orchestrator, using Raft consensus, managed topology and automated failover across sites.

The partition (22:52 UTC). Replacing failing 100G optical equipment cut the East Coast hub from the primary East Coast data centre for 43 seconds. Orchestrator nodes on the West Coast and in East Coast public cloud formed a quorum and promoted West Coast primaries. When connectivity returned, the application tier began writing to the West Coast.

Split brain. The East Coast primaries held a few seconds of writes that hadn't replicated west. Now the West had new writes the East didn't. "We were unable to fail the primary back over to the US East Coast data center safely."

The trade-off. After about 40 minutes of West Coast writes, failing back meant risking data loss. Staying meant East Coast apps making cross-country round trips for most database calls, which they couldn't handle. GitHub chose to fail forward and prioritise data integrity: it paused webhooks and Pages builds, restored East Coast replicas from backups, and resynced.

Why it took 24 hours:

  • Backups (every 4 hours, in remote cloud storage) took hours to download, decompress, checksum and load. GitHub had never needed to rebuild a whole cluster from backup before.
  • Replication catch-up followed a decaying curve, not a straight line, made worse as Europe and the US woke up. Status estimates turned out wrong.
  • Read replicas lagged by hours, so users saw inconsistent data until more replicas were added.
  • A backlog of 5 million+ webhook events and 80,000 Pages builds had to be processed. About 200,000 webhook payloads were dropped after exceeding an internal TTL.

Fix. Configure Orchestrator not to promote primaries across regional boundaries.

Interview takeaway: your failover system's idea of "healthy" must match what the application can actually run on, and you should know your consistency vs availability choice ahead of time.

Keep reading to the end to earn XP.Read. XP earned.

Deep dive (3 min)

Timeline (UTC, from GitHub's post-incident analysis)

  • 21 Oct, 22:52: maintenance on 100G optical gear causes a 43-second loss of connectivity between the East Coast hub and the primary East Coast data centre. Orchestrator deselects leadership. West Coast and East Coast public cloud nodes form a quorum and fail clusters over to the West Coast.
  • 22:54: alerts fire. 23:02: responders find database topologies in an unexpected state, containing only West Coast servers.
  • 23:07: internal deployment tooling is locked. 23:09: status yellow. 23:11: incident coordinator joins. 23:13: status red, and database engineers are paged.
  • 23:19: webhook delivery and Pages builds are paused to protect data, a deliberate partial degradation.
  • 22 Oct, 00:05: plan: restore from backups, sync both sites, return to a stable topology, resume queues. 00:41: backup restores under way.
  • 06:51: several clusters restored in the East and replicating from the West. Writes are slow over the cross-country link. A two-hour estimate is given, based on linear interpolation.
  • 07:46: a blog post goes out late, because GitHub publishes it with GitHub Pages, which was paused.
  • 11:12: all primaries back in the East Coast and the site much faster, but dozens of read replicas are hours behind, so users see inconsistent data.
  • 13:15: near peak traffic, replication delay is increasing. Extra read replicas in the East Coast public cloud spread the read load and let replication catch up.
  • 16:24: replicas in sync; failover to the original topology. Status stays red while backlogs are processed.
  • 16:45: processing 5M+ webhook events and 80k Pages builds. About 200,000 payloads exceed an internal TTL and are dropped; the TTL is raised.
  • 23:03: all backlogs processed, status green. Total: 24 hours 11 minutes.

Data consistency

Writes that never reached the West were captured from MySQL binary logs for reconciliation. One of the busiest clusters had 954 writes in the affected window. "Ultimately, no user data was lost; however manual reconciliation for a few seconds of database writes is still in progress."

Key insight

"Orchestrator's actions behaved as configured, despite our application tier being unable to support this topology change... This was emergent behavior of the system given that we hadn't previously seen an internal network partition of this magnitude."

Follow-ups GitHub announced

  • Prevent Orchestrator from promoting primaries across regional boundaries.
  • A richer status page showing per-component status instead of only green, yellow or red.
  • Accelerate an active/active/active multi-data-centre design aiming for N+1 redundancy at the facility level.

Keep reading to the end to earn XP.Read. XP earned.

Failure replay

Step by step, what broke and what it hit next.

  1. 22:52
    East Coast network hubdown

    Maintenance on optical gear cuts the hub off from the main East Coast data centre for 43 seconds.

    Affects: Orchestrator

  2. 22:52
    Orchestratorfailing

    West Coast and cloud nodes form a Raft quorum and promote West Coast database primaries.

    Affects: West Coast MySQL

  3. 22:53
    West Coast MySQLdegraded

    The network returns and apps start writing to the West Coast. A few seconds of East Coast writes never made it west.

    Affects: East Coast MySQL

  4. 22:53
    East Coast MySQLcompromised

    Both sides now hold writes the other lacks, so a safe instant fail-back is impossible.

  5. 23:19
    Webhooks and Pagesdown

    GitHub deliberately pauses webhooks and Pages builds to protect data integrity.

    Affects: Users

  6. 00:41–11:12
    East Coast MySQLrecovering

    Clusters are restored from remote backups and resynced. Primaries return east at 11:12.

    Affects: Read replicas

  7. 11:12–16:24
    Read replicasdegraded

    Replicas lag by hours as daily traffic rises. Users see stale data until extra replicas spread the load.

    Affects: Users

  8. 16:45
    Webhooks and Pagesrecovering

    Over 5 million webhooks and 80,000 Pages builds drain. About 200,000 payloads expire and are dropped.

    Affects: Users

  9. 23:03
    Usershealthy

    Everything is processed and verified. Status goes green after 24 hours 11 minutes.

Impact

Who was affected
GitHub.com users worldwide saw stale or inconsistent data; webhooks and GitHub Pages builds were paused for most of the incident.
How long
24 hours 11 minutes of degraded service.
Cost
not disclosed (about 200,000 webhook payloads dropped; a few seconds of writes needed manual reconciliation).

Lessons

  • Automated failover must respect what the application can run on; cross-region promotion added latency the apps couldn't handle.
  • Decide your consistency vs availability trade-off before the incident, not during it.
  • Test full-cluster restores from backup and know how long they take at real scale.
  • Replication catch-up isn't linear; be careful with recovery-time estimates.
  • Don't publish incident updates using a system that may be down.

Quiz

  1. How long was GitHub's network connectivity actually lost?

    Check answer

    43 seconds. Connectivity was restored in 43 seconds, but it set off 24 hours and 11 minutes of degradation.

  2. Why couldn't GitHub just fail back to the East Coast right away?

    Check answer

    Both coasts held writes the other didn't, so failing back risked losing user data. The East held a few seconds of unreplicated writes, and the West then accepted around 40 minutes of new writes. GitHub chose to fail forward to protect data.

  3. What did GitHub deliberately pause to protect data integrity?

    Check answer

    Webhook delivery and GitHub Pages builds. GitHub paused jobs that write metadata, such as webhooks and Pages builds, choosing integrity over usability.

  4. What configuration change did GitHub plan for Orchestrator?

    Check answer

    Prevent promotion of database primaries across regional boundaries. Cross-country promotion added latency the application tier couldn't handle, so GitHub limited promotion to within a region.

Interview prep

Try answering out loud before you open the model answer.

  1. system design

    Explain split brain in a primary/replica database setup, using GitHub's October 2018 incident, and how you would design failover to avoid it.

    Show model answer

    Split brain is when two nodes both act as primary and accept writes, so their data diverges. At GitHub a 43-second partition let Orchestrator promote West Coast primaries while the East Coast already held unreplicated writes. Then both sides had unique writes. Prevention: fence the old primary before promoting a new one (make it read-only or cut it off), use semi-synchronous replication so promoted replicas are guaranteed to have committed writes, add a delay or hysteresis so brief partitions don't trigger failover, and constrain promotion to topologies the application supports, such as same region only.

    A strong answer hits:

    • Definition of split brain and divergent writes
    • Fencing the old primary
    • Semi-synchronous replication or quorum commits
    • Hysteresis for short partitions
    • Topology constraints matching app capabilities
  2. system design

    During an outage you must choose between restoring service quickly with possible data loss or a slower recovery that preserves consistency. How do you decide?

    Show model answer

    Depends on the data and on commitments to users. For a source-of-truth system like GitHub's, losing user writes damages trust permanently, while slowness is temporary. GitHub explicitly chose integrity, pausing webhooks and Pages to protect data already received. The decision should be made in advance as policy (RPO per data class), with incident commanders empowered to apply it. Reduce the cost of the slow path: tested restores, extra capacity, and degrading non-essential features.

    A strong answer hits:

    • Classify data by business impact of loss
    • Pre-agreed policy (RPO and RTO per system)
    • Degrade non-essential features to protect core data
    • Communicate the trade-off to users
  3. debugging

    Your recovery estimate of "two hours" keeps slipping. Replication lag is decreasing more slowly than expected. What could be going on, and what would you do?

    Show model answer

    Catch-up rate is the replica's apply rate minus incoming write rate. As daily traffic grows, incoming writes rise and catch-up slows or reverses, giving a decaying curve rather than a straight line. Read load on lagging replicas also competes with replication. GitHub saw exactly this and fixed it by adding replicas to spread read load. Options: reduce reads on lagging replicas, add capacity, temporarily throttle non-critical writes, and give honest estimates with ranges.

    A strong answer hits:

    • Catch-up rate = apply rate minus incoming write rate
    • Rising daytime traffic slows recovery
    • Add replicas or shed read load
    • Give estimates as ranges

Go deeper