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

Changes to reduce memory pinned while iterating through state backed iterable #32961

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

scwhittle
Copy link
Contributor

  • remove reference to completed encoded input page from decoder once we have read it.
  • re-read from cache after loading the next page to give eviction a chance to remove blocks

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.

…iterable:

- remove reference to completed encoded input page from decoder once we have read it.
- re-read from cache after loading the next page to give eviction a chance to remove blocks
@github-actions github-actions bot added the java label Oct 29, 2024
@scwhittle
Copy link
Contributor Author

Run Java PreCommit

@scwhittle
Copy link
Contributor Author

Run Java_IOs_Direct PreCommit

@scwhittle
Copy link
Contributor Author

R: @robertwb

@scwhittle
Copy link
Contributor Author

FYI @priyansndesai

@scwhittle scwhittle marked this pull request as ready for review October 29, 2024 15:11
Copy link
Contributor

Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control. If you'd like to restart, comment assign set of reviewers

@scwhittle
Copy link
Contributor Author

Run Java PreCommit

@scwhittle
Copy link
Contributor Author

Run Java_GCP_IO_Direct PreCommit

@@ -202,6 +202,12 @@ public WeightedList<T> decodeFromChunkBoundaryToChunkBoundary() {
T next = next();
rvals.add(next);
}
// We don't support seeking backwards so release the memory of the last
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this only happen on the last block? (Otherwise, wouldn't we typically break because previousStream != inbound.currentStream?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No this happens whenever decoding an element ends up completing consuming the current bytestring. Since we are communicating entire elements over the fnapi that occurs for every block.
(In fact it seems like a bug otherwise since we are looping over decodeFromChunkBoundaryToChunkBoundary above this and this method discards the currentStream on line 194; if there were bytes in it they would be lost.)

previousStream would only not equal currentStream in the case where the decoder needed to move to the next bytestring to finish parsing the next element. If that did happen, we would no longer be holding onto currentStream and it would be eligible for collection anyway.

@scwhittle scwhittle closed this Nov 4, 2024
@scwhittle scwhittle reopened this Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants