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()`:
```java
/**
* Compute an estimate of the maximum amount of direct memory available
to this JVM.
* <p>
* The computation is not cached, so you probably want to use {@link
#maxDirectMemory()} instead.
* <p>
* This will produce debug log output when called.
*
* @return The estimated max direct memory, in bytes.
*/
public static long estimateMaxDirectMemory()
```
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]