techlist.io

Packfile

1 posts

OpenAI2026-11-015 min readCurated summary

Scaling Git at OpenAI

# Scaling Git at OpenAI: Pando OpenAI built Pando, a new backend for Git repositories, to handle the surge in concurrent development driven by Codex. Pando keeps the Git protocol and client unchanged, so engineers and agents can use existing workflows. It relaxes repository-wide consistency in exchange for horizontally scalable writes and packfile reuse for high read throughput. In production, it cut median push latency by nearly 5x and now serves close to a petabyte of Git data per day. ## Why the Monorepo Outgrew Its Backend - Codex increased parallel work, producing more branches, pushes, merges, and fetches from developer machines, research jobs, and CI. - Around the end of the previous year, fetches and pushes slowed, merges failed, and reliability at times dropped below 90%. - OpenAI chose to keep Git as the foundation so client improvements could benefit the wider community and be contributed upstream. ## Git Storage Basics - Git stores blobs, trees, commits, and tags as immutable objects identified by a hash of their type and contents. - Refs such as branches and tags point to commits. Objects are stored loose or packed, with packs storing similar objects as deltas. - During fetch, the server computes what is reachable from the wanted commits, excludes what the client already has, and sends a packfile. - Push packs can depend on existing objects, so receiving a pack alone does not reconstruct the history. Replicas must have the required objects before serving a new ref value. ## Existing Approaches and Their Bottlenecks **Three-phase commit (3PC):** Each server keeps full replicas, and a majority must accept each ref update through pre-commit and commit rounds. - Consistent reads from any replica, but refs update one at a time with multiple round trips per push. - Disk performance and network latency sit on the push path, so write latency rises as disks saturate. **Write-ahead log (WAL) in blob storage:** Packfiles are uploaded in parallel, and a shared manifest is updated with compare-and-swap. - Even pushes to unrelated branches contend on the same manifest, limiting publish rate. - Replicas must read and index packs before serving them, so read latency grows when writes outpace that work. ## How Pando Works **Relaxed consistency:** Pando provides causal consistency rather than a point-in-time snapshot of all refs. Writes to a single ref are serializable, and clients conflict only when pushing to the same ref simultaneously. Readers of several branches may see them at different points in time. **Writes:** - Incoming packfiles are validated in a single pass while streaming to blob storage, without unpacking them into a repository. - Each branch move records a ref version (new tip, supporting pack, and dependencies) in a metadata store. A multi-key transaction updates the ref pointer atomically, giving read-your-own-write consistency at constant metadata cost. - Pando advertises only a designated trunk branch during push, so the client's pack depends only on trunk history. Median pack size in the monorepo was under 20 KiB, and the 99th percentile was under 3 MiB. **Reads:** - Pando maps the client's haves and wants to ref versions and selects the stored packfiles needed, at logarithmic metadata cost. - The Git `packfile-uri` feature lets the server return links to multiple packs, which clients download through regional caches. Cache hit rates exceed 99%. - Clone and fetch operations have been shown to saturate 10 Gbps links using standard cloud virtual machines. **Compaction:** Each push creates an L0 packfile. Background workers combine them into covers across levels that scale geometrically (up to L4 in the monorepo). Compaction improves compression and works like a skip list, letting fetch planning scale sub-linearly with how far behind a client is. **Simulation results:** In synthetic models with 1,000 clients pushing to distinct branches, 3PC showed rising write latency under load and the WAL design showed rising read latency. Pando sustained many thousands of concurrent clients without degrading. These are teaching models, not production benchmarks. ## Building and Deploying Pando - The system was built in about 10 weeks using Codex, with a single engineer designing the core and agents implementing it. It is written in Rust with no legacy dependencies. - Validation included a conformance test suite against standard Git behavior, deterministic simulation testing, formal specifications in Lean and TLA+, and continuous agent-driven red-teaming. - Deployment began as a read- and write-through proxy to the existing system, allowing a gradual, downtime-free migration. Pando's cache also improved the reliability of the legacy backend. - Clients were migrated in phases using an internal Git CLI wrapper, with Codex skills helping developers move their environments. - After the switch, merge reliability improved and median push latency dropped by nearly 80%. Pando has served over 57 TB of Git packs in a single hour, with more than 99% of bytes coming from local cache. ## Upstream Contributions - Work on concurrent pack downloads surfaced bugs around interrupted transfers and resumed downloads, which were fixed and contributed upstream. - Tracing was added for packfile-uri downloads and pack generation byte counts. - "Explicit haves" lets a server advertise a branch tip separately from history a pushing client may omit, enabling `--force-with-lease` checks against trunk alone. ## Takeaway Pando shows that Git can scale to agent-level concurrency without abandoning its protocol or workflows. The main tradeoffs are weaker cross-ref consistency and occasionally larger push packs, which OpenAI judged acceptable in exchange for scalable writes and cache-friendly reads. OpenAI plans to share the underlying technology with users and continue contributing to open-source Git.