Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
KafkaConsumerActor.manualCommitAsync
no longer semantically blocks the actor polling loop. It shares the same implementation asCommittableConsumerRecord.commit
, except it does not apply the commit recovery policy. Instead, it leverages the existing queue mechanism rather than spawning a new fiber.The combination of actor blocking and fiber spawning is assumed to contribute to the observed performance degradation.
Motivation
In our model, we manage over 1,000 integrations, where each integration translates to N Kafka consumers (where N is the number of partitions per topic) assigned—not subscribed—to the respective topics. On average, each topic has 24 partitions, resulting in approximately 24,000 active consumers.
Previously, we used
CommitBatch.commit
and observed p95 latencies (averaged across all hosts) of 70ms during quiet hours and 140ms during busy ones.These times followed the traffic pattern and reflected normal circumstances.
When switching to
commitAsync
, however, the observed p95 latencies more than doubled: 240ms during quiet hoursand 300ms during busy ones.
While these measurements include the overhead of Cats Effect scheduling and CPU competition, the observation conditions remained consistent during the comparison: