You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/04/21 03:39:36 UTC

[GitHub] [pulsar] michaeljmarshall commented on a diff in pull request #15238: use netty PlatformDependent.estimateMaxDirectMemory

michaeljmarshall commented on code in PR #15238:
URL: https://github.com/apache/pulsar/pull/15238#discussion_r854747766


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/stats/prometheus/PrometheusMetricsGenerator.java:
##########
@@ -70,7 +70,7 @@ public double get() {
         Gauge.build("jvm_memory_direct_bytes_max", "-").create().setChild(new Child() {
             @Override
             public double get() {
-                return io.netty.util.internal.PlatformDependent.maxDirectMemory();
+                return io.netty.util.internal.PlatformDependent.estimateMaxDirectMemory();

Review Comment:
   It looks like the javadoc for this method recommends using `#maxDirectMemory()`:
   
   https://github.com/netty/netty/blob/0d653f08cd108a3ba6cf76d9fc052b8141ea3196/common/src/main/java/io/netty/util/internal/PlatformDependent.java#L1154-L1163
   
   I am concerned that the cost of this alternative method. Are you able to provide documentation on how this method is better? Alternatively, is there a reason we can't cache the result in this class and the other references that will be called many times?



-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org