Kafka · Producers & Consumers

Static membership

Hardstatic membershipgroup.instance.idrebalancedeployments

Interview question

What is static membership in Kafka consumer groups, and why use it?

How to answer

The short answer

Static membership lets a consumer keep a stable identity across restarts so the group does not fully rebalance on every brief leave/join.

The problem it solves

With dynamic membership, each consumer gets a generated member id. On rolling restart:

  1. 1Instance stops → leave group → rebalance
  2. 2Instance starts → join group → rebalance again

That doubles rebalance cost during deploys.

How static membership works

You set a durable group.instance.id per instance (unique within the group).

  • Kafka remembers that instance.
  • On restart within session.timeout, the instance can reclaim the same .
  • Avoids unnecessary rebalances when the same logical member returns quickly.

Careful ops notes

  • group.instance.id must be unique per running member (e.g. pod name / host id).
  • Do not reuse the same id for two live instances.
  • Still need sensible session timeouts; a permanently dead instance eventually is removed.

Interview payoff

Static membership + cooperative rebalancing is a strong "production hardening" answer for reducing consumer downtime during releases.

Interview tip: "Static membership = stable group.instance.id so brief restarts do not thrash partition assignments."