Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Committing: explore different implementation #841

Closed
ennru opened this issue Jul 1, 2019 · 1 comment
Closed

Committing: explore different implementation #841

ennru opened this issue Jul 1, 2019 · 1 comment

Comments

@ennru
Copy link
Member

ennru commented Jul 1, 2019

Committing: explore different implementation

The current Alpakka Kafka implementation for committing offsets to Kafka relies on collecting offsets for processed messages in the stream. In case of a change in the consumer group, Kafka revokes and assigns partitions which implies that the consumer can't commit any further offsets to partitions that are revoked (and not re-assigned). This means already in-stream collected offsets can't be committed and those messages will be re-emitted to the consumer that gets that partition assigned by Kafka.

Committing on partition revoke

The experiment of introducing a PartitionAssignmentHandler in #761 explores how such a handler could be used to implement committing outside of the current Alpakka Kafka handling. A key idea is to leverage the callback from Kafka when partitions are revoked to commit any offsets which are known to have been processed successfully.

If committing can be handled just before a partition gets revoked, much fewer messages will get reprocessed during consumer rebalancing.

Potential improvements

  1. Fewer messages get reprocessed on rebalance
  2. It would become possible to allow for some out-of-order processing if the committing logic keeps track of holes in the offset list and just commits segments that are done.

Potential negative changes

  1. More actor messaging as every message sends its commit to the collector
  2. Larger change in the Alpakka Kafka architecture

Necessary changes

  1. New "Commit collector" actor as child of KafkaConsumerActor
  2. Change commitScaladsl to send the offset to the "Commit collector" (fire and forget?)
  3. Schedule regular commits from "Commit collector" (using committer max-interval and max-batch)
  4. Commit any uncommitted offsets from the partition revoke by asking the "Commit collector"
  5. Remove batching from the "Committer"
@ennru
Copy link
Member Author

ennru commented Aug 26, 2019

#862 and #868 implement the aggregation of commits.
I'll create a new issue to discuss dropping of commit back-pressure.

@ennru ennru closed this as completed Aug 26, 2019
@ennru ennru added this to the invalid/not release-bound milestone Aug 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant