Container Orchestration

2026-05-11 07:07:50

Ensuring High Availability: Rethinking Search Architecture in GitHub Enterprise Server

Learn how GitHub rebuilt its search architecture for high availability, overcoming Elasticsearch clustering deadlocks and improving reliability for Enterprise Server administrators.

Search is the backbone of GitHub Enterprise Server, powering everything from the search bar and Issues page filtering to release pages, project boards, and even counters for issues and pull requests. Given its critical role, GitHub’s engineering team dedicated the past year to making the search infrastructure more resilient. The goal was to reduce administrative overhead and let operators focus on their customers instead of managing fragile search indexes. In earlier versions, administrators had to follow meticulous maintenance and upgrade sequences to avoid index corruption or locks—especially in High Availability (HA) setups. This Q&A explores the challenges, the deadlock risks, and the architectural overhaul that finally solved them.

Why is search so critical to GitHub Enterprise Server’s functionality?

Search isn’t just about the search bar at the top of the page. It’s the engine behind almost every user-facing feature that involves filtering, browsing, or counting. The Issues page relies on search to quickly display relevant tickets. The Releases page uses it to list versions. Projects boards depend on search for card organization. Even the counts you see next to issues and pull requests are powered by the same search infrastructure. Without a fast, reliable search, the entire platform would grind to a halt. That’s why GitHub has invested heavily in making the search architecture durable—so that even under heavy load or during failures, users can still navigate and find what they need without interruption.

Ensuring High Availability: Rethinking Search Architecture in GitHub Enterprise Server
Source: github.blog

What were the main challenges administrators faced with search indexes in earlier versions?

Administrators had to be extremely cautious with search indexes, which are specialized database tables optimized for fast lookups. If they didn’t follow upgrade or maintenance steps in the exact prescribed order, two serious problems could arise. First, search indexes could become damaged and require repair, which often meant downtime or manual intervention. Second, indexes might get locked, preventing future updates and causing failures during upgrades. These issues were especially acute in High Availability (HA) environments, where the complexity of keeping multiple nodes in sync made mistakes more likely. The root cause lay in how Elasticsearch, the chosen search engine, was integrated.

How did GitHub’s High Availability setup work, and why did Elasticsearch clustering cause problems?

GitHub Enterprise Server HA uses a leader/follower pattern. The primary node handles all writes, updates, and traffic. Replica nodes remain read-only but stay synchronized with the primary, ready to take over if the primary fails. This pattern is deeply embedded in the platform. Unfortunately, Elasticsearch couldn’t natively support a clear primary/replica distinction. So GitHub engineers created an Elasticsearch cluster that spanned both the primary and replica nodes. This made data replication straightforward and improved performance because each node could handle search queries locally. Over time, however, the downsides of this cross-server clustering began to outweigh the benefits—mainly because Elasticsearch could move a primary shard (which validates writes) to a replica without warning.

Can you explain the deadlock scenario that occurred when Elasticsearch moved primary shards to replicas?

Imagine this: at any moment, Elasticsearch could decide to promote a replica node’s shard to become a primary shard. Now that replica is responsible for accepting writes. If that replica later needs to be taken down for maintenance, a deadlock ensues. The replica (now a primary) waits for Elasticsearch to be healthy before it will start up. But Elasticsearch can’t become healthy again until the replica rejoins the cluster. So the system enters a locked state: the replica won’t start (because it thinks Elasticsearch is unhealthy), and Elasticsearch won’t recover (because it’s missing a primary shard). This chicken-and-egg problem forced administrators to intervene manually, often causing downtime. It was one of the most frustrating issues for operators.

Ensuring High Availability: Rethinking Search Architecture in GitHub Enterprise Server
Source: github.blog

What attempts did GitHub engineers make to stabilize the clustered Elasticsearch mode?

For several releases, engineers tried various fixes to make the clustered mode more reliable. They added health checks to ensure Elasticsearch was in a valid state before starting certain operations. They built processes to automatically correct drifting states when shards got out of sync. They even attempted a “search mirroring” system that would replicate search data without clustering. But database replication is notoriously hard to get right—especially with a distributed search engine like Elasticsearch. All these efforts required strict consistency guarantees, and each approach introduced new edge cases. Despite significant work, the underlying vulnerability remained: Elasticsearch could still promote a primary shard to a replica, triggering the deadlock.

What ultimately changed to solve these search architecture issues?

After years of experimentation, GitHub decided to completely refactor the search architecture. They moved away from the cross-server Elasticsearch cluster that spanned primary and replica nodes. Instead, each node now runs its own independent Elasticsearch instance. The primary node handles all writes and then asynchronously replicates the search data to each replica. This eliminates the possibility of Elasticsearch moving a primary shard to a replica and causing a deadlock. Replicas are now truly read-only for search, matching the rest of the HA pattern. The new design also simplifies maintenance and upgrades—administrators no longer have to worry about fragile indexing sequences. The result is a much more durable search infrastructure that requires less manual intervention, freeing up operators to focus on their customers.