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

8320924: Improve heap dump performance by optimizing archived object checks #16863

Closed

Conversation

shipilev
Copy link
Member

@shipilev shipilev commented Nov 28, 2023

Profiling heap dumping code reveals another simple issue: mask_dormant_archived_object on dumping hotpath takes quite a bit of time. We can reflow it for better inlineability, throwing out the non-essential parts into cold method. There is also no reason to peek into java mirror with (default) keep-alive, if we only use the result for null-check.

Example improvements on Mac M1:

% for I in `seq 1 5`; do build/macosx-aarch64-server-release/images/jdk/bin/java -XX:+UseParallelGC -XX:+HeapDumpAfterFullGC -Xms8g -Xmx8g HeapDump.java 2>&1 | grep created; rm *.hprof; done                                                                     

# Before
Heap dump file created [1897307608 bytes in 1.584 secs]
Heap dump file created [1897308278 bytes in 1.439 secs]
Heap dump file created [1897308508 bytes in 1.460 secs]
Heap dump file created [1897308505 bytes in 1.423 secs]
Heap dump file created [1897308554 bytes in 1.414 secs]

# After
Heap dump file created [1897307648 bytes in 1.509 secs]
Heap dump file created [1897308498 bytes in 1.281 secs]
Heap dump file created [1897308554 bytes in 1.282 secs]
Heap dump file created [1897308512 bytes in 1.263 secs]
Heap dump file created [1897308554 bytes in 1.270 secs]

...which is about +12% faster heap dump.

I also eyeballed the generated code and saw mask_dormant_archived_object fully inlined at least on x86_64.


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-8320924: Improve heap dump performance by optimizing archived object checks (Enhancement - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 16863

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Nov 28, 2023

👋 Welcome back shade! 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
Copy link

openjdk bot commented Nov 28, 2023

@shipilev The following label will be automatically applied to this pull request:

  • hotspot

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the hotspot hotspot-dev@openjdk.org label Nov 28, 2023
@shipilev shipilev marked this pull request as ready for review November 28, 2023 20:38
@openjdk openjdk bot added the rfr Pull request is ready for review label Nov 28, 2023
@mlbridge
Copy link

mlbridge bot commented Nov 28, 2023

Webrevs

Copy link
Member

@y1yang0 y1yang0 left a comment

Choose a reason for hiding this comment

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

Looks reasonable

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.

Okay.

I feel "debug" log level is kind of high since we may encounter a lot of these; for such unbound micro-prints I usually use "trace". Up to you.

@openjdk
Copy link

openjdk bot commented Nov 29, 2023

@shipilev 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:

8320924: Improve heap dump performance by optimizing archived object checks

Reviewed-by: yyang, stuefe

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 36 new commits pushed to the master branch:

  • cdd1a6e: 8313816: Accessing jmethodID might lead to spurious crashes
  • b65ccff: 8320877: Shenandoah: Remove ShenandoahUnloadClassesFrequency support
  • b68356b: 8320806: Augment test/langtools/tools/javac/versions/Versions.java for JDK 22 language changes
  • d783aa3: 8320940: Fix typo in java.lang.Double
  • 43c7f6a: 8320907: Shenandoah: Remove ShenandoahSelfFixing flag
  • da7bcfc: 8319935: Ensure only one JvmtiThreadState is created for one JavaThread associated with attached native thread
  • a2c5f1f: 8319417: (dc) DatagramChannel.connect undocumented behavior
  • abf2e49: 8320859: gtest high malloc footprint caused by BufferNodeAllocator stress test
  • 033cced: 8320368: Per-CPU optimization of Klass range reservation
  • 48960df: 8316734: URLEncoder should specify that replacement bytes will be used in case of coding error
  • ... and 26 more: https://git.openjdk.org/jdk/compare/4bcda602668835c35e2ac6ff6702d15cd249bc2a...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 Nov 29, 2023
@shipilev
Copy link
Member Author

I feel "debug" log level is kind of high since we may encounter a lot of these; for such unbound micro-prints I usually use "trace". Up to you.

I agree "trace" would fit better here. Let's see if @iklam has an opinion.

@iklam
Copy link
Member

iklam commented Nov 29, 2023

I feel "debug" log level is kind of high since we may encounter a lot of these; for such unbound micro-prints I usually use "trace". Up to you.

I agree "trace" would fit better here. Let's see if @iklam has an opinion.

I think trace is good. BTW, I rarely use -Xlog:cds+heap as it usually too verbose :-)

@shipilev
Copy link
Member Author

I think trace is good. BTW, I rarely use -Xlog:cds+heap as it usually too verbose :-)

Hah! Okay, I switched to trace in new commit.

@shipilev
Copy link
Member Author

If there are no other comments, I would integrate this soon. Thanks!

@shipilev
Copy link
Member Author

shipilev commented Dec 4, 2023

/integrate

@openjdk
Copy link

openjdk bot commented Dec 4, 2023

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

  • 93b9235: 8321120: Shenandoah: Remove ShenandoahElasticTLAB flag
  • 9b8eaa2: 8319872: AArch64: [vectorapi] Implementation of unsigned (zero extended) casts
  • b9b8263: 8317307: test/jdk/com/sun/jndi/ldap/LdapPoolTimeoutTest.java fails with ConnectException: Connection timed out: no further information
  • 0d0a657: 5108458: JTable does not properly layout its content
  • 2b00ac0: 8308753: Class-File API transition to Preview
  • b9df827: 8309871: jdk/jfr/api/consumer/recordingstream/TestSetEndTime.java timed out
  • 9498469: 8318983: Fix comment typo in PKCS12Passwd.java
  • 4dcbd13: 8314905: jdk/jfr/tool/TestView.java fails with RuntimeException 'Invoked Concurrent' missing from stdout/stderr
  • 5dee2a3: 8320440: Implementation of Structured Concurrency (Second Preview)
  • 6f7bb79: 8320931: [REDO] dsymutil command leaves around temporary directories
  • ... and 87 more: https://git.openjdk.org/jdk/compare/4bcda602668835c35e2ac6ff6702d15cd249bc2a...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Dec 4, 2023

@shipilev Pushed as commit f32ab8c.

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

@shipilev shipilev deleted the JDK-8320924-heapdump-reflow-archive branch January 31, 2024 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot hotspot-dev@openjdk.org integrated Pull request has been integrated
4 participants