Traditionally, adding hardware has been a natural solve for the cluster capacity problem. But, in the agentic era, it has become increasingly difficult to match pace by continually increasing hardware. Instead, we looked at what our CI jobs were actually writing to the cluster.
The reality of the situation was that most of the data being written wasn’t retained for future jobs.
What were our clusters actually spending the most time doing? Creating and deleting data that no job would ever read again. On top of that, every job sat waiting while its writes criss-crossed the network.
Naturally, adding storage would buy us more capacity, but it wouldn't change how much unnecessary work the cluster was doing. It was clear that we needed to change which writes reached Ceph in the first place.
Eventually, we moved most of those writes onto the hosts running the jobs, keeping them off the shared cluster unless they needed to survive. This forced us to peek under the hood of how we built persistent caching for CI, and why Ceph struggled with the workload.
Blacksmith is a CI cloud. Every job runs in a Firecracker microVM and the microVM instance is deleted when the job ends.
There is a large common pool of work shared between consecutive CI jobs. A developer may change a few lines of code, or the early steps of a Docker build, without ever touching dependencies. If we could have the cache persist from job to job, we’d eliminate the need for repeat work.
We measured this for Docker builds. Keeping the builder’s disk in place between jobs, we saw a 10 to 30x speed increase.
However, persisting a cache isn’t as trivial as leaving it on the same machine the job ran on. Jobs are placed across the whole fleet, which means that no single job waits for the exact machine that happens to hold its cached data.
Ultimately, we needed a way to make the saved state available to any host without having to repeatedly transfer the entire cache. There is a delicate balance to achieve where the amount of saved data is actually useful, without overstoring and killing performance gains.
There are three fundamental ways to store data remotely. They each give the storage system a different level of visibility into what a job is doing.
An object store. The whole cache is downloaded at the start of a job and uploads it back when it’s done. This is how most of CI caching works today. Unfortunately, the storage can’t discern which parts a job used or changed, so the whole archive moves every time.
A network filesystem. The storage sees files and directories, so it knows the most. It is also the hardest option to integrate, because the size of the interface is so large. Each tool leans on a different part: mmap, file locks, atomic renames, millions of small files. Supporting each tool becomes a project of its own.
A network block device. The microVM gets a disk attached over the network, with an ordinary local filesystem on it and tools running unchanged. The Docker's /var/lib/docker, bare git mirror and Cargo build cache all behave as they would on a laptop. Each tool still needs an integration on our side, but these integrations are very similar and reusable. Only the blocks a job reads are fetched, and only the blocks it changes are written back.
We call it a sticky disk because it “sticks” around. Get it? It’s a persistent, named network block that comes back time and time again for future jobs.
The disks are named. Sometimes it’s set by the user, like Docker build caching, and other times we name it, like we do for git mirrors. A job asks for the specific disk by name and fetches the newest saved version. When the job is done, the final disk state can be saved as a starting point for future jobs.
Complexity increases when multiple jobs want to update the same cache.
A busy repository can run dozens of jobs at once. For example, if 10 of them start from the same saved disk. Every job is getting its own copy, and each job writes to it. When they finish, we’re left with 10 different disks.
Two disks that were written separately cannot be merged afterwards. Each disk now carries its own filesystem changes. Reconciling those changes file by file would cost more than the cache saves. So we keep one disk as the next saved version and delete the other nine.
The first version of the sticky disk sent all 10 copies to the cluster, and the cluster stored each one as if it would be kept.
A design that pays full price for every job's writes pays mostly for data it will delete.
The first version of the sticky disk went live in November 2024. We wanted to start with something that worked out of the box, watch the workload, and invest where the observations pointed, knowing we would iterate into the future. For a network block device, we believe Ceph is a strong choice. We run it on our own hardware, next to the machines that run the microVMs.
Ceph can snapshot a disk image and clone it into a new writable image. We directly mapped the sticky disk onto it:
The result is that every job's copy of the disk was a Ceph clone. Ceph replicated and tracked each clone like any other image, and most were deleted minutes after they were made.
This solve was a success. It allowed us to launch persistent caching without having to build a storage system from scratch. The only issue was that as workload increased, so did our costs.
We found three points where short-lived Ceph clones were making sticky disks expensive: when a job writes to a clone, when the clone is saved, and when the clone is deleted.
Small writes cause larger rewrites. Ceph stores each disk image as a set of 4 MiB objects spread across the cluster. CI jobs mostly write in 4 KiB pieces, about a thousand times smaller: package metadata, timestamps, lock files. A small write into a clone can make Ceph read and rewrite the entire 4 MiB object, along with its replicas, while the job sits idle. Most of the time that clone was not saved, and the work was wasted.
Deletes that never caught up. Every clone that isn't saved has to be deleted. We were creating and deleting about 1.3 million clones a day. Deleting a Ceph clone does not remove its data in real time. Instead, Ceph stores a record of what is gone, and each disk cleans up its share later as a background task. Ceph calls this snaptrim. Every disk in the cluster has to track which clones are gone and the objects they touched, and that bookkeeping costs about the same regardless of size. So a clone with a few kilobytes of writes costs just as much to delete as one with many gigabytes. At that rate, the cleanup fell behind, and tuning Ceph's cleanup parameters for our workload wasn't enough for it to catch up. The backlog passed a hundred billion objects waiting to be trimmed. This created net new work that competed with live jobs for the same disks.
Layers that pile up. Each save added a thin layer on top of the last saved version. If a layer didn't have the data, the read fell through to its parent, then to that layer's parent, and so on.
Deep chains make reads slow, so we capped the depth. When a chain hits the cap, it has to be merged, and Ceph offers only one way to do that: a full flatten, which copies everything reachable from the parents into the child. So every merge costs the disk's whole working set, no matter how small the last save was. Worse yet, old layers can't simply be deleted either. Most of their data has been overwritten, with some blocks still holding the latest data, so a merge must copy the right pieces out of every layer. An audit of one region's cluster in July found that about 59% of stored bytes were history underneath the current disks.
All three issues trace back to how Ceph breaks big disks into many objects and keeps metadata for all of them. That is expensive for a workload like ours, but it also spreads read and write traffic across the whole cluster, so every customer shares one pool and one customer's spike is absorbed by the whole pool.
Ceph did what it promised. It is general-purpose storage, built for data that is kept, and most of ours is deleted within minutes. Despite the fact that clusters are sized in bytes, our workload costs were per event. Most of those events were small writes, clones, deletes, and flattens for data that we were never going to save. Simultaneously, the cluster was almost full even though more than half of its storage held old layers that couldn’t be deleted.
Jobs run at most once and its disk is only a cache, meaning if a job is not going to save, nothing it writes needs to reach the cluster. Those writes can stay on the host the job runs on and get dropped when the job ends. It’s impossible for us to know ahead of time which job we should save, so we make an informed guess and pick one early.
In an ideal world, we'd wait until the jobs finished and choose which disk to save, but that would put the transfer of its changes at the end of the job. If we decide to choose a job early, we can send its writes to the cluster in the background while it runs. This would allow other jobs to keep their writes entirely on the host.
Today, about five-sixths of what jobs write never leaves the host. New layers are added tens of thousands of times a day, down from over a million. The old layers stored on the cluster have fallen to tens of gigabytes.
We still use distributed storage to make cached disks available across our fleet. We just no longer need to use it for every job's writes.
Next up: Part 2 covers the write-back cache that does this, and what it did to these numbers.
