Scaling merge-ort across GitHub
GitHub replaced its libgit2-based server-side merge and rebase implementation with Git's merge-ort strategy, which needs no working directory and matches what the Git command line does. Both changes were validated with Scientist experiments that ran old and new code paths side by side in production. For merges, P50 dropped from about 71 ms to under 8 ms and P99 from 1.63 s to about 330 ms, a 10x speedup on the github/github monolith. Rebases moved to the new git-replay subcommand, and in testing they took under 10 minutes of compute versus 2.56 hours with libgit2.
Related posts
- Optimizing Git’s Merge Machinery, #3
Palantir hardMasterGit's merge machinery can skip rename detection for source files whose renames cannot change the merge result: files unmodified on the unrenamed side of history, and files not needed for directory rename detection's majority rule. Exploiting this meant pushing three-commit merge context across the old diff/rename-detection abstraction boundary, which only knew about two trees. For a typical cherry-pick touching ~10 files against 5K upstream renames, the comparison matrix shrinks from 5K×5K to ~10×5K. The mega-renames testcase drops from 130s to 11.4s on top of basename-guided detection, or from 1800s to 16s alone. The change ships in git 2.32.
- Improving Git push times through faster server side hooks
GitHub Engineering mediumAdeptGitHub cut pre-receive hook execution time on every Git push from about 880ms median to 10ms, dropping P99 by 95%, by rewriting the hooks from Ruby into its Go Git service. The Ruby hooks ran as subprocesses under Git and loaded the Rails monolith's 450+ gems on every push, twice per push (quarantine and post-receive), so an empty push could take over two seconds. Pruning outlier dependencies found with a debugger and strace saved 350-400ms, but load time would creep back as the monolith grew. The rewrite instead passes the needed configuration through an existing per-push data mechanism and rolled out behind a feature flag.
- 20× the CI traffic without getting slower: How we rebuilt Git serving at Datadog
Datadog Engineering mediumAdeptDatadog replaced CI fetches from a replicated Gitaly/Praefect cluster with gitretriever, a fleet of independent Git mirrors that poll GitHub per changed ref and fan packfiles out to autoscaled relays over a gRPC signaling stream plus HTTP. Because Git objects are content-addressed, relays install received packfiles without re-indexing. A pack cache serves about half of pack-building fetches without redoing delta compression. Traffic grew 20× in four months while median latency held near 40 ms, and fetch-serving CPU on the old backend fell 3–4×. A read-only HTTP API for ref resolution and file reads also replaced many full clones by internal tools and AI agents.
- Improve Git monorepo performance with a file system monitor
GitHub Engineering mediumAdeptGit 2.37.0 adds a builtin file system monitor daemon (`git fsmonitor--daemon`) for macOS and Windows, enabled by setting `core.fsmonitor` to true. The daemon registers for OS change notifications and keeps an in-memory, time-sorted queue of changed paths. Git commands query it over IPC using tokens that carry the daemon PID and a resync ID, so dropped events trigger a safe full rescan. Combined with `core.untrackedcache`, it cuts `git status` on Chromium and synthetic 1M/2M-file worktrees from 17–85 seconds to under one second by shrinking the refresh_index and untracked-file phases, which also speeds up `git diff`, `git add` and `git checkout`.
- WebKit on GitHub!
WebKit easyNoviceWebKit froze its Subversion tree on June 23rd and moved source control to git hosted on GitHub, citing git's distributed collaboration model, its author/committer model, cheap branch and revert operations, and the fact that most contributors already worked from git-svn mirrors. GitHub was chosen for its developer community and an API that made pre- and post-commit automation easy to build. Because git hashes are unordered, which complicates bisection under WebKit's zero-tolerance performance regression policy, the project uses "commit identifiers": the ancestor count on main (git rev-list --count) plus a branch-relative count for branches. These identifiers are supported by the git-webkit script and the commits.webkit.org translation service.