Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

GitHub Engineering 11 min read Case study mediumAdept

Upgrading GitHub.com to MySQL 8.0

GitHub upgraded 1200+ MySQL hosts (300+ TB, 5.5M QPS, 50+ clusters, including Vitess) from 5.7 to 8.0 over more than a year without breaking SLOs. The rollout went in stages: rolling replica upgrades per data center, then a replication topology with parallel 5.7 and 8.0 chains, then an Orchestrator graceful failover to an 8.0 primary, and finally cleanup after a 24-hour validation. Keeping rollback possible required backward replication from 8.0 to 5.7, which meant pinning utf8/utf8_unicode_ci collation and working around 8.0 role statements. Other problems included a commit-order replication hang fixed in 8.0.28, Vitess VTgate version advertising, and large WHERE IN queries that crashed MySQL in production despite passing CI.

Assumes: MySQL replicationprimary/replica topologydatabase failover

Related posts

  • Migrating Facebook to MySQL 8.0

    Meta Engineering mediumAdept

    Facebook moved its MySQL fleet from a heavily customized 5.6 branch straight to 8.0, skipping 5.7. Over a couple of years the team evaluated more than 2,300 patches and ported about 1,500. Each replica set was moved independently by adding 8.0 secondaries via mysqldump, promoting them and then removing the 5.6 instances, with config-driven automation and per-replica-set rollback. Problems found along the way included utf8mb4_0900 collation mismatches, new reserved keywords like groups and rank, InnoDB deadlocks fixed by lowering isolation after standardizing on row-based replication, ACL cache and binlog index mutex contention, and higher memory use that required trimming performance_schema and InnoDB structures.

  • Partitioning GitHub’s relational databases to handle scale

    GitHub Engineering mediumAdept

    GitHub split its monolithic `mysql1` MySQL cluster by first virtually partitioning tables into schema domains (declared in YAML) and enforcing boundaries with query and transaction linters, then physically moving domains to new clusters via Vitess vertical sharding or a custom ProxySQL/GTID-based write-cutover script. Cross-domain joins were eliminated with techniques like preload, Rails' new `disable_joins` option and application-side joins, validated with Scientist experiments. The write-cutover moved 130 of the busiest tables in tens of milliseconds with only a handful of failed writes. Query volume grew from 950k to 1.2M queries/s while average per-host load halved, reducing database-related incidents.

  • Upgrading MySQL at Shopify

    Shopify Engineering hardMaster

    Shopify moved hundreds of horizontally sharded Percona Server shards, thousands of VMs in all, from 5.7.21 to 5.7.32, mainly to get writeset-based replication parallelism across replication topologies up to four hops deep. Rollback testing turned up a downgrade bug: metadata-only ALTER TABLE statements, such as the AUTO_INCREMENT reset in Shopify's startup script, triggered full table rebuilds. The cause was mismatched HA_PACK_KEY flags on InnoDB indexes, which two earlier upstream fixes in 5.7.23 and 5.7.27 had not fully resolved, and the team patched it in their internal fork. In parallel they extended Mason, their self-healing VM service, into a declarative per-shard topology reconciler that provisions upgraded replicas, with a priority lane for healing, queue throttling, feature flags and a dry-run mode.

  • Beyond synthetic testing: Capturing and replaying real database workloads at Airbnb

    Airbnb Engineering mediumAdept

    Airbnb replaced fragmented per-language client-side query logging with a client-agnostic capture point in ProxySQL, so real production MySQL traffic can be replayed offline. A Log Mover sidecar ships ProxySQL query logs to object storage. A Log Processor splits them per cluster, reassembles transactions, buckets them into five-minute windows and rewrites INSERTs to pin last_insert_id. A queue-driven fleet of replay workers then uses shared start times to reproduce the original concurrency and pacing, at 1x or accelerated speeds. Replay-and-compare runs during the MySQL 5.7→8.0 upgrade caught a 0.03s→2.6s sort regression, duplicate queries the query cache had been hiding, and non-deterministic ORDER BY/LIMIT results. Accelerated replays locate capacity ceilings, for example commit latency rising from 6 ms to 34 ms at 80% more write traffic.

  • How we improved availability through iterative simplification

    GitHub Engineering mediumAdept

    GitHub cut timeouts in its Rails monolith with small, measured changes found through Datadog metrics, Splunk logs and custom MySQL slow-query monitors. Each change was validated with Scientist experiments or rolled out gradually behind Flipper feature flags. Reordering a Command Palette query to look up a user's contributions before filtering by org removed a large IN clause and was 80-90% faster, and batching access checks added another 20-80% and 30-40%. Skipping unneeded authorization filters on a busy redirect endpoint cut tail latency and timeouts. Not every idea paid off: moving sorting into the application was 40-80% slower, so that experiment was dropped.

The quest for software engineering knowledge.

Look:
Layout: