The Real Fullstack

The Rebalance Storm

All brokers are healthy. Why does the consumer group rebalance every five minutes and write duplicates?

مهندس أول9 دقيقةمختبر تصحيح الأخطاءمحاكي التدفّق
kafkaspring-kafkajavakubernetes

لم يُترجم هذا التحدي إلى العربية بعد. أنت تقرأ النسخة الإنجليزية.

المهمة:Read the consumer logs, identify why consumers leave the group, and make processing fit the poll interval — and survive the redeliveries that will still happen.السياق · أهداف التعلّم ▾

Wrenly's tax consumer polls 500 records at a time and calls an external tax API for each (about 0.9 s). A batch takes 7.5 minutes; the broker considers the consumer dead after 5. Partitions move, offsets fail to commit, records are processed twice and lag keeps growing.

المهمة: Read the consumer logs, identify why consumers leave the group, and make processing fit the poll interval — and survive the redeliveries that will still happen.

أهداف التعلّم

  • Understand max.poll.interval.ms and why slow batches trigger rebalances.
  • Size batches to processing time.
  • Make at-least-once consumers idempotent.
المحاكاةمحاكاة
tax-events topictax consumer grouptax records DB
تشغيل المحاكاة
spring.kafka.consumer:  max-poll-records: 50          # 50 × 0.9 s ≈ 45 s ≪ max.poll.interval.ms (300 s)  enable-auto-commit: false     # commit after the work is done (at-least-once)

تبسيط

Three symptoms with deterministic fixes. Real tuning also considers session timeouts and static membership. نموذج تعليمي — الأرقام توضّح سلوكًا وليست قياسات أداء.

المفاهيم

مفيد قبل هذا التحدي

تحديات ذات صلة

المراجع