Skip to content

8356968: JFR: Compilation event should be enabled for all compilations by default #25247

New issue

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

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

Already on GitHub? # to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

shipilev
Copy link
Member

@shipilev shipilev commented May 15, 2025

In the field, we are using -XX:+PrintCompilation to track compiler performance. Alternatively, -Xlog:jit* prints the same. JFR has a the related jdk.Compilation event that gives us even richer diagnostics. Yet, that event is set at a very high threshold (1000ms), which skips almost all compilations! This threshold is set to such a high value from the beginning.

It is fairly normal to have lots of compilations in 100+ ms range individually, and their sum impact is what we are after. Also, the compilations are normally quite rare, and there are a couple of thousands of compiles in most workloads, and they only happen sporadically. This means, the event count without any threshold is not high.

Therefore, it would be convenient to make sure that basic Compilation event is enabled unconditionally, e.g. by dropping the default threshold to 0.

See more logs in the bug itself.

Additional testing:

  • Ad-hoc tests with printing compilation events
  • Linux x86_64 server fastdebug, jdk_jfr

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-8356968: JFR: Compilation event should be enabled for all compilations by default (Enhancement - P4)

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 25247

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented May 15, 2025

👋 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 May 15, 2025

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk openjdk bot added the rfr Pull request is ready for review label May 15, 2025
@openjdk
Copy link

openjdk bot commented May 15, 2025

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

  • hotspot-jfr

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-jfr hotspot-jfr-dev@openjdk.org label May 15, 2025
@mlbridge
Copy link

mlbridge bot commented May 15, 2025

Webrevs

@egahlin
Copy link
Member

egahlin commented May 15, 2025

The overhead of the event is low, I believe, but I think the concern was that too many events were generated with little value to the end user. The buffers will be filled, and other, more important events will be pushed out. That said, there are probably other JVM events, i.e., low-level GC or runtime events, that are on by default, which may be less interesting than the compilation event.

jfr summary lists the number of events and how much space they take up.

Maybe we should reprioritize them?

@shipilev
Copy link
Member Author

shipilev commented May 15, 2025

The overhead of the event is low, I believe, but I think the concern was that too many events were generated with little value to the end user.

I can see that. But the neat part about compilation events is that we are supposed to have a limited number of them. As system goes into steady state, compilations are supposed to become very rare. And if they are not, that is actually a signal something is really off, and we do want to know :)

jfr summary lists the number of events and how much space they take up.

I think current overheads are fair.

For example, on javac HelloWorld workload, jdk.Compilation is about 1K events, about 25K in total (~ 25 bytes/event), on-par with system process, flags, settings events. Takes ~7% of the dump on javac Hello World, and that is likely a high estimate, as longer apps would likely start dumping much more non-compilation events. Sounds to me doing a ThreadDump 3 times already takes more space than the sum total of compilation events.

 $ ls -lah comp.jfr
-rw-rw-r-- 1 shade shade 365K May 14 14:00 comp.jfr

$ jfr summary comp.jfr | sort -k 3 -n -r | head -n 10
 jdk.CheckPoint                             14        134299
 jdk.Metadata                                1        107126
 jdk.SystemProcess                         546         32949
 jdk.Compilation                           946         23678
 jdk.ThreadDump                              2         18679
 jdk.BooleanFlag                           492         14607
 jdk.ActiveSetting                         356          8846
 jdk.ModuleExport                          504          5414
 jdk.LongFlag                              136          4237
 jdk.InitialEnvironmentVariable             73          3077
...

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
hotspot-jfr hotspot-jfr-dev@openjdk.org rfr Pull request is ready for review
Development

Successfully merging this pull request may close these issues.

2 participants