Skip to content
Ameen Abozaid
SRB-006

Large-scale messaging

  • 8 Lessons
  • 3.5 h practice (estimate)
On this page 9 topics

Overview

Topics

  • Partition strategies
  • consumer lag
  • rebalancing
  • backpressure

Learn first

3.5 h of practice (estimate)

Learning outcomes

  1. Choose partition counts and keys for throughput, ordering, and future growth.
  2. Monitor and act on consumer lag with clear thresholds.
  3. Minimize rebalancing impact (cooperative rebalancing, static membership).
  4. Apply backpressure end to end so producers cannot overwhelm consumers.
  5. Plan Kafka cluster capacity, retention, and multi-tenant topic governance.

Lessons

  1. 01Messaging at scale
  2. 02Partition strategy
  3. 03Consumer lag
  4. 04Rebalancing
  5. 05Backpressure end to end
  6. 06Cluster capacity and governance
  7. 07Demo: recovering from a six-hour consumer backlog
  8. 08Demo: choosing partition counts for three years of growth

Lab and exercises

Lab

SRB-006-LAB1 · Partner feed at scale

Outcomes: 1, 2, 3, 4, 5 · Time: ~3.5 h

  1. Estimate volume (50x Shop orders) and growth for three years.
  2. Design topics, keys, partition counts, and consumer groups.
  3. Define lag alerts, action plans, and a backlog-recovery plan.
  4. Run a load test that simulates a backlog and measure catch-up time.

Acceptance: load test proves catch-up time within target; lag alerts have action plans.

Exercises

IDOutcomeTask
SRB-006-EX011Choose partition count for 20,000 msg/s with 2,000 msg/s per consumer and 3x growth.
SRB-006-EX021Pick the key for shipment events and justify.
SRB-006-EX032Write two lag alerts with thresholds and first actions.
SRB-006-EX043A rolling deploy causes repeated stop-the-world rebalances. Propose fixes.
SRB-006-EX054Design backpressure for ingest from partner HTTP to Kafka to DB.
SRB-006-EX065Compute storage for 5,000 msg/s x 1 KB, 7 days, replication 3.
Show solutions
  • EX01 At least 10 now, 30 for growth; add catch-up headroom, e.g. 36 to 48.
  • EX02 shipmentId keeps per-shipment order; avoid carrierId which creates hot keys.
  • EX03 Warning: time-lag 2 min sustained; check handler latency and errors. Page: 10 min or rising; scale consumers, check downstream.
  • EX04 Cooperative assignor, static membership, longer session timeout, tune max poll interval.
  • EX05 Rate limit at the ingest API, bounded in-flight sends, pause consumer on DB slowness, shed or queue policy at the edge.
  • EX06 5,000 KB/s x 604,800 s about 3 TB x 3 = about 9 TB; check compression and verify with real data.

Workplace evidence: a messaging scale problem you diagnosed or prevented.

Quiz

Outcomes: O1 partitions · O2 lag · O3 rebalancing · O4 backpressure · O5 capacity and governance.

A self-check for you: nothing is graded, saved or sent anywhere. Choose an answer, then check it. You can try again as often as you like.

  1. 1Max active consumers in a group per topic equals:O1
  2. 2Same key means:O1
  3. 3Sizing partitions only for today risks:O1
  4. 4Best lag metric for users:O2
  5. 5A lag alert should include:O2
  6. 6Cooperative rebalancing:O3
  7. 7Static membership helps:O3
  8. 8Backpressure is:O4
  9. 9Unbounded queues:O4
  10. 10Storage grows with rate, retention and:O5

Practical part

Design review of the lab's feed design with load test results. Pass: 70% on the quiz and catch-up time within target.

Common mistakes

Partition counts chosen for today; lag alerts without action plans.

Assessment

Design review.

Workplace evidence

A messaging scale problem you diagnosed or prevented.

Career relevance

Platform strategy (STF-004).

Type to search levels, phases, modules and lessons.