Skip to content

[KafkaIO] Improve caching in backlog estimation and processing #34331

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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

sjvanrossum
Copy link
Contributor

@sjvanrossum sjvanrossum commented Mar 18, 2025

Caching improvements in a number of places:

  • Migrated per instantiation caches to use the new MemoizingPerInstantiationSerializableSupplier utility class.
  • Added a per instantiation cache for processing consumers.
  • Moved end offset cache refreshes to a background thread.

This results in a significant reduction of processing consumers (before: consumer per split per process element per worker, after: consumer per split per worker). Processing consumers are evicted if they're eligible for collection and are more likely to close their connections after connections.max.idle.ms.


Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:

  • Mention the appropriate issue in your description (for example: addresses #123), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, comment fixes #<ISSUE NUMBER> instead.
  • Update CHANGES.md with noteworthy changes.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

See the Contributor Guide for more tips on how to make review process smoother.

To check the build health, please visit https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md

GitHub Actions Tests Status (on master branch)

Build python source distribution and wheels
Python tests
Java tests
Go tests

See CI.md for more information about GitHub Actions CI or the workflows README to see a list of phrases to trigger workflows.

Copy link
Contributor

Assigning reviewers. If you would like to opt out of this review, comment assign to next reviewer:

R: @kennknowles for label java.
R: @shunping for label io.
R: @Dippatel98 for label kafka.

Available commands:

  • stop reviewer notifications - opt out of the automated review tooling
  • remind me after tests pass - tag the comment author after tests pass
  • waiting on author - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)

The PR bot will only process comments in the main thread (not review comments).

@sjvanrossum sjvanrossum force-pushed the kafkaio-sdf-cached-consumers branch from 291409e to 1cb05c9 Compare March 21, 2025 13:36
@chamikaramj
Copy link
Contributor

Any updates ?

@chamikaramj
Copy link
Contributor

@kennknowles @shunping or @Dippatel98 PTAL

@kennknowles
Copy link
Member

ACK - this change will take me some time to grok

@kennknowles
Copy link
Member

@johnjcasey

Copy link
Contributor

Reminder, please take a look at this pr: @kennknowles @shunping @Dippatel98

Copy link
Contributor

Assigning new set of reviewers because Pr has gone too long without review. If you would like to opt out of this review, comment assign to next reviewer:

R: @ahmedabu98 for label java.
R: @shunping for label io.
R: @johnjcasey for label kafka.

Available commands:

  • stop reviewer notifications - opt out of the automated review tooling
  • remind me after tests pass - tag the comment author after tests pass
  • waiting on author - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)

@ahmedabu98
Copy link
Contributor

Hey @sjvanrossum, are you still working on this?

@sjvanrossum
Copy link
Contributor Author

@ahmedabu98 I just pushed a requested docs change and a fix for a bug I spotted earlier, otherwise this is ready.

@sjvanrossum
Copy link
Contributor Author

@johnjcasey @ahmedabu98 I've addressed the integration test failure in #34711.

@sjvanrossum
Copy link
Contributor Author

@johnjcasey it looks like #34711 fails as a separate PR, but succeeds as part of this PR so I've added it here. Would you mind double checking if it makes sense to have roundTripElements await and then cancel the pipelines it creates?

My understanding of that test is that we validate that a consumer will resume from a committed offset, but waitUntilFinish doesn't guarantee that the pipeline is finished when the timeout expires so both pipelines may be trying to make progress at the same time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants