Re: RFR: 8238665: Add JFR event for direct memory statistics

董登辉(卓昂) denghui.ddh at alibaba-inc.com
Wed Feb 26 13:40:59 UTC 2020


PING: Could you review it?
Bug: https://bugs.openjdk.java.net/browse/JDK-8238665
Webrev: http://cr.openjdk.java.net/~ddong/8238665/webrev.01/


------------------------------------------------------------------
From:董登辉(卓昂) <denghui.ddh at alibaba-inc.com>
Send Time:2020年2月11日(星期二) 16:13
To:Erik Gahlin <erik.gahlin at oracle.com>
Cc:hotspot-jfr-dev <hotspot-jfr-dev at openjdk.java.net>
Subject:Re: RFR: 8238665: Add JFR event for direct memory statistics

Hi Erik,

Thanks for the review. See answers embedded.

New webrev: http://cr.openjdk.java.net/~ddong/8238665/webrev.01/

On Feb 11, 2020, at 1:52 AM, Erik Gahlin <erik.gahlin at oracle.com> wrote:
Hi Denghiu,

Can you explain when this event can be useful, i.e. when troubleshooting x etc.? This makes it easier to determine if the event should be on by default, if it is worth the increased startup cost that the instrumentation creates and what a reasonable period for the event should be.

Many Java middleware(e.g. Netty) and applications use direct memory for achieving higher performance,  if java process use too much direct memory, some exceptions will occur, such as oom-killer. Hence, it’s necessary to monitor it,  and we use JMX to monitor it in our production environment currently.

src/jdk.jfr/share/classes/jdk/jfr/events/DirectMemoryStatisticsEvent.java:

@Label("TotalCapacity") -> @Label("Total Capacity")
@Label("MemoryUsed") -> @Label("Memory Used”)

Updated

What is meant by 'limit'? Could we have a better field name and/or description that explains what this fields contains, because it is not obvious from that name. Fields that contains bytes, should have the DataAmount; annotation.

What is the value if -XX:MaxDirectMemorySize has not been set?

limit -> maxCapacity

 if -XX:MaxDirectMemorySize has not been set, the value of Runtime.getRuntime().maxMemory() will be used.
Can you make the event class final.

Updated

@StackTrace(false) should not be needed.

Removed

test/jdk/jdk/jfr/event/runtime/TestDirectMemoryStatisticsEvent.java:

Use try-with-resources on the Recording object.

Updated

Thanks
Denghui Dong

Thanks
Erik

On 2020-02-07 06:24, Denghui Dong wrote:
Hi,

Could I have a review of a change that adds JFR event for direct memory statistics

Bug: https://bugs.openjdk.java.net/browse/JDK-8238665
Webrev: http://cr.openjdk.java.net/~ddong/8238665/webrev.00/
Test: test/jdk/jdk/jfr/event/runtime/TestDirectMemoryStatisticsEvent.java

Thanks
Denghui Dong



More information about the hotspot-jfr-dev mailing list