-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Change UnboundedSourceAsSdfWrapperFn to share the cache across instances. #33901
base: master
Are you sure you want to change the base?
Conversation
R: @kennknowles I don't really like the utility class name, let me know if you have some better idea. It seems like this could be a common use within DoFns. For example, @sjvanrossum made me think of this concern in his work on Kafka source in #32986 |
Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control. If you'd like to restart, comment |
…es of a DoFn and use it in UnboundedSourceAsSdfWrapperFn to cache Readers across dofn instances
9967fc8
to
a420191
Compare
assign set of reviewers |
@sjvanrossum I tried to abstract your caching in the KafkaSDF here since there would be similar concerns about a static cache for this dofn. |
Assigning reviewers. If you would like to opt out of this review, comment R: @m-trieu for label java. Available commands:
The PR bot will only process comments in the main thread (not review comments). |
.expireAfterWrite(1, TimeUnit.MINUTES) | ||
.maximumSize(100) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The time-based eviction policy seems to be aligned with the reader cache in the Dataflow runner, but the size-based eviction policy is not present in the Dataflow runner. I'm thinking this would negatively impact Read
instances with > 100 splits.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aside from that, the manual cache management implemented in the restriction tracker looks like it could be replaced by applying #expireAfterAccess(long, TimeUnit)
and #build(CacheLoader)
, but that's a separate issue.
That looks good to me, thanks for distilling it into a utility class! As to naming, this is essentially a Drawing inspiration from Guava's |
Add a utility class to enable sharing across all deserialized instances of a DoFn and use it in UnboundedSourceAsSdfWrapperFn to cache Readers across dofn instances.
fixes #32968
Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
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, commentfixes #<ISSUE NUMBER>
instead.CHANGES.md
with noteworthy changes.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)
See CI.md for more information about GitHub Actions CI or the workflows README to see a list of phrases to trigger workflows.