Your site's functions can now remember things: a key-value store for every site, on Pro and Team.Build an app with sign-in

A redeploy that changed three files used to cost 20,040 operations

Republishing a 20,000-file site with three files changed used to cost 20,040 storage operations. It now costs four. The interesting part is not the ratio — it is that the ratio was the wrong reason to do it.

Here is the shape of the problem. Somebody publishes a documentation site: 20,000 files. They fix a typo and publish again. Three files differ.

The obvious implementation charges you for all 20,000. Ours did.

It did because of how the files were laid out. Every deploy got its own prefix — sites/{siteId}/{deployId}/{path} — and a deploy had to be complete under that prefix before it could go live, because serving a path meant asking the bucket for that exact key. So an unchanged file still had to exist under the new deploy's prefix, which meant copying it there. And in object storage, a server-side copy is a write: same billing class as uploading the bytes from scratch.

The arithmetic for that redeploy: 20,000 writes, plus 40 listing calls to verify the result. 20,040 billable operations to change three files.

What replaced it

Content addressing. The bytes of a file are stored under their own hash:

Code
sites/{siteId}/blobs/{sha256}

and each deploy is a manifest: a map from path to hash. Publishing a version is writing that map.

Now the same redeploy is: hash the files locally, ask which hashes the site does not already have, upload those three, write one manifest. Four operations. Three cheap existence checks on top. A ratio of about 5,010×, and — more usefully — a cost that scales with what changed rather than with how big the site is.

Two properties survive that were not optional:

  • Deploys stay immutable. A blob is named by its content, so nothing can ever overwrite anything. Publishing never mutates a previous version; it only adds a manifest that points at some blobs.
  • The cache key does not change. It still contains the site id and the deploy id, so two sites can hold identical bytes — genuinely the same object now — without any chance of one being served under the other's address.

The part that is easy to get wrong

Deletion stops being deletion.

Under the old layout, removing a deploy was removing a prefix. Under content addressing a blob may be referenced by five versions of the site, so "delete this deploy" becomes "drop this manifest, then collect the blobs nothing references any more". That is reference counting, and reference counting is where the real risk of this change lives — not on the read path, which got simpler.

We knew that going in, which is the only reason it is worth writing down: the estimate for the work was deliberately weighted toward garbage collection rather than toward serving.

There was also a measurement we got wrong first. An earlier version of the design said the improvement would be about 455×, and reaching 5,000× would require separately removing the verification step that lists the deploy prefix. That was wrong in an instructive way: content addressing forces that step to go, because the prefix it lists no longer exists. It was not an optional extra optimisation sitting next to the change; it was a consequence of it. We had modelled the new world with a piece of the old one still in it.

Why the ratio was the wrong reason

This is the part that surprised us, and it is why the change nearly did not get prioritised.

Storage operations are cheap. Multiply a small number by 5,000 and you have removed a small number. If the only argument for this work had been the bill, it would have been a poor use of a month — and we said so in the planning document, in the same paragraph that computed the ratio.

The argument that actually carried it was what the old layout made impossible. A deploy that costs a full copy of the site is a deploy you cannot do often. That single fact was quietly blocking four things on the roadmap:

  • a REST deploy token, where automation republishes constantly,
  • an MCP server, where an agent publishes several times in one conversation,
  • editing a file in the browser, where every save is a deploy,
  • a CI action that runs on every push.

All four are "publish a small change frequently". All four were priced out by an implementation that treated every publish as a first publish. The ratio was not a saving; it was the removal of a ceiling that had been shaping the product without anybody deciding it should.

It also changed two limits for the better, immediately and without further work: storage is now counted in distinct blobs, so a customer keeping ten versions of a site is charged for the files, not for ten copies of them — and retaining more versions stopped multiplying bytes.

The generalisable bit

If you are looking at a similar layout, the question that cuts through it is: what is the unit of change, and what does your storage charge you per unit?

A deploy-prefix layout says the unit of change is "a site". Content addressing says it is "a file whose bytes are new". Most publishing workloads are overwhelmingly the second kind — the same site, slightly different — and any design that cannot express that will charge for the difference between them forever.

The cost of getting there is that deletion becomes bookkeeping. That is a real cost, and it is the one to plan around.

This site is the product it is written about.

Drag a folder in and read the link back. No account and no card to publish.