How we built reliable log delivery to thousands of unpredictable endpoints
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.
Related posts
- Achieving relentless Kafka reliability at scale with the Streaming Platform
Datadog Engineering mediumAdeptDatadog 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.
- How We Rebuilt Our Log Storage and Search Infrastructure for Scale
Railway mediumAdeptRailway replaced per-request Docker log polling (every 2 seconds, straining the Docker daemon across 500,000+ deployments) with a centralized log pipeline. Docker's syslog driver forwards container logs to a per-node Vector agent, which ships them to a central Vector instance that writes hourly filesystem buckets for real-time tailing and short-term queries and batches them to Google Cloud Storage for long-term retention. A Go gRPC streaming service serves logs through GraphQL subscriptions to the React frontend, enabling historical deployment logs and keyword filtering, with Vector's Datadog sink used for pipeline monitoring.
- Husky: Exactly-once ingestion and multi-tenancy at scale
Datadog Engineering hardMasterHusky, 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. Time-bounded, immutable Shard Placements are allocated per tenant by a Sharding Allocator that uses FoundationDB transactions to give every Shard Router node the same answer. An Autosharder resizes each tenant's shard count from byte-throughput metrics. Consistent hashing with wraparound and shard exclusions keeps placement churn minimal, and a balancer counters hotspots. Limiting how many tenants each writer handles also cuts the number of blob-storage files and compaction work.
- Building Self-driving Kafka clusters using open source components
Slack Engineering mediumAdeptSlack 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.
- Ensuring reliable OpenTelemetry ingestion at scale
ClickHouse mediumAdept
ClickHouse's LogHouse OpenTelemetry pipeline, ingesting 50 million events per second, absorbs database backpressure by failing over to S3 rather than buffering in memory, local WALs or Kafka. Collector file_storage WALs forced StatefulSets, drained slowly (about 4 hours per TiB) and queued fresh data behind backlog in FIFO order. The final design uses the OTel failoverconnector to route to ClickHouse first and spill to S3 only under backpressure, which limits PUT costs to outage windows. A separate scale-to-zero collector replays spilled blobs via SQS event notifications. Key details include disabling the ClickHouse exporter's sending queue so errors reach the connector, keeping inline retries, enabling the queue on the S3 exporter, and spreading keys across a wide keyspace to avoid prefix throttling.