Skip to content

8307374: Add a JFR event for tracking RSS #14285

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

Closed
wants to merge 6 commits into from

Conversation

stefank
Copy link
Member

@stefank stefank commented Jun 2, 2023

Add A JFR event to track the resident set size (RSS) of the running process. This is a good complement to the new Native Memory Tracking events that were added for JDK 20 (JDK-8157023)

You can use the JDK Mission Control tool to extract this data. Or, you can use the new JFR Views tool to get a textual representation of the values:

# Create a JFR recording
$ jdk/bin/java -XX:StartFlightRecording=dumponexit=true JavaApp

# Extract the data from that recording
$ jdk/bin/jfr view ResidentSetSize hotspot-pid-204767-id-1-2023_06_02_11_56_19.jfr 

                               Resident Set Size

Time                     Resident Set Size         Resident Set Size Peak Value
---------------- ------------------------- ------------------------------------
11:56:07                            1.1 GB                               1.2 GB
11:56:08                          333.7 MB                               1.2 GB
11:56:09                          432.4 MB                               1.2 GB
11:56:10                          695.9 MB                               1.2 GB
11:56:11                            1.0 GB                               1.2 GB
11:56:12                            1.3 GB                               1.3 GB
11:56:13                            1.3 GB                               1.3 GB
11:56:14                            1.3 GB                               1.3 GB
11:56:15                            1.3 GB                               1.3 GB
11:56:16                            1.3 GB                               1.3 GB
11:56:17                            1.4 GB                               1.4 GB
11:56:18                            1.8 GB                               1.8 GB
11:56:19                            2.0 GB                               2.0 GB

The event has been implemented for Linux, MacOS, and Windows. The name ResidentSetSize isn't a perfect fit for the values extracted from MacOS and Windows, but I think it is better to name this after something that many people are familiar with instead of trying to find a generic name that fits all platforms. Do you agree with that, or should we change it to something else?

I've manually sanity checked that we get reasonable values on all OS:es. I've also added a jtreg test.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8307374: Add a JFR event for tracking RSS (Enhancement - "3")

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/14285/head:pull/14285
$ git checkout pull/14285

Update a local copy of the PR:
$ git checkout pull/14285
$ git pull https://git.openjdk.org/jdk.git pull/14285/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 14285

View PR using the GUI difftool:
$ git pr show -t 14285

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/14285.diff

Webrev

Link to Webrev Comment

@stefank
Copy link
Member Author

stefank commented Jun 2, 2023

/label add hotspot
/label add jfr

@bridgekeeper
Copy link

bridgekeeper bot commented Jun 2, 2023

👋 Welcome back stefank! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added rfr Pull request is ready for review hotspot hotspot-dev@openjdk.org labels Jun 2, 2023
@openjdk
Copy link

openjdk bot commented Jun 2, 2023

@stefank
The hotspot label was successfully added.

@openjdk
Copy link

openjdk bot commented Jun 2, 2023

@stefank
The label jfr is not a valid label.
These labels are valid:

  • graal
  • serviceability
  • hotspot
  • hotspot-compiler
  • ide-support
  • kulla
  • i18n
  • shenandoah
  • jdk
  • javadoc
  • security
  • hotspot-runtime
  • jmx
  • build
  • nio
  • client
  • core-libs
  • compiler
  • net
  • hotspot-gc
  • hotspot-jfr

@stefank
Copy link
Member Author

stefank commented Jun 2, 2023

/label add hotspot-jfr

@openjdk openjdk bot added the hotspot-jfr hotspot-jfr-dev@openjdk.org label Jun 2, 2023
@openjdk
Copy link

openjdk bot commented Jun 2, 2023

@stefank
The hotspot-jfr label was successfully added.

@mlbridge
Copy link

mlbridge bot commented Jun 2, 2023

Webrevs

@robcasloz
Copy link
Contributor

Thanks for proposing this enhancement, Stefan! I tried it out (on Linux) and it worked just fine.

The event has been implemented for Linux, MacOS, and Windows. The name ResidentSetSize isn't a perfect fit for the values extracted from MacOS and Windows, but I think it is better to name this after something that many people are familiar with instead of trying to find a generic name that fits all platforms. Do you agree with that, or should we change it to something else?

I agree with naming it ResidentSetSize, even some popular operating system textbooks such as "the dinosaur book" use this term as a general concept.

@egahlin
Copy link
Member

egahlin commented Jun 2, 2023

Thanks for proposing this enhancement, Stefan! I tried it out (on Linux) and it worked just fine.

The event has been implemented for Linux, MacOS, and Windows. The name ResidentSetSize isn't a perfect fit for the values extracted from MacOS and Windows, but I think it is better to name this after something that many people are familiar with instead of trying to find a generic name that fits all platforms. Do you agree with that, or should we change it to something else?

I agree. What's important is that end-users understand the concept. If there are differences between OS:es (worth mentioning) they can be stated in the description of the event, i.e. "On MacOs X is included, but not Y"

@tstuefe
Copy link
Member

tstuefe commented Jun 3, 2023

Useful, but the user still needs to know how to interpret that number. Interpreting RSS is not straightforward. Therefore I like the name "ResidentSetSize", any other name would just add obfuscation.

Copy link
Member

@tstuefe tstuefe left a comment

Choose a reason for hiding this comment

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

Good. Want to add vsize while you are at it :) ?

@openjdk
Copy link

openjdk bot commented Jun 3, 2023

@stefank This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8307374: Add a JFR event for tracking RSS

Reviewed-by: stuefe, rcastanedalo

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 88 new commits pushed to the master branch:

  • a25b7b8: 8295976: GetThreadListStackTraces returns wrong state for blocked VirtualThread
  • fadcd65: 8309527: Improve test proxy performance
  • 0ed4af7: 8309472: IGV: Add dump_igv(custom_name) for improved debugging
  • f1c7afc: 8306647: Implementation of Structured Concurrency (Preview)
  • a08c5cb: 8307953: [AIX] C locale's font setting was changed by JEP 400
  • 0ceb432: 8309570: ProblemList sun/security/pkcs11/Signature/TestRSAKeyLength.java
  • 65bdbc7: 8309396: com/sun/jdi/JdbMethodExitTest.java fails with virtual threads due to a bug in determining the main thread id
  • 4a75fd4: 8301553: Support Password-Based Cryptography in SunPKCS11
  • 0a4f9ad: 8292157: Incorrect error: "block element not allowed within inline element "
  • 16ab7bf: 8309505: com/sun/jdi/MethodEntryExitEvents.java due to finding wrong main thread
  • ... and 78 more: https://git.openjdk.org/jdk/compare/4460429d7a50b9a7a99058ef4e5ae36fb30b956f...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jun 3, 2023
Copy link
Contributor

@robcasloz robcasloz left a comment

Choose a reason for hiding this comment

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

Thanks again for this contribution, the Linux and OS-independent parts look good!

@stefank
Copy link
Member Author

stefank commented Jun 5, 2023

Good. Want to add vsize while you are at it :) ?

Thanks!

:) I have a few other things that I need to do before RDP1. I can review a patch if someone publishes a PR ...

@stefank
Copy link
Member Author

stefank commented Jun 7, 2023

Thanks for the reviews!
/integrate

@openjdk
Copy link

openjdk bot commented Jun 7, 2023

Going to push as commit 5722903.
Since your change was applied there have been 94 commits pushed to the master branch:

  • 1de40f3: 8302145: ddepth should be uint in PhaseIdealLoop::register_node()
  • a6726b6: 8309568: javac crashes attempting to -Xprint on a class file of an unnamed class
  • 8cdd95e: 8305959: x86: Improve itable_stub
  • 9233dcc: 8309297: Adjust ShenandoahHeap print_heap_regions_on
  • 749d480: 8305763: Parsing a URI with an underscore goes through a silent exception, negatively impacting performance
  • 3ccb3c0: 8305906: HttpClient may use incorrect key when finding pooled HTTP/2 connection for IPv6 address
  • a25b7b8: 8295976: GetThreadListStackTraces returns wrong state for blocked VirtualThread
  • fadcd65: 8309527: Improve test proxy performance
  • 0ed4af7: 8309472: IGV: Add dump_igv(custom_name) for improved debugging
  • f1c7afc: 8306647: Implementation of Structured Concurrency (Preview)
  • ... and 84 more: https://git.openjdk.org/jdk/compare/4460429d7a50b9a7a99058ef4e5ae36fb30b956f...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Jun 7, 2023
@openjdk openjdk bot closed this Jun 7, 2023
@openjdk openjdk bot removed the ready Pull request is ready to be integrated label Jun 7, 2023
@openjdk openjdk bot removed the rfr Pull request is ready for review label Jun 7, 2023
@openjdk
Copy link

openjdk bot commented Jun 7, 2023

@stefank Pushed as commit 5722903.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot hotspot-dev@openjdk.org hotspot-jfr hotspot-jfr-dev@openjdk.org integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

4 participants