Skip to content

[#2496] improvement(server): Improve the performance of flushing single buffer #2523

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

Merged
merged 2 commits into from
Jun 27, 2025

Conversation

xianjingfeng
Copy link
Member

What changes were proposed in this pull request?

Improve the performance of flushing single buffer

Why are the changes needed?

Fix: #2496

Does this PR introduce any user-facing change?

No.

How was this patch tested?

CI

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.

Nick work @xianjingfeng . I observed some similar performance problems in current java based shuffle-server.

isHugePartition,
buffer.getEncodedLength(),
buffer.getBlockCount());
synchronized (this) {
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to lock all when flushing? From my point, we could just use the tryLock to trigger the flush?

Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe we can use buffer as the lock

Copy link
Member

Choose a reason for hiding this comment

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

Yes. If the buffer’s internal operations are thread-safe, flushing and adding can happen concurrently on the same buffer.
In this case, the external flush can be triggered once, guarded by a Lock — using only tryLock

Copy link
Member

Choose a reason for hiding this comment

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

But this could be finished in the another PR if you want

Copy link
Member

Choose a reason for hiding this comment

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

My mistake, this PR is scoped in the flushSingleBuffer . The lock neen't optimize, synchorize is enough and good.

Copy link

github-actions bot commented Jun 26, 2025

Test Results

 3 049 files  ±0   3 049 suites  ±0   6h 49m 2s ⏱️ +44s
 1 188 tests ±0   1 187 ✅ ±0   1 💤 ±0  0 ❌ ±0 
15 067 runs  ±0  15 052 ✅ ±0  15 💤 ±0  0 ❌ ±0 

Results for commit ce24000. ± Comparison against base commit 7781bf6.

♻️ This comment has been updated with latest results.

zuston
zuston previously approved these changes Jun 26, 2025
@xianjingfeng xianjingfeng merged commit 887d042 into apache:master Jun 27, 2025
41 checks passed
@xianjingfeng
Copy link
Member Author

Thanks for your review. @zuston

@xianjingfeng xianjingfeng deleted the issue_2496 branch June 27, 2025 02:12
xianjingfeng added a commit that referenced this pull request Jun 30, 2025
…uffer flushing (#2524)

### What changes were proposed in this pull request?
Use tryLock instead of synchronized when flush buffer

### Why are the changes needed?
To followup the #2523 for better performance, this optimization is mentioned in #2523 (comment)

### Does this PR introduce any user-facing change?
No.

### How was this patch tested?
CI
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.

[Improvement] Improve the performance of flushing single buffer
2 participants