Skip to content

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

trivago tech 5 min read Case study mediumAdept

How We Cut Kafka Consumer Deployment Costs by 83%

Trivago's PSE-kafka service, which consumes hotel price messages and pushes them to an external Ads service, suffered chronic consumer lag at only ~10% CPU because of three compounding bottlenecks. The causes were a custom auto-commit consumer that stopped polling and committing under load, a Mono.delayElement whose throughput was capped by flatMap concurrency divided by delay seconds, and an undersized gRPC client thread pool against a slow downstream. No single fix helped on its own. Migrating to reactor-kafka, replacing the 75-second in-memory delay with an IsFinished flag, and resizing the gRPC pool cut pods from 60 to 6 (83% cost reduction), eliminated lag P1 alerts, and dropped startup time from ~60s to ~10s.

Assumes: Kafka consumer groups and offsetsProject Reactor / reactive streamsbackpressure

Related posts

  • Achieving relentless Kafka reliability at scale with the Streaming Platform

    Datadog Engineering mediumAdept

    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.

  • 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.

  • Enhancing Distributed System Load Shedding with TCP Congestion Control Algorithm

    Zalando Engineering mediumAdept

    Zalando's customer communication platform applies TCP-style AIMD (Additive Increase Multiplicative Decrease) congestion control at its ingestion point to shed load and prioritize critical messages. The Stream Consumer pulls events from Nakadi and watches RabbitMQ publish latency (P50) and publish errors as congestion signals. Each event type's throttle adjusts its consumption rate independently: higher-priority types increase faster and decrease less (e.g. +15/−20% for P1 vs +5/−60% for P3), so no central coordination is needed. After six months in production, order confirmations keep stable processing times while commercial messages absorb delays. RabbitMQ queues stay small, and backlog remains in Nakadi, where low-priority events can be discarded in an emergency.

  • How we optimized our Akka application using Datadog’s Continuous Profiler

    Datadog Engineering mediumAdept

    An auxiliary LatencyReportActor running on Akka's default ForkJoinPool-based dispatcher burned 20-30% of a log-processing service's CPU. Its bursty workload woke all 32 threads every second and then parked them again, so time went into ForkJoinPool.scan() and Unsafe.park()/unpark() native calls. Flame graphs and per-thread CPU breakdowns in a continuous profiler traced the cost to the default dispatcher. A one-line config change moving the actor onto the steadily loaded work dispatcher cut CPU by about 30% and shrank the default pool from 32 to 2 threads. The general advice is to watch scan() time (over 10-15% is a red flag) and keep active thread counts stable by limiting actor instances or pool size, consolidating pools, or queueing bursty tasks.

  • How LY Corporation uses ClickHouse to observe one of the largest Kafka deployments on earth

    ClickHouse mediumAdept

    LY Corporation (LINE + Yahoo! Japan) runs a Kafka platform of 200+ brokers serving 25,000+ clients and handling 31M messages/sec at peak, over 1 trillion messages and 2.6 PB of I/O per day. Its observability stack spans end-to-end latency probes, Async Profiler, eBPF and kernel delay accounting, and disk SMART data. The key layer is a Kafka API request log pipeline: requests are intercepted, serialized with Protocol Buffers, sent through an internal Kafka cluster and batch-ingested into ClickHouse at 7M rows/sec, about 4.1 trillion rows on 24 nodes. SQL queries over these logs confirmed a race condition between Produce and ListOffsets that caused non-monotonic offsets and halted replication, which led to an upstream patch.

The quest for software engineering knowledge.

Look:
Layout: