Skip to content

[#2362] feat(client): Add support of zstd parallel compression#2363

Merged
zuston merged 2 commits intoapache:masterfrom
zuston:2362
Feb 8, 2025
Merged

[#2362] feat(client): Add support of zstd parallel compression#2363
zuston merged 2 commits intoapache:masterfrom
zuston:2362

Conversation

@zuston
Copy link
Member

@zuston zuston commented Feb 7, 2025

What changes were proposed in this pull request?

Add support of zstd parallel compression

Why are the changes needed?

for #2362

Does this PR introduce any user-facing change?

No.

How was this patch tested?

Existing tests

@zuston zuston changed the title feat(#2362): Add support of zstd parallel compression [#2362] feat(client): Add support of zstd parallel compression Feb 7, 2025
@zuston
Copy link
Member Author

zuston commented Feb 7, 2025

cc @jerqi

@roryqi
Copy link
Contributor

roryqi commented Feb 7, 2025

Could u add the document for this PR?

@zuston
Copy link
Member Author

zuston commented Feb 7, 2025

Could u add the document for this PR?

Done

roryqi
roryqi previously approved these changes Feb 7, 2025
Copy link
Contributor

@roryqi roryqi left a comment

Choose a reason for hiding this comment

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

LGTM.

@Override
public byte[] compress(byte[] src) {
return Zstd.compress(src, compressionLevel);
ZstdCompressCtx ctx = new ZstdCompressCtx();
Copy link
Contributor

@roryqi roryqi Feb 7, 2025

Choose a reason for hiding this comment

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

One question: Do we need to create Ctx for every time? It will cost time if ZstdCompressCtx will create and destroy the thread.

Copy link
Member Author

Choose a reason for hiding this comment

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

Nice catch. Actually the code of Zstd.compress(src, compressionLevel); also will create ctx everytime. Let me dig this deeply

Copy link
Contributor

Choose a reason for hiding this comment

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

It's ok if the default context don't need to create extra threads actually. Just feel that we should consider more about this place.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, the compression ctx could be reused.

@github-actions
Copy link

github-actions bot commented Feb 7, 2025

Test Results

 2 981 files  ±0   2 981 suites  ±0   6h 28m 12s ⏱️ -12s
 1 101 tests ±0   1 099 ✅ ±0   2 💤 ±0  0 ❌ ±0 
13 789 runs  ±0  13 759 ✅ ±0  30 💤 ±0  0 ❌ ±0 

Results for commit fce4cc5. ± Comparison against base commit e5cfc4a.

♻️ This comment has been updated with latest results.

if (bufferManager != null) {
bufferManager.freeAllMemory();
try {
bufferManager.close();
Copy link
Contributor

Choose a reason for hiding this comment

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

If bufferManager has the method close, the method close method should contain freeAllMemory method.

Copy link
Member Author

Choose a reason for hiding this comment

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

sounds good

@zuston
Copy link
Member Author

zuston commented Feb 8, 2025

After test, I found we can't reuse the zstc ctx. @jerqi . And so the cost of multi workers compression could be up to users.

@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 85.71429% with 2 lines in your changes missing coverage. Please review.

Project coverage is 51.36%. Comparing base (7cad484) to head (fce4cc5).
Report is 5 commits behind head on master.

Files with missing lines Patch % Lines
...g/apache/uniffle/common/compression/ZstdCodec.java 75.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #2363      +/-   ##
============================================
+ Coverage     51.25%   51.36%   +0.11%     
  Complexity     3007     3007              
============================================
  Files           477      480       +3     
  Lines         22954    22974      +20     
  Branches       2116     2115       -1     
============================================
+ Hits          11765    11801      +36     
+ Misses        10449    10438      -11     
+ Partials        740      735       -5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@zuston
Copy link
Member Author

zuston commented Feb 8, 2025

ptal again @jerqi

@zuston zuston merged commit 47e5d17 into apache:master Feb 8, 2025
80 of 85 checks passed
zuston added a commit to zuston/incubator-uniffle that referenced this pull request Feb 11, 2025
…pache#2363)

### What changes were proposed in this pull request?

Add support of zstd parallel compression

### Why are the changes needed?

for apache#2362 

### Does this PR introduce _any_ user-facing change?

No.

### How was this patch tested?

Existing tests

---------

Co-authored-by: Junfan Zhang <zhangjunfan@qiyi.com>
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.

3 participants