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. 教育用モデルです。数値は挙動を示すためのもので、ベンチマークではありません。

コンセプト

先に取り組むと役立つ課題

関連する課題

参考資料