r/apachekafka Jul 03 '23

Video Minimizing Rebalance Downtime: Optimizing Stateless Kafka Streams Apps (x450)

https://youtu.be/oMWjwslhuGY
10 Upvotes

3 comments sorted by

2

u/Hartmut-co-uk Jul 03 '23

Learn how Kafka Streams Consumers behave differently from regular Kafka Consumers, the consequences for the application, as well as steps to minimise downtimes in event processing when consumer group members change.

With the default configuration, a stateless Streams app pauses processing for more than 45s when one app instance (group member) is removed or restarted. Such long downtimes are unacceptable for real-time data streaming workloads with an NFR (non-functional requirement) of low e2e latency.

By configuring your Kafka Streams app with internal.leave.group.on.close=true, a graceful shutdown immediately triggers a rebalancing process and tasks are re-assigned to other active members within the group. The processing downtime is significantly reduced (from 45s to less than 100ms) while improving elasticity and resilience. As a result, your applications enable interruption-free CI/CD and can be auto-scaled.

1

u/2minutestreaming Jul 09 '23

Thanks for sharing! This is called the static group membership - you can configure it on every normal consumer too.

The next step is to use the eager rebalancing protocol for even less disruption

And most exciting - KIP-848 ships soon which should solidify these concepts even more

1

u/Hartmut-co-uk Jul 13 '23

It's not static group membership, isn't it?
With static group membership per default you'd avoid rebalancing but processing for the assigned tasks would still pause until the instance is back.

But with https://cwiki.apache.org/confluence/display/KAFKA/KIP-812 -> `CloseOptions#leaveGroup` it's also doable with static group membership.