This is an automated email from the ASF dual-hosted git repository.
chenhang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git
The following commit(s) were added to refs/heads/master by this push:
new 01c8824157 update ALLOCATOR_POOLING_CONCURRENCY default value (#3001)
01c8824157 is described below
commit 01c882415714ecfcf11aaf77c86ae550bef6feb6
Author: ssj <[email protected]>
AuthorDate: Wed Jul 27 23:57:48 2022 +0800
update ALLOCATOR_POOLING_CONCURRENCY default value (#3001)
Set a more reasonable default value to avoid OutOfDirectMemoryError.
Descriptions of the changes in this PR:
### Motivation
The default value of allocatorPoolingConcurrency is 2 *
Runtime.getRuntime().availableProcessors(). It's used to specify the num of
Arena in PooledByteBufAllocator.
Assume:
40 processors
80 arena (processors*2)
2 chunk per arena
16MiB per chunk
JVM's total direct mem should be larger then 80*2*16=2560MiB, otherwise
OutOfDirectMemoryError occured.
OutOfDirectMemoryError much more likely to occur in Docker, cause JDK
versions earlier than Java SE 8U131 does not support Docker CPU limits.
### Changes
Use Netty default arena num
`PooledByteBufAllocator.defaultNumDirectArena()` as default
allocatorPoolingConcurrency.
---
.../main/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 ade6308131..0b8fce91ca 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 java.util.Map;
import javax.net.ssl.SSLEngine;
+import io.netty.buffer.PooledByteBufAllocator;
import lombok.extern.slf4j.Slf4j;
import org.apache.bookkeeper.common.allocator.LeakDetectionPolicy;
@@ -1085,7 +1086,7 @@ public abstract class AbstractConfiguration<T extends
AbstractConfiguration>
* @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());
}
/**