horizonzy commented on code in PR #3432:
URL: https://github.com/apache/bookkeeper/pull/3432#discussion_r932933957


##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/conf/ServerConfiguration.java:
##########
@@ -3858,6 +3860,50 @@ public boolean isLocalConsistencyCheckOnStartup() {
         return this.getBoolean(LOCAL_CONSISTENCY_CHECK_ON_STARTUP, false);
     }
 
+    /**
+     * The configured pooling concurrency for the allocator, if user config 
it, we should consider the unpooled
+     * direct memory which readCache and writeCache occupy when use 
DbLedgerStorage.
+     */
+    public int getAllocatorPoolingConcurrency() {
+        Integer allocatorPoolingConcurrency = 
this.getInteger(ALLOCATOR_POOLING_CONCURRENCY, null);
+        if (allocatorPoolingConcurrency != null) {
+            return allocatorPoolingConcurrency;
+        }
+        String ledgerStorageClass = getLedgerStorageClass();
+        if (DbLedgerStorage.class.getName().equals(ledgerStorageClass)) {
+            long writeCacheMb;
+            Object writeCacheConf = 
this.getProperty(DbLedgerStorage.WRITE_CACHE_MAX_SIZE_MB);
+            if (writeCacheConf instanceof Number) {
+                writeCacheMb =  ((Number) writeCacheConf).longValue();
+            } else if (writeCacheConf == null) {
+                writeCacheMb =  
DbLedgerStorage.DEFAULT_WRITE_CACHE_MAX_SIZE_MB;
+            } else if 
(StringUtils.isEmpty(this.getString(DbLedgerStorage.WRITE_CACHE_MAX_SIZE_MB))) {
+                writeCacheMb =  
DbLedgerStorage.DEFAULT_WRITE_CACHE_MAX_SIZE_MB;
+            } else {
+                writeCacheMb =  
this.getLong(DbLedgerStorage.WRITE_CACHE_MAX_SIZE_MB);
+            }

Review Comment:
   Godd idea. 
   



-- 
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]

Reply via email to