The Real Fullstack

The Growing Kafka Lag

We scaled the consumer group from 12 to 48 pods. Why is the lag still climbing?

高级工程师9 分钟性能实验室流程模拟器
kafkakubernetespostgresqljava

此挑战尚未翻译为简体中文,你正在阅读英文版本。

任务:Stop the lag from growing with every component below 80% utilisation.背景 · 学习目标 ▾

Quillfin ingests 4,000 click events per second from a 12-partition topic and writes each event to PostgreSQL with one INSERT. Lag grows during the day and recovers at night. The first reaction was to add consumer pods.

任务: Stop the lag from growing with every component below 80% utilisation.

学习目标

  • Know that consumers beyond the partition count sit idle.
  • Find the real bottleneck downstream of the consumer.
  • Batch writes to raise throughput per database round trip.
模拟
模拟数据
clicks topicConsumer groupPostgreSQL
运行模拟
@KafkaListener(topics = "clicks", concurrency = "12")public void onClick(Click c) {  jdbc.update("INSERT INTO clicks(...) VALUES (?, ?, ?)", c.user(), c.page(), c.at());  // 1 round trip per record}

简化说明

Steady-state queueing with a 40-connection database pool. Rebalancing pauses and skewed keys are ignored. 教学模型——数字用于说明行为,并非基准测试。

概念

建议先完成

相关挑战

参考资料