Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add documentation for native memory tracking (NMT) #9788

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

roberttoyonaga
Copy link
Collaborator

Summary

Adding some documentation for NMT. This should be added to GraalVM for JDK 23. Thanks!

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Sep 30, 2024
@roberttoyonaga
Copy link
Collaborator Author

Hi @olyagpl ! Can you please have a look at this when you have time? Thanks!

@fniephaus fniephaus changed the title Add documenation for native memory tracking (NMT) Add documentation for native memory tracking (NMT) Oct 1, 2024
@fniephaus fniephaus requested a review from olyagpl October 1, 2024 16:00
toc_group: debugging-and-diagnostics
link_title: Native Memory Tracking
permalink: /reference-manual/native-image/debugging-and-diagnostics/NMT/
redirect_from: /reference-manual/native-image/NMT/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redirect is not needed, that's a new page. Please remove redirect_from: /reference-manual/native-image/NMT/


# Native Memory Tracking (NMT) with Native Image

Native Memory Tracking (NMT) is a serviceability feature that records off-heap memory usage of your application. The terminology “off-heap memory” is sometimes used interchangeably with “native memory” or “unmanaged memory.” This essentially means any memory that is not managed by the garbage collector.
Copy link
Member

@olyagpl olyagpl Oct 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please start each sentence in a paragraph from a new line (we are still trying to polish this everywhere).

docs/reference-manual/native-image/NMT.md Outdated Show resolved Hide resolved
docs/reference-manual/native-image/NMT.md Outdated Show resolved Hide resolved
docs/reference-manual/native-image/NMT.md Outdated Show resolved Hide resolved
## JFR Events for NMT
The OpenJDK JFR events `jdk.NativeMemoryUsage` and `jdk.NativeMemoryUsageTotal` are supported in Native Image.

There are also two Native Image specific JFR events that you can access: `jdk.NativeMemoryUsagePeak` and `jdk.NativeMemoryUsageTotalPeak`. These Native Image specific events have been created to expose peak usage data otherwise not exposed through the JFR events ported over from the OpenJDK. It should be noted that these new are marked as experimental. You may need to enable experimental events in software like JDK Mission control in order to view them.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are also two Native Image specific JFR events that you can access: jdk.NativeMemoryUsagePeak and jdk.NativeMemoryUsageTotalPeak. These Native Image specific events have been created to expose peak usage data otherwise not exposed through the JFR events ported over from the OpenJDK. These new are marked as experimental. You may need to enable experimental events in software like JDK Mission control in order to view them.


There are also two Native Image specific JFR events that you can access: `jdk.NativeMemoryUsagePeak` and `jdk.NativeMemoryUsageTotalPeak`. These Native Image specific events have been created to expose peak usage data otherwise not exposed through the JFR events ported over from the OpenJDK. It should be noted that these new are marked as experimental. You may need to enable experimental events in software like JDK Mission control in order to view them.

Below is example of what the new events look like viewed using the `jfr` command line tool:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See below the example of what the new events look like when viewed using the jfr command line tool:

docs/reference-manual/native-image/NMT.md Outdated Show resolved Hide resolved
eventThread = "JFR Shutdown Hook" (javaThreadId = 63)
}
```
To use these JFR events for NMT, JFR must be included as a feature at build time and started at runtime.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To use these JFR events for NMT, JFR must be included as a feature at build time and started at runtime. (Learn more in JDK Flight Recorder (JFR) with Native Image).

docs/reference-manual/native-image/NMT.md Show resolved Hide resolved
@olyagpl
Copy link
Member

olyagpl commented Oct 1, 2024

@roberttoyonaga, I left some suggestions. Thank you for your contribution! In the description, you mention it should be added/backported to the GraalVM for JDK 23 docs, is that correct?

roberttoyonaga and others added 8 commits October 1, 2024 12:26
Co-authored-by: Olga Gupalo <olga.gupalo@oracle.com>
Co-authored-by: Olga Gupalo <olga.gupalo@oracle.com>
Co-authored-by: Olga Gupalo <olga.gupalo@oracle.com>
Co-authored-by: Olga Gupalo <olga.gupalo@oracle.com>
Co-authored-by: Olga Gupalo <olga.gupalo@oracle.com>
Co-authored-by: Olga Gupalo <olga.gupalo@oracle.com>
Co-authored-by: Olga Gupalo <olga.gupalo@oracle.com>
@roberttoyonaga
Copy link
Collaborator Author

Thank you for the review @olyagpl ! I've applied your suggestions and updated the doc

@roberttoyonaga
Copy link
Collaborator Author

@roberttoyonaga, I left some suggestions. Thank you for your contribution! In the description, you mention it should be added/backported to the GraalVM for JDK 23 docs, is that correct?

Yes, that's right. NMT is also supported in GraalVM for JDK 23 so these docs should be backported to that version too. No content needs to be changed for the backport though.

Copy link
Member

@olyagpl olyagpl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor leftovers I missed. Other than that, I'm going to "post-process" this pull request from my end (open an internal PR, add a new page to the website navigation) and get back to you.

docs/reference-manual/native-image/NMT.md Outdated Show resolved Hide resolved
docs/reference-manual/native-image/NMT.md Outdated Show resolved Hide resolved
docs/reference-manual/native-image/NMT.md Outdated Show resolved Hide resolved
roberttoyonaga and others added 3 commits October 1, 2024 14:45
Co-authored-by: Olga Gupalo <olga.gupalo@oracle.com>
Co-authored-by: Olga Gupalo <olga.gupalo@oracle.com>
Co-authored-by: Olga Gupalo <olga.gupalo@oracle.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
native-image OCA Verified All contributors have signed the Oracle Contributor Agreement. redhat-interest
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants