From 8c281443aea2f68dd0659f42f208a7ae254648e6 Mon Sep 17 00:00:00 2001 From: sunshujie1990 Date: Wed, 19 Jan 2022 17:05:16 +0800 Subject: [PATCH] update ALLOCATOR_POOLING_CONCURRENCY default value Set a more reasonable default value to avoid OutOfDirectMemoryError. --- .../java/org/apache/bookkeeper/conf/AbstractConfiguration.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/conf/AbstractConfiguration.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/conf/AbstractConfiguration.java index f4b378bae3b..7f73b81f65d 100644 --- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/conf/AbstractConfiguration.java +++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/conf/AbstractConfiguration.java @@ -27,6 +27,7 @@ import javax.net.ssl.SSLEngine; +import io.netty.buffer.PooledByteBufAllocator; import lombok.extern.slf4j.Slf4j; import org.apache.bookkeeper.common.allocator.LeakDetectionPolicy; @@ -1060,7 +1061,7 @@ public T setAllocatorPoolingPolicy(PoolingPolicy poolingPolicy) { * @return the configured pooling concurrency for the allocator. */ public int getAllocatorPoolingConcurrency() { - return this.getInteger(ALLOCATOR_POOLING_CONCURRENCY, 2 * Runtime.getRuntime().availableProcessors()); + return this.getInteger(ALLOCATOR_POOLING_CONCURRENCY, PooledByteBufAllocator.defaultNumDirectArena()); } /**