返回资讯中心
外部精选
软件工程
#开发者实时流

Everyone is doing Git on S3 wrong

tl;dr: At Enroute, we have built a new kind of git server that is based on modern database principles, written in Rust and backed by object storage. In our testing, we’ve been able to achieve 7,600+ concurrent pushes pe…

Hacker News 最新typesanitizer2026/10/15 · 2026/10/1530 分钟阅读

以下正文同步自 Hacker News 最新,版权归原站所有,已转换为易读排版。

tl;dr: At Enroute, we have built a new kind of git server that is based on modern database principles, written in Rust and backed by object storage. In our testing, we’ve been able to achieve 7,600+ concurrent pushes per second on a single repository at millisecond latency; more than an order of magnitude faster than existing solutions, while delivering clone/fetch performance on par with exclusively disk-based architectures. We are making this available as open-source, programmable git infrastructure to unlock new possibilities for agentic coding at scale as well as bringing version control to more platforms and products.

While database technology has seen a massive wave of cloud-based innovation in the past few years, Git hosting hasn’t changed much. Up until now, the typical production Git hosting (probably the most famous of which being GitHub's Spokes architecture) has relied heavily on SSDs as the primary storage mechanism. This only makes sense, since both the Git client but also the Git data model virtually assume fast random access storage.

However, in a hosting context, this does not come without cost: Disks can fail, so one needs RAID and/or backups. Servers can fail, so every repository needs replicas to be highly available. And any disk eventually fills up, so repositories must be sharded and rebalanced across a fleet of file servers.

Object storage has become much better in the last few years, and so rewriting databases to run on object storage has been one of the hottest trends in infrastructure engineering lately, perhaps most famously turbopuffer who did it for vector search, as well as Neon for Postgres. The advantages are obvious: a bucket is durable, replicates itself and it never fills up.

Following this, it is only logical to want to put Git repositories into object storage too. Especially in this day and age, this matters particularly for agents: hundreds of clients pushing to a monorepo at once, or kicking off a large fleet of CI runs, is no longer a problem that is limited to just Google, Microsoft or Meta.

So it is not surprising to have seen more innovation coming for Git hosting solutions lately. Most prominently, in August, Cursor/SpaceX described Continuity, their S3-backed Git storage, in Git at any scale. What followed were many open source implementations copying the same approach of an S3-backed write-ahead log (WAL) for Git.

While these implementations have been successful in moving the burden of scalability and durability into object storage, they fall short in two ways: Firstly, while they perform well when scaling out reads, they typically falter under write-heavy traffic. And secondly, they still rely on the canonical Git CLI which memory maps files on disk, which means that they need to have each repository fully loaded on disk before they can begin serving it.

To understand why Git is hard to put on object storage, we first need to look at how Git actually stores data. There are three kinds of objects:

Each object is addressed by the hash of its content, so it never changes. On top of that there are refs. A ref is just a name that points to an object. Branches are refs: main is stored as refs/heads/main and holds the hash of the latest commit on that branch. When you commit or push to a branch, Git writes the new objects first and then moves the ref to the new commit. Refs are the only thing in Git that changes, everything else is immutable.

So in a sense, Git is a content-addressed storage with mutable pointers layered on top. However, Git is not just a content-addressed storage system. It is also a graph database: Any object can point at, or be delta encoded against, any other object.

If Git wants to answer a query, it typically starts at a ref and follows the pointers from commit to tree to blobs, and it only knows the next key to fetch once the previous read has come back. On top of this, an object may be delta encoded, and so it may also need to follow its delta chain to the base object. On a local disk this is basically free.

If one were to treat Git as just content-addressed storage on object storage, every one of these steps would be a 30-40ms round trip.

This is why treating Git on object storage as just a content-addressed storage problem doesn’t work. Instead, the key to Git on object storage is maintaining data locality: Keeping the set of objects that are frequently used together close so they can be covered with a small number of reads.

Incidentally, this is exactly what the Git CLI does when your repository on disk gets large enough: It bundles objects into a packfile, writing a single monolithic file that it can map into memory for fast access. So you might be wondering: Why not just put those packfiles on S3?

Recently made famous by Cursor Origin, this newer design keeps Git's packfiles and makes the bucket a log. Each push is stored as an immutable packfile plus a log entry. Packfiles become visible through conditional PUTs against a WAL index, which records a pointer to the new entry, once the push's ref transaction is prepared on a local copy. Once committed this way, any machine can serve any repository by rebuilding a local copy from the log.

On the read path, the log is a real win. Any server can rebuild a local copy from the bucket and serve fetches from it, so reads scale out with replicas: Cursor reports linear read scaling up to 100 of them. Durability and failover, the hardest parts of running Git on disks, come with the bucket.

The write path however still depends on a single linearizable sequence of packfiles. This brings two problems: In effect, write operations to one repository compete for the same WAL index object and are then applied by one machine in sequence.

To their credit, Cursor have worked hard to make WAL updates fast:

With these improvements, Cursor reports up to 120 pushes/s on S3 Standard and more than 300 on S3 Express One Zone, where they find it is "effectively bottlenecked by the speed at which Git can compact the on-disk data."

At the end of the day, no matter how fast the WAL is, every push still has to land in one repository on disk. This means that Git’s single repository write throughput remains the shared limit for all pushes and repacking/garbage work on a repository. However many servers you run, a repository can only ingest as fast as one machine can apply and compact.

The Continuity design has significantly raised the ceiling for git hosting. However, it stops short of making Git fully scalable: Not only is this effectively a single-writer system, but while the bucket stores the log and the data, reads aren't served from it. Instead, every replica still has to keep a full copy of the repository on disk, no matter how large and how long it takes to download, to serve it.

While building Enroute, we’ve been asking ourselves the question: What if Git worked more like a modern distributed system backed by object storage, rather than a file on a disk? The answers we came up with rely heavily on proven distributed systems principles that we adapted to Git.

The results speak for itself: Running in the cloud on EC2 and S3, we have achieved a sustained peak load of more than 7,600 concurrent pushes per second on a single repository!

Like many modern databases, Enroute separates compute and storage. Our storage tier consists of replicated log for low-latency operations and an object storage backend for scalability and long-term durability. Compute is fully stateless and holds nothing but cache. In contrast with the WAL-on-S3 design, we made three key design decisions that result in higher throughput and lower latency:

Enroute is optimized for scale. Following the principle of separating compute and storage, we replaced the traditional git server with two dedicated tiers:

  1. Ledger tier: A small cluster of nodes that keeps one replicated log per repository using Raft consensus. The log holds the repository's refs and the list of layers that make up its data. A layer is an immutable file of Git objects with its own index, much like a Git pack.

  2. Compute tier: Any number of interchangeable nodes that do the actual Git work: building layers, serving clones and fetches and compacting. Compute nodes keep nothing that can't be rebuilt from the ledger and the bucket.

Let’s step through how this helps repo-level scalability by following a single push request:

You might wonder where the bucket comes into play? In practice, most pushes tend to be small, so there is a fast path that allows them to initially travel inlined into the log, deferring object storage writes until the log is flushed. Only layers larger than 1 MiB are uploaded directly to the bucket and then committed as a ledger entry.

Compared to the WAL approach, the log is no longer written in the bucket, but it is not the only thing that helps us keep throughput on a single repository fast:

We want data to eventually end up in object storage and keep the ledger lightweight, so inline layers can't stay in the log forever. Only refs and the layer list remain on the ledger nodes in the long run.

However, uploading layers one by one would bring back the object storage request cost we just avoided, so layers move in batches to the bucket. About once a second, a compute node flushes the layers from the log: It takes the recent inline layers, merges them into a single file, uploads it to object storage, and swaps out the layers in the log. If you’re familiar with LSM trees, this is similar to a memtable flush.

The same compute node also runs compaction jobs by merging small layers into bigger ones. Merges only copy bytes without recompressing them, so they are relatively inexpensive to run. Once about eight layers of similar size pile up, they are merged into one layer roughly eight times larger. This way, a byte is rewritten only a handful of times as the repository grows, and the largest layers are merged rarely.

Stateless compute and a cache that removes the read penalty

To keep typical read accesses to a repository fast, Enroute caches parts of layers locally in memory and on disk via a buffer pool abstraction which pages data from object storage as needed.

When a request needs more data that isn't on disk, the node fetches just the chunks it needs, with parallel ranged GETs. But even a cold cache costs less than you might think. In our tests, a node with an empty disk served a full clone of linux.git in 128.6 seconds, against 126.0 seconds warm.

The secret to serving repositories from object storage lies in optimizing for access patterns: It turns out that with only a few exceptions, a Git client never asks a server for random objects. Instead, a clone or a fetch negotiates what it needs based on the commit history: The set of commits the client wants to fetch, and what it already has locally.

The server's job is to send everything reachable from the requested commit without sending data already available. In practice, these are the objects from a consecutive run of commits. Canonical Git uses the object graph at read time to answer these questions and that assumes the full repo is on a local disk. We already learned that this does not work on object storage, but there is another way!

To fix this we developed a new storage format. Every commit is recorded in a segment. Each segment holds the set of objects representing the delta to the commit’s parents. Multiple consecutive segments are grouped into layers, which are immutable files with a table of contents at the end. The segment of a commit in combination with its ancestors holds all necessary data that is reachable from a commit. So to catch the Git client up on recent changes, Enroute can simply serve it from the respective segments, knowing that the common ancestry between client and server contains all dependencies to properly resolve the packfile.

This works because Enroute restricts Git’s ob

正文由 探How 从来源站点 RSS 同步,内容未经改写;遇到排版缺失或需要图片、视频时请以原文为准。

打开原文
去社区讨论 →