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

[ISSUE-455] Lazily create uncompressedData #457

Merged
merged 3 commits into from
Jan 6, 2023

Conversation

xianjingfeng
Copy link
Member

What changes were proposed in this pull request?

Lazily create uncompressedData.

Why are the changes needed?

Save memory. #455

Does this PR introduce any user-facing change?

No

How was this patch tested?

The existing UTs is enough

@xianjingfeng xianjingfeng requested a review from zuston January 5, 2023 02:59
@codecov-commenter
Copy link

codecov-commenter commented Jan 5, 2023

Codecov Report

Merging #457 (b23b540) into master (9572b84) will increase coverage by 3.06%.
The diff coverage is n/a.

@@             Coverage Diff              @@
##             master     #457      +/-   ##
============================================
+ Coverage     58.67%   61.74%   +3.06%     
- Complexity     1654     1655       +1     
============================================
  Files           199      193       -6     
  Lines         11217    10053    -1164     
  Branches        997      997              
============================================
- Hits           6582     6207     -375     
+ Misses         4243     3514     -729     
+ Partials        392      332      -60     
Impacted Files Coverage Δ
...e/spark/shuffle/reader/RssShuffleDataIterator.java 94.28% <ø> (+1.13%) ⬆️
...y/kubernetes/operator/pkg/webhook/inspector/rss.go
...y/kubernetes/operator/pkg/webhook/inspector/pod.go
...oy/kubernetes/operator/pkg/controller/util/util.go
...bernetes/operator/pkg/controller/controller/rss.go
...rnetes/operator/pkg/webhook/inspector/inspector.go
deploy/kubernetes/operator/pkg/webhook/manager.go

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

// todo: support off-heap bytebuffer
uncompressedData = ByteBuffer.allocate(
(int) rssConf.getSizeAsBytes(
RssClientConfig.RSS_WRITER_BUFFER_SIZE,
Copy link
Contributor

Choose a reason for hiding this comment

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

this should be RSS_READER_BUFFER_SIZE?
And for this if block, the bufferSize should be max(readBufferSize, uncompressedLen)?

Could you add a test case for this scenario?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think the purpose of using RSS_WRITER_BUFFER_SIZE may be to avoid allocate memory for multiple times.Let's remove it.

Copy link
Member

Choose a reason for hiding this comment

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

Yes. The initial uncompressedData size is hard to set. I prefer to remove it.

jerqi
jerqi previously approved these changes Jan 6, 2023
Copy link
Contributor

@jerqi jerqi left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -69,13 +67,6 @@ public RssShuffleDataIterator(
this.shuffleReadClient = shuffleReadClient;
this.shuffleReadMetrics = shuffleReadMetrics;
this.codec = Codec.newInstance(rssConf);
// todo: support off-heap bytebuffer
Copy link
Contributor

Choose a reason for hiding this comment

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

We would better not remove this todo comment.

zuston
zuston previously approved these changes Jan 6, 2023
Copy link
Member

@zuston zuston left a comment

Choose a reason for hiding this comment

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

LGTM

@xianjingfeng xianjingfeng dismissed stale reviews from zuston and jerqi via b23b540 January 6, 2023 09:18
@zuston zuston merged commit 2b756c3 into apache:master Jan 6, 2023
@zuston
Copy link
Member

zuston commented Jan 6, 2023

Merged. Thanks @jerqi @xianjingfeng @advancedxy

@xianjingfeng xianjingfeng deleted the issue_455 branch March 1, 2023 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants