turboFei commented on code in PR #3388:
URL: https://github.com/apache/celeborn/pull/3388#discussion_r2230386357
##########
common/src/main/java/org/apache/celeborn/common/network/util/NettyUtils.java:
##########
@@ -182,39 +176,42 @@ public static ByteBufAllocator getByteBufAllocator(
public static ByteBufAllocator getByteBufAllocator(
TransportConf conf, AbstractSource source, boolean allowCache, int
coreNum) {
+ ByteBufAllocator allocator;
if (conf.getCelebornConf().networkShareMemoryAllocator()) {
- return getSharedByteBufAllocator(
- conf.getCelebornConf(),
- source,
- allowCache &&
conf.getCelebornConf().networkMemoryAllocatorAllowCache());
- }
- int arenas;
- if (coreNum != 0) {
- arenas = coreNum;
+ allocator =
+ getSharedByteBufAllocator(
+ conf.getCelebornConf(),
+ allowCache &&
conf.getCelebornConf().networkMemoryAllocatorAllowCache());
} else {
- arenas = conf.getCelebornConf().networkAllocatorArenas();
- }
- ByteBufAllocator allocator =
- createByteBufAllocator(
- conf.getCelebornConf().networkMemoryAllocatorPooled(),
- conf.preferDirectBufs(),
- allowCache,
- arenas);
- if (conf.getCelebornConf().networkMemoryAllocatorPooled()) {
- pooledByteBufAllocators.add((PooledByteBufAllocator) allocator);
+ int arenas;
+ if (coreNum != 0) {
+ arenas = coreNum;
+ } else {
+ arenas = conf.getCelebornConf().networkAllocatorArenas();
+ }
+ allocator =
+ createByteBufAllocator(
+ conf.getCelebornConf().networkMemoryAllocatorPooled(),
+ conf.preferDirectBufs(),
+ allowCache,
+ arenas);
+ if (conf.getCelebornConf().networkMemoryAllocatorPooled()) {
+ pooledByteBufAllocators.add((PooledByteBufAllocator) allocator);
+ }
}
if (source != null) {
- String poolName = "default-netty-pool";
Map<String, String> labels = new HashMap<>();
- String moduleName = conf.getModuleName();
- if (!moduleName.isEmpty()) {
- poolName = moduleName;
- int index = allocatorsIndex.compute(moduleName, (k, v) -> v == null ?
0 : v + 1);
- labels.put("allocatorIndex", String.valueOf(index));
+ if (conf.getCelebornConf().networkMemoryAllocatorAllowCache()) {
+ String poolName =
+ allowCache ? "celeborn-netty-shared-cache-pool" :
"celeborn-netty-shared-pool";
+ labels.put(NETTY_POOL_LABEL, poolName);
+ } else {
+ int index = allocatorsIndex.compute(conf.getModuleName(), (k, v) -> v
== null ? 0 : v + 1);
+ labels.put(NETTY_ALLOCATOR_INDEX_LABEL, String.valueOf(index));
}
new NettyMemoryMetrics(
allocator,
- poolName,
+ conf.getModuleName(),
Review Comment:
always use the module name as netty metrics prefix @pan3793
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]