[SPARK-26570][SQL] Reduce memory consumption when transforming very many filestatus in InMemoryFileIndex.bulkListLeafFiles#26105
Closed
viirya wants to merge 3 commits intoapache:masterfrom
Closed
[SPARK-26570][SQL] Reduce memory consumption when transforming very many filestatus in InMemoryFileIndex.bulkListLeafFiles#26105viirya wants to merge 3 commits intoapache:masterfrom
viirya wants to merge 3 commits intoapache:masterfrom
Conversation
|
Test build #112001 has finished for PR 26105 at commit
|
Member
Author
|
First from the stacktrace, I was thinking it is possible that the reason to user OOM is that SerializableFileStatus is too many. Then it is possible to cause OOM when transforming them back to Status. This PR was created for that. But from users latest posts, from jmap logs, looks like SerializableFileStatus do not hold too much memory. For now I am not sure SerializableFileStatus is the cause of the OOM, so close this first. |
|
Did this get resolved? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What changes were proposed in this pull request?
This PR proposes to wrap the collected SerializableFileStatus with SoftReference, when collecting file statuses in InMemoryFileIndex.bulkListLeafFiles.
Then later when we transform SerializableFileStatus back to Status, if there is memory pressure, traversed SerializableFileStatus can be candidates for GC.
Why are the changes needed?
We get an array of (String, Seq[SerializableFileStatus]) when collecting file status in InMemoryFileIndex.bulkListLeafFiles. Then later we transform it back to sequence of (Path, Seq[FileStatus]).
During the transforming, the items in the array are hold and can not be released by GC. Actually we double memory consumption here.
This change wraps the sequence of SerializableFileStatus with SoftReference in the array. So when we transform SerializableFileStatus back to Status, if there is memory pressure, traversed SerializableFileStatus can be candidates for GC.
If SerializableFileStatus that is not traversed yet is cleared up by GC, we log necessary to users suggesting increasing driver memory. Then we re-list file status for the path.
Does this PR introduce any user-facing change?
No
How was this patch tested?
Unit test.