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

[CELEBORN-1815] Support UnpooledByteBufAllocator #3043

Closed
wants to merge 3 commits into from

Conversation

pan3793
Copy link
Member

@pan3793 pan3793 commented Dec 31, 2024

What changes were proposed in this pull request?

This PR introduces a configuration celeborn.network.memory.allocator.pooled to allow users to disable PooledByteBufAllocator globally and always use UnpooledByteBufAllocator.

Why are the changes needed?

In some extreme cases, the Netty's PooledByteBufAllocator might have tons of 4MiB chunks but only a few sizes of the capacity are used by the real data(see #3018), for scenarios that stability is important than performance, it's desirable to allow users to disable the PooledByteBufAllocator globally.

Does this PR introduce any user-facing change?

Add a new feature, disabled by default.

How was this patch tested?

Pass UT to ensure correctness. Performance and memory impact need to be verified in the production scale cluster.

source.addGauge(
MetricRegistry.name(metricPrefix, "usedDirectMemory"),
labels,
unpooledMetric::usedDirectMemory);
Copy link
Member Author

Choose a reason for hiding this comment

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

UnpooledByteBufAllocator only supports these two metrics

@@ -45,7 +45,7 @@ public FlinkTransportClientFactory(
TransportContext context, List<TransportClientBootstrap> bootstraps, int bufferSizeBytes) {
super(context, bootstraps);
bufferSuppliers = JavaUtils.newConcurrentHashMap();
this.pooledAllocator = new UnpooledByteBufAllocator(true);
this.allocator = new UnpooledByteBufAllocator(true);
Copy link
Member Author

Choose a reason for hiding this comment

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

Interesting... Flink client overrides it to forcibly use UnpooledByteBufAllocator

Copy link
Contributor

Choose a reason for hiding this comment

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

This is related to this PR. The Flink client's memory is quite limited.
#1324

Copy link
Member Author

Choose a reason for hiding this comment

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

@FMX Thanks for the information. BTW, it's better to leave some brief comments to explain the special logic

boolean allowDirectBufs, boolean allowCache, int numCores) {
if (numCores == 0) {
numCores = Runtime.getRuntime().availableProcessors();
private static ByteBufAllocator createByteBufAllocator(
Copy link
Contributor

Choose a reason for hiding this comment

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

The method comments should also be updated

Copy link
Member Author

Choose a reason for hiding this comment

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

update: move the existing comment to the caller side, add new comments to explain each parameters

Copy link
Contributor

@cfmcgrady cfmcgrady left a comment

Choose a reason for hiding this comment

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

LGTM. except a nit.

Copy link

codecov bot commented Jan 1, 2025

Codecov Report

Attention: Patch coverage is 28.39506% with 58 lines in your changes missing coverage. Please review.

Project coverage is 32.67%. Comparing base (fde6365) to head (b3d569a).
Report is 11 commits behind head on main.

Files with missing lines Patch % Lines
...leborn/common/network/util/NettyMemoryMetrics.java 0.00% 42 Missing ⚠️
...pache/celeborn/common/network/util/NettyUtils.java 40.75% 9 Missing and 7 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3043      +/-   ##
==========================================
- Coverage   32.68%   32.67%   -0.00%     
==========================================
  Files         336      336              
  Lines       20032    20053      +21     
  Branches     1792     1796       +4     
==========================================
+ Hits         6546     6551       +5     
- Misses      13123    13137      +14     
- Partials      363      365       +2     

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

Copy link
Contributor

@FMX FMX left a comment

Choose a reason for hiding this comment

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

LGTM.

@pan3793 pan3793 closed this in a318eb4 Jan 2, 2025
@pan3793
Copy link
Member Author

pan3793 commented Jan 2, 2025

Thanks, merged to main(0.6)

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