Technology newsroom
Cloudflare Achieves 100TB RAM Savings on DNS 1.1.1.1 with Rust Code Optimization, No New Servers Needed π
Cloudflare has announced a major improvement to its DNS 1.1.1.1 system, achieving 100TB in RAM savings by optimizing Rust code, without investing in any additional hardware.
π Key Highlights:
- Cloudflare successfully reduced RAM usage on its DNS 1.1.1.1 system by 100TB without adding any hardware.
- This improvement was made on their internal Caching platform named Big Pineapple, primarily focusing on optimizing code written in Rust.
- Engineers were able to reduce the size of each Cache Entry from 953 bytes to approximately 360 bytes, enhancing overall system performance and reducing load.
Cloudflare, a leading network and security provider, has revealed a significant achievement in improving the backend performance of its popular DNS service, 1.1.1.1. They successfully reduced the system's memory (RAM) usage by an enormous 100 terabytes (TB).
This success stems from improvements to their internal DNS Caching platform called Big Pineapple, which is central to services like 1.1.1.1, DNS Firewall, and other DNS offerings. The system engineering team focused on optimizing the performance of code written in Rust, rather than solving the problem by adding more servers or RAM to the system.
π‘ Core of the Improvement
Sebastiaan Neuteboom, a Cloudflare System Engineer, provided technical details, explaining that the team made five key changes to the Rust code. These changes significantly reduced the size of each DNS data item stored in the cache (Cache Entry) from its original 953 bytes to approximately 360 bytes. Techniques used included altering data storage methods, such as switching from resource-intensive data structures like `Vec` to `Arc`, which allows duplicate data to share memory instead of creating new copies each time, as well as utilizing smaller, more suitable data types.
π The Results
Reducing the Cache Entry size by more than half allowed Cloudflare to store a vast amount more DNS data in the same RAM space. The ensuing result is a higher Cache Hit Ratio, meaning users receive DNS responses faster and the burden of sending requests to origin DNS servers (Authoritative DNS Servers) worldwide is reduced. This not only enhances the performance and speed of internet usage for general 1.1.1.1 users but also contributes to Cloudflare's long-term hardware and energy cost reduction.
π¬ Has your organization ever undertaken a major software improvement to reduce hardware resource usage like this? Feel free to share your experiences.