eclipse-openj9 / openj9

Eclipse OpenJ9: A Java Virtual Machine for OpenJDK that's optimized for small footprint, fast start-up, and high throughput. Builds on Eclipse OMR (https://github.com/eclipse/omr) and combines with the Extensions for OpenJDK for OpenJ9 repo.
Other
3.28k stars 721 forks source link

Implement jcmd #5164

Open pdbain-ibm opened 5 years ago

pdbain-ibm commented 5 years ago

This is part of https://github.com/eclipse/openj9/issues/4655.

jcmd

Other options:

Specific commands:

pdbain-ibm commented 5 years ago

Example to iterate through head for class_histogram: https://github.com/eclipse/openj9/blob/7a369a8ffe67207767a698266c679f0f2b3da9cb/runtime/jvmti/jvmtiHeap.c#L1278

pdbain-ibm commented 5 years ago

To do:

SueChaplain commented 5 years ago

Is there a milestone target for this one please?

pdbain-ibm commented 5 years ago

@pshipton or @DanHeidinga I can put this together fairly rapidly now that jmap is done, though I should finish the jstack refactoring first.

DanHeidinga commented 5 years ago

+1 to finishing jstack first

DanHeidinga commented 5 years ago

@SueChaplain Given the branch for the 0.15 release is June 24, I don't think this will make it. I'll tentatively tag it against the 0.16.0 release.

avermeer commented 5 years ago

Hello,

I don't know if there's a way for vote for an issue, but any here my +1 on this one: people used to jcmdare quite upset not to find it in OpenJ9...

Kind regards, Alexandre

DanHeidinga commented 5 years ago

@avermeer thanks for the feedback. jcmd is definitely on the list. Our plan, as written in https://github.com/eclipse/openj9/issues/4655, is to do jps (done), jstack (done), and then jmap & jstat.

Once those two are complete we'll implement jcmd as its basically a different front end to the same functionality

pshipton commented 5 years ago

jmap is also available now (in nightly builds and the next release), at least the -histo part.

@DanHeidinga jcmd provides a useful feature not available elsewhere, the ability to create dumps on the fly. We should consider adding this next. Unless the -Xdump option has been pre-configured to create the dumps you need (how are you supposed to know which dumps you need in advance?), there is no easy way to create a heapdump, snapdump, systemdump on the fly (except by writing an agent and late attaching it).

See also https://github.com/eclipse/openj9-docs/issues/309

DanHeidinga commented 5 years ago

I don't have a problem with doing jcmd first. The backend for jstat will need to be written as part of which ever command we do first

avermeer commented 5 years ago

@pshipton I completed agree with you, we quite miss an equivalent to GC.heap_dump as people usually resort to this kind of tool when something's going wrong and thus may not have pre-existing -Xdump options.

DanHeidinga commented 5 years ago

I've updated #4655 to indicate jcmd should be next

pdbain-ibm commented 5 years ago

We plan to do this in several steps:

  1. create jcmd which adds the basic capabilities of the tool such as help and listing VMs, plus supporting the capabilities of jstack and jmap (which were designed to be jcmd-compatible). Omit certain features of jcmd, such as handling vmid=0, selecting VMs by main class, or reading commands from a file
  2. Add high-priority new features, especially various dumps
  3. Add missing jcmd features note in 1): issue https://github.com/eclipse/openj9/issues/6521
  4. Add other lower-priority features.

I have phase 1 working and plan to send it for review today: https://github.com/eclipse/openj9/pull/6513

pdbain-ibm commented 5 years ago

@SueChaplain documentation issue is https://github.com/eclipse/openj9-docs/issues/333.

pdbain-ibm commented 5 years ago

FYI @pdbain

pdbain-ibm commented 5 years ago

Pull request for jcmd Dump.[heap, java, snap, system] opened: https://github.com/eclipse/openj9/pull/6702. FYI @avermeer .

avermeer commented 5 years ago

@pdbain-ibm thank you very much for this notification, couple of people in my organization got in touch with me asking for this, so it's good to see progress here.

When do you think OpenJ9 nightly build at https://adoptopenjdk.net/ could include this pull request?

Kind regards, Alexandre Vermeerbergen

pdbain-ibm commented 5 years ago

When do you think OpenJ9 nightly build at https://adoptopenjdk.net/ could include this pull request?

That depends on how long it takes to have it reviewed. @keithc-ca could you take a look?

If you want a build sooner, I can brew one up for you on MacOS or Linux X86 and deliver it privately.

keithc-ca commented 5 years ago

Our jenkins is migrating to new infrastructure and not all the kinks have been worked out yet. Until then, PR builds are not available and very little is likely to be merged.

pdbain commented 5 years ago

Our jenkins is migrating to new infrastructure and not all the kinks have been worked out yet. Until then, PR builds are not available and very little is likely to be merged.

Thanks, Keith. FYI, I ran an all-platform extended functional tes build on the internal Jenkins farm. I look forward to your review comments.

pdbain-ibm commented 5 years ago

@avermeer the dump commands have been added and should be available in the nightly builds shortly. Note that the availability of the various jcmd commands depends on the version of the target JVM, not of jcmd, so if the application is running an older JVM it may not support the Dump commands.

FYI, as of next week my preferred Github user ID will be @pdbain .

avermeer commented 5 years ago

Hello @pdbain-ibm,

Thank you very much for this update.I'll check the upcoming nightly builds. Regarding the "age of the JVM", are you referring to the age of OpenJ9 build, or say Java 8 vs Java 11 ?

Kind regards, Alexandre Vermeerbergen

pdbain-ibm commented 5 years ago

I refer to the vintage of the OpenJ9 source. The tool will work equally on any Java specification level.