Cloudflare announced a significant reduction in the memory footprint of its internal load-balancing service. By optimizing the Rust implementation of consistent hashing within pingora-ketama, the company reclaimed more than 100 TB of RAM. This optimization targeted the data structures used for distributing cacheable requests across servers.
Cloudflare's Pingora Backend Router relies on consistent hashing, but supporting weighted servers and various feature combinations led to a proliferation of hash rings, increasing memory consumption. The team identified that the pingora-ketama consistent-hashing data structures were consuming excessive memory, prompting an investigation into their design.
Engineers applied probability theory to determine the minimum number of hash points required for accurate distribution. This analysis allowed them to reduce the number of hashes per server by approximately 90% without compromising load-balancing accuracy. The team found that adding more hashes yielded diminishing improvements in load distribution, with the final 90,000 hashes improving error by only 0.7%.
Further memory savings came from optimizing the Rust data structures that stored the remaining hashes. The original representation used an 8-byte 'Point' structure, but the hash and server index could be compactly represented in just 6 bytes. This compaction contributed to the overall memory reduction.
✨ This summary was generated by AI from the outlets' reporting listed below. It is not independently verified and may contain errors — check the original sources. How BrevFeed works →
One email each morning: the day's tech stories, clustered across outlets and summarized. No account needed.
One email a day. Unsubscribe in one click, any time.
Spend a few minutes, get the whole day. Every topic's top stories in one hands-free rundown — listen, watch, or read the transcript.
▶ Play today's briefNew every morning, and the back catalogue is archived by date.
Cloudflare optimized its Rust implementation of consistent hashing in pingora-ketama, reducing the memory footprint of its internal load-balancing service by over 100 TB. This was achieved by compacting hash-ring entries and statistically analyzing hash distribution to decrease the number of hashes per backend by approximately 90% while maintaining load-balancing accuracy.