Skip to content

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

GitHub Engineering 5 min read Case study mediumAdept

How we rebuilt the search architecture for high availability in GitHub Enterprise Server

GitHub Enterprise Server's HA mode is replacing its single Elasticsearch cluster spanning primary and replica nodes with independent single-node clusters per server, linked by Elasticsearch Cross Cluster Replication (CCR). The old clustered design let Elasticsearch move primary shards onto read-only replicas, which could deadlock upgrades and maintenance: the replica waited for a healthy cluster that couldn't recover until the replica rejoined. CCR copies only data already persisted to Lucene segments and fits the leader/follower model. Because auto-follow only covers new indexes, GitHub added a bootstrap step that attaches followers to existing indexes and built custom workflows for failover, index deletion and upgrades. CCR mode is opt-in from 3.19.1 via `ghe-config app.elasticsearch.ccr true` and will become the default over the next two years.

Related posts

  • Managing Elasticsearch Reindex at Scale: Performance, Reliability, and Observability

    Palantir mediumAdept

    Palantir's Gotham document store rebuilds Elasticsearch indices from its transactional database (the source of truth) rather than using Elasticsearch's _reindex API, so search keeps serving live traffic throughout. The design writes to both the primary index and a shadow index, swaps them using aliases, and resolves conflicting writes with external_gte versioning. A background loop compares persisted metadata against actual cluster state and queues repairs. Later improvements added a parallel paging and indexing job runner with resumable checkpoints, three-way batch limits (document count, memory, batches per run), crash-safe idempotent state machines for index lifecycle operations, and layered logs, metrics and diagnostics for observability.

  • Break Stuff on Purpose

    Slack Engineering mediumAdept

    Slack's internal Kibana cluster failed in January 2024 after running out of disk, a consequence of co-locating its Elasticsearch storage on the same hosts as the application. The rebuild exposed a nearly two-year-old unmonitored backup that failed to restore and an outdated runbook, so users' dashboards and visualizations were lost. The team added scheduled backups, checked S3 retention, rewrote runbooks, and then deliberately filled the disks on a development cluster to rehearse recovery. The drill succeeded but missed the one-hour recovery goal and surfaced missing firewall rules in infrastructure as code. A later Kubernetes migration finished with about 30 minutes of downtime, and the backup script became a CLI that restores from cloud storage with a single command.

  • Building Git infrastructure for agent-scale development

    GitHub Engineering easyNovice

    GitHub is rebuilding its Git storage layer because agent-driven workloads are colliding with the design of Spokes. Spokes keeps five full repository replicas on local disks and coordinates every ref update with a three-phase commit quorum, so adding read replicas slows writes. The new design keeps coordination only for the reference update itself and moves compaction and garbage collection to separate workers. It also puts authoritative data in Azure Blob Storage, with stateless caching compute workers serving reads and scaling independently. Internal benchmarks show up to 35x higher write throughput, driven by 4.9x year-over-year push growth and 7.38 billion commits in a month.

  • MySQL High Availability at GitHub

    GitHub Engineering mediumAdept

    GitHub replaced VIP- and DNS-based MySQL primary discovery with a decoupled pipeline: orchestrator/raft detects failures and promotes a new primary, each orchestrator node writes the new identity to its local Consul KV store, and consul-template reconfigures GLB/HAProxy writer pools reached via anycast. This removes DNS TTLs and any reliance on the failed primary's cooperation. HAProxy's short hard-stop-after kills connections to the old primary to limit split-brain, and GLB checks that the new backend is really a writer. Raft quorum placement means an isolated data center cannot lead failovers, and orchestrator advertises an ideal candidate before the replication tree is repaired, which shortens outages.

  • Zero-Copy Migration: How Yelp Moved Its Cassandra Fleet Between Kubernetes Clusters

    Yelp Engineering mediumAdept

    Yelp moved roughly 1000 Cassandra pods and nearly a petabyte of data from self-managed Kubernetes clusters to Amazon EKS without streaming any data. EBS volumes are bound to an Availability Zone, not to a cluster, so the team pre-created PVs and PVCs in EKS pointing at the existing EBS volume IDs. They then rolled pods one at a time: delete the legacy pod, block it from rescheduling, and let the waiting EKS pod attach the freed volume and rejoin the ring. Both custom operators were paused with a skipReconciliation flag during the handoff, and rollback is the same pointer swap in reverse. The procedure was validated by hand first, then turned into an ~800-line bash script with Claude. The write-up covers pitfalls including stale VolumeAttachment objects, IAM drift that broke backups, and months-disabled repairs uncovered along the way.

The quest for software engineering knowledge.

Look:
Layout: