Performance improvements in the Datadog Agent metrics pipeline | Datadog
Jan 31, 2023Remy Mathieu

Summary
This post details performance improvements in the Datadog Agent's metrics pipeline, specifically focusing on optimizing the computation of unique keys for metrics. The team identified a bottleneck in the original algorithm's sorting and deduplication of tags. They implemented several strategies: specializing the sorting algorithm based on the number of tags, switching to a faster hash implementation (murmur3), and optimizing map access with 64-bit keys. The most significant improvement came from redesigning the context generation algorithm to use XOR bitwise operations instead of merging hashes, removing the need for sorting. A custom hash set was introduced for efficient tag deduplication, avoiding the overhead of Go maps.
More from the Java CPU Profiling trail
- How we built an async-aware Python profiler | Datadog
- Unbiased Java CPU profiling with JFR in JDK 25 | Datadog
- From hand-tuned Go to self-optimizing code: Building BitsEvolve | Datadog
- How we tracked down a Go 1.24 memory regression across hundreds of pods | Datadog
- .NET Continuous Profiler: Exception and lock contention | Datadog