Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Datadog Engineering 10 min read Case study mediumAdept

Achieving relentless Kafka reliability at scale with the Streaming Platform

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. A custom coordinator, the Assigner, replaces Kafka's timeout-based group coordination with metric-driven, seconds-scale rebalancing and live failovers that create a new topic and drain the old one. Head-of-line blocking is removed with priority lanes, a dead-letter lane for poison pills, and multi-range offset tracking stored in commit metadata, which also carries ingestion timestamps to compute real-time time lag from __consumer_offsets. After zstd decompression bombs crashed consumers, the team built libstreaming, a Rust Kafka client with bindings for other languages, and rejected a gRPC proxy because of throughput and latency costs.

Related posts

  • Building Self-driving Kafka clusters using open source components

    Slack Engineering mediumAdept

    Slack standardized roughly 10 Kafka clusters (0.7 PB, 6.5 Gbps peak) onto Kafka 2.0.1 and automated their operation with Chef, Terraform ASGs, Consul-assigned Zookeeper IDs, Cruise Control, Kafka Manager and a Prometheus offset exporter. Hot spots were removed by making partition counts a multiple of broker count, balancing consumers, throttling replication bandwidth and moving partitions in small batches. Chaos testing with dark traffic showed recovery was limited by packets per second, which jumbo frames helped address. It also motivated a dedicated Zookeeper per Kafka cluster and a cut-over upgrade policy instead of in-place upgrades. Splitting the largest topics off a saturated 90-broker cluster onto d3en instances gave about 2.5x efficiency, cut worst-case log latency from about 1.5 hours to 3-4 minutes, and reduced monthly alerts from 71 to 9.

  • How we built reliable log delivery to thousands of unpredictable endpoints

    Datadog Engineering mediumAdept

    Datadog's Log Forwarding avoids head-of-line blocking from Kafka's per-partition FIFO ordering by moving logs out of Kafka early into cloud object storage, grouped by destination. A stager service reads logs from Kafka and writes slice files of individually compressed per-destination slices, which it uploads and registers in a metadata store before committing Kafka offsets. A leader-elected planner builds lightweight forwarding tasks from eligible slices based on each destination's batching settings. Shipper workers range-read only the slices they need, send them to the endpoint and retry failures with exponential backoff, which gives per-endpoint isolation without a Kafka topic per destination and scales horizontally to gigabytes per second.

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

    Datadog Engineering mediumAdept

    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.

  • How We Built Automated Capacity Testing for Kafka Consumers

    Booking.com Engineering mediumAdept

    Booking.com extended its HTTP capacity-testing platform to Kafka consumers by using partition assignment as the load knob: a custom priority-aware partition assignor shifts extra partitions onto one target instance step by step, reproducing failure-induced load concentration without killing healthy consumers. A Kafka capacity API translates the scheduler's abstract load ratio into concrete assignments, and a composite health check (liveness, CPU/memory headroom, consumer lag percentile, throughput and errors) decides when to stop and record the last healthy step. Scale commands carry a TTL lease so assignments revert automatically if the controller dies. Load steps are discrete at roughly 1/P of the topic, so effective ratios should be reported. Tests must also be serialized per consumer group because rebalances are group-wide, and the results make N-1 resilience policies testable and support right-sizing.

  • Failure is inevitable: Learning from a large outage, and building for reliability in depth at Datadog

    Datadog Engineering mediumAdept

    A March 2023 unsupervised global update knocked out connectivity to 50–60% of Datadog's Kubernetes nodes, yet the platform appeared fully down because services were designed to stop rather than show partial data. Instead of only fixing the trigger, Datadog rebuilt for graceful degradation. Changes include persisting data at intake before acknowledging receipt, letting pipelines skip backlogs to serve live data first, retries with backoff and earlier dead-letter queues, Kubernetes PriorityClass and faster autoscaling, removing a shared Cassandra tag cache from the critical path, cluster-local Vault instances, break-glass paths around circular recovery dependencies, and automated chaos testing. The general lessons are to persist early, prioritize real-time data, avoid global control systems, and scrutinize retries and caches.

The quest for software engineering knowledge.

Look:
Layout: