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

Added Java NMT, Debug & JMX Helpers #130

Merged
merged 2 commits into from
Sep 22, 2021
Merged

Added Java NMT, Debug & JMX Helpers #130

merged 2 commits into from
Sep 22, 2021

Conversation

pivotal-david-osullivan
Copy link
Contributor

@pivotal-david-osullivan pivotal-david-osullivan commented Sep 21, 2021

Summary

This PR adds support for Java Native Memory Tracking (NMT), JMX & Remote Debug features present in libjvm

A helper has been added for each feature:

NMT

Flags added:

"NMT_LEVEL_1=summary" - required to enable NMT successfully due to JDK bug
"-XX:+UnlockDiagnosticVMOptions"
"-XX:NativeMemoryTracking=summary" - (summary report of memory usage)
"-XX:+PrintNMTStatistics" - (prints memory usage data at VM exit)

Configuration:

  • These features will be enabled by default but come with a small amount of overhead - to disable Java NMT, users can set BPL_JAVA_NMT_ENABLED=false at runtime.
  • Users can also configure the NMT tracking level via the runtime variable BPL_JAVA_NMT_LEVEL which defaults to 'summary' and can be set to 'detail'

JMX

Flags added:

"-Djava.rmi.server.hostname=127.0.0.1"
"-Dcom.sun.management.jmxremote.authenticate=false"
"-Dcom.sun.management.jmxremote.ssl=false"

Configuration:

  • BPL_JMX_ENABLED=<true/false> - false by default
  • BPL_JMX_PORT=<port> - configure the port value

Debug

Flags added:

-agentlib:jdwp=transport=dt_socket,server=y,address=<*:port>,suspend=<true/false>

  • BPL_DEBUG_ENABLED=<true/false> - false by default.
  • BPL_DEBUG_PORT=<port> - 8000 by default.
  • BPL_DEBUG_SUSPEND=<true/false> - suspend execution, false by default.

Use Cases

Checklist

  • I have viewed, signed, and submitted the Contributor License Agreement.
  • I have linked issue(s) that this PR should close using keywords or the Github UI (See docs)
  • I have added an integration test, if necessary.
  • I have reviewed the styleguide for guidance on my code quality.
  • I'm happy with the commit history on this PR (I have rebased/squashed as needed).

Copy link
Contributor

@dmikusa dmikusa left a comment

Choose a reason for hiding this comment

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

One other note. Shouldn't there be a go.mod & go.sum change to pull in the latest libjvm?

@pivotal-david-osullivan pivotal-david-osullivan changed the title Added Java NMT Helper Added Java NMT, Debug & JMX Helpers Sep 22, 2021
@dmikusa dmikusa merged commit 61112f7 into main Sep 22, 2021
@dmikusa dmikusa deleted the java-nmt branch September 22, 2021 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver:minor A change requiring a minor version bump type:enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants