we_are_coded.by CODE · The world, decoded
БГ

Cloudflare · Cache

Cloudflare rearranged one record in memory and got 100 terabytes back, and the cache got faster

The platform behind 1.1.1.1 holds over 250 billion cache entries at any moment. Five successive changes to how they are laid out cut each entry by more than half. The memory freed is roughly the entire RAM of 130 of their servers.

Source
Cloudflare Blog
Published
The event
Checked on
Responsible editor
Cvetelin Ivanov
How we work
MethodCorrections

One byte. Waste it per entry and, at their scale, that is 250 gigabytes.

Big Pineapple is the platform running 1.1.1.1, Gateway DNS, DNS Firewall and several other Cloudflare services. At any given moment more than 250 billion cached answers sit in its memory. At that size optimisation is not a sport - it is an invoice, paid in servers.

Fact

The facts: on 27 August 2026 Cloudflare published a technical breakdown of DNS cache optimisation in Big Pineapple, the platform serving 1.1.1.1, Gateway DNS, DNS Firewall and AS112. Per the company the platform stores over 250 billion cache entries at any given time, where a single wasted byte per entry costs more than 250 gigabytes of memory across the fleet. Five successive changes to how entries are stored in memory cut the per-entry footprint by more than 50 per cent. Across the fleet this frees roughly 100 terabytes of memory, comparable to the entire RAM of 130 of their Gen 13 servers. At the same time insert throughput rose 43 per cent and lookup latency dropped 19 per cent. The code is Rust; the post is by Sebastiaan Neuteboom.

Why this is rare

Usually a rewrite like this comes with a trade. Shrink the memory and you pay in speed, because you add a layer of unpacking. Chase speed and you pay in memory, because everything stays unfolded and ready. Anyone who has touched a cache has felt it.

Here the trade did not happen. Fewer allocations and tighter packing do both at once, because the processor reads neighbouring bytes instead of jumping around memory. That is an old engineering fact - it is simply visible to the naked eye at this scale.

The win did not come from a new algorithm. It came from the layout.

What I take from it

We do not hold 250 billion entries and never will. But the same arithmetic applies in the small: one redundant structure in the hot path of our admin panel multiplies by every request, every day, quietly. The only difference is that nobody sends us an invoice, so nobody looks.

And one more thing I like about their write-up: there is not a single sentence about artificial intelligence in it. Just people who went and looked at where the memory was going.

The visual is generated code-art, no third-party images.