---
title: "How we scaled metrics aggregation by moving durable state into storage"
description: "Datadog's metrics aggregation service, which merges DDSketch distributions to reduce tag dimensions, went through three generations as volume grew roughly 10× each time."
url: "https://swe.quest/articles/how-we-scaled-metrics-aggregation-by-moving-durable-state-into-storage-09bea3fd544962da"
canonical: "https://www.datadoghq.com/blog/engineering/how-we-scaled-metrics-aggregation/"
source: "Datadog Engineering"
published: "2026-11-17"
difficulty: "medium"
kind: "Case study"
reading_minutes: 12
tags: ["stream-processing","scalability","observability","storage-engines","distributed-systems"]
---

# How we scaled metrics aggregation by moving durable state into storage

A post on [Datadog Engineering](https://swe.quest/sources/datadog.md), published 2026-11-17, 12 min read, Case study. Original: [https://www.datadoghq.com/blog/engineering/how-we-scaled-metrics-aggregation/](https://www.datadoghq.com/blog/engineering/how-we-scaled-metrics-aggregation/)

## Summary

Datadog's metrics aggregation service, which merges DDSketch distributions to reduce tag dimensions, went through three generations as volume grew roughly 10× each time. Static leader-follower partitions with local RocksDB doubled compute and needed manual partition splits. Dynamic Kafka assignment with incremental SSTable snapshots to blob storage and time-windowed lazy restore improved recovery and enabled autoscaling, but state recovery then became the bottleneck. The third generation makes streaming aggregation and deduplication best-effort. Both storage tiers reconcile partial aggregates, duplicates and late data during reads and compaction, so workers can restart at the live edge without restoring hours of state and can be provisioned for current traffic.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Stream processing](https://swe.quest/tags/stream-processing.md) (Data & databases)
- [Scaling](https://swe.quest/tags/scalability.md) (Distributed systems)
- [Observability](https://swe.quest/tags/observability.md) (Reliability & operations)
- [Storage engines](https://swe.quest/tags/storage-engines.md) (Data & databases)
- [Distributed systems](https://swe.quest/tags/distributed-systems.md) (Distributed systems)

## Prerequisites

- Kafka partitions and consumer groups ([easy posts on Queues & messaging](https://swe.quest/tags/messaging.md?difficulty=easy))
- RocksDB basics
- stream processing semantics ([easy posts on Stream processing](https://swe.quest/tags/stream-processing.md?difficulty=easy))

## Keywords

Datadog, DDSketch, Kafka, RocksDB, Datadog Streaming Platform

## Related posts

- [Scaling down to speed up: How we improved efficiency of live process metrics by 100x](https://swe.quest/articles/scaling-down-to-speed-up-how-we-improved-efficiency-of-live-process-metrics-by-db520ecc99ab0c49.md): Datadog Engineering · 2025-08-12 · Medium · 8 min read · Observability, Scaling, Cost optimization, Queues & messaging, System design
  Datadog cut real-time process and container metric traffic by about 100x by enabling 2-second live collection only on hosts whose processes a user is actually viewing (at most 50 per user), instead of on every host in the tenant.
- [Husky: Efficient compaction at Datadog scale](https://swe.quest/articles/husky-efficient-compaction-at-datadog-scale-eba7e7c7e1831aee.md): Datadog Engineering · 2025-01-29 · Hard · 18 min read · Storage engines, Analytics & OLAP, Observability, Performance engineering, Distributed databases
  Husky, Datadog's observability event store layered over object storage, keeps query cost low by controlling fragment count and layout through streaming compaction.
- [Evolving the Backend Storage for Platform Metrics](https://swe.quest/articles/evolving-the-backend-storage-for-platform-metrics-0fb82a7939c98396.md): Heroku Engineering · 2024-05-09 · Medium · 6 min read · Databases, Distributed databases, Observability, Cloud platforms, Schema migrations
  Heroku migrated the time-series store behind MetaaS, its internal metrics service, from self-managed Apache Cassandra to AWS DynamoDB without user-visible impact.
- [Achieving relentless Kafka reliability at scale with the Streaming Platform](https://swe.quest/articles/achieving-relentless-kafka-reliability-at-scale-with-the-streaming-platform-ccf96914fd7cb7a9.md): Datadog Engineering · 2025-02-19 · Medium · 10 min read · Queues & messaging, Resilience, Distributed systems, Scaling, Rust
  Datadog runs hundreds of Kafka clusters with millions of partitions and built the Streaming Platform, a control layer that decouples producers and consumers from specific clusters through "Streams" spanning clusters, AZs and Kubernetes environments.
- [Husky: Exactly-once ingestion and multi-tenancy at scale](https://swe.quest/articles/husky-exactly-once-ingestion-and-multi-tenancy-at-scale-e0787135af05f4f3.md): Datadog Engineering · 2023-02-22 · Hard · 21 min read · Multi-tenancy, Distributed systems, Stream processing, Queues & messaging, Analytics & OLAP
  Husky, Datadog's columnar event store, achieves exactly-once ingestion and cost-efficient multi-tenancy by routing events deterministically to Kafka partition groups (shards), so deduplication only has to happen within a shard.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
