AMAZINGINDEX.COM 日报快照
58.3
VOL. 2026.08
2026.08.28
← 返回 2026.08.28 日报
日报快照 · Daily Snapshot
NO. 016

Cloudflare DNS 省出 100TB 内存

#ARTICLE HackerNews 2026.08.28
推荐指数 68.0 NO. 016 · 2026.08.28
发布2026/08/27Score524Comments142

Cloudflare 通过五轮内存结构优化,将单条 DNS 缓存条目 footprint 削减 50% 以上,全局释放约 100TB 内存,同时插入吞吐提升 43%、查询延迟降低 19%。对于需要处理海量 KV 数据的基础设施团队,这是内存效率与性能兼得的高价值工程参考。

这篇的精髓不在优化本身,而在"wasting a single byte costs 250GB"的规模化思维。很多团队做缓存设计时只测单机 QPS,忽略了字节级浪费在万节点集群的复利效应。

五个改动里最值得借鉴的是从指针密集型结构切到扁平化数组+索引编码,这其实是游戏引擎和嵌入式领域的老手法,但在高并发网络服务里复用得很少。如果你在做类似 Redis Cluster、特征存储、或实时推荐缓存的系统,可以重点看他们怎么平衡压缩率与随机访问速度。

另外 43% 的插入吞吐提升来自减少 allocation,这对 Go/Rust 团队尤其有启发——GC 压力往往比算法复杂度更先成为瓶颈。

意见分歧 117 条评论

核心争论:早期设计是否应追求内存最优,还是优先快速交付再按需优化

eviks

> Once we store a DNS response in the cache, however, we never modify it again. The capacity field serves no purpose, but still costs 8 bytes per Vec Were there no design discussions/reviews when the system was setup to catch trivial things like this?

micromacrofoot

it was working so no one thought to check

mhitza

Premature optimization argument fits right in. Now that memory is up to 10x more expensive it is worth considering optimizing programs with large memory footprint.

查看原文 →