Technoboy- commented on code in PR #24868:
URL: https://github.com/apache/pulsar/pull/24868#discussion_r2450252102


##########
pulsar-metadata/src/main/java/org/apache/pulsar/metadata/impl/AbstractMetadataStore.java:
##########
@@ -152,6 +180,20 @@ public CompletableFuture<Boolean> asyncReload(String key, 
Boolean oldValue,
         this.metadataStoreStats = new MetadataStoreStats(metadataStoreName, 
openTelemetry);
     }
 
+    /**
+     * Return the maximum size of the children cache in bytes.
+     * @return maximum size of the children cache in bytes.
+     */
+    protected long getChildrenCacheMaxSizeBytes() {
+        long heapMaxSizeBytes = Runtime.getRuntime().maxMemory();
+        // default 20% of max heap size, this should be sufficient to prevent 
OOME in the use case
+        // when a lot of namespaces with lots of topics are listed in the 
metadata store.
+        long defaultSizeBytes = heapMaxSizeBytes / 5;
+        // min size 20MB
+        int minSizeBytes = 1024 * 1024 * 20;

Review Comment:
   It would be better if it were configurable



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