The effect of switching to TCMalloc on RocksDB memory use
Feb 3, 2021Dmitry Vorobev

Summary
This post details how Cloudflare identified and resolved a significant memory consumption issue in its Quicksilver configuration distribution system after migrating its storage engine to RocksDB. By analyzing unexpected memory growth and heap profiling, the team discovered that the default glibc malloc allocator was causing memory fragmentation and inefficient memory reuse in a highly concurrent environment. Switching to TCMalloc, a memory allocator designed for multithreading, resulted in a 2.5x reduction in memory usage, demonstrating a key optimization in Cloudflare's memory management strategies for performance and efficiency.
More from the Hardware Infrastructure & Performance Optimization trail
- How we reduced core unit boot time from hours to minutes
- A one-line Kubernetes fix that saved 600 hours a year
- Launching Cloudflare’s Gen 13 servers- trading cache for cores for 2x edge compute performance
- Inside Gen 13- how we built our most powerful server yet
- So long, and thanks for all the fish- how to escape the Linux networking stack