Skip to content

Instantly share code, notes, and snippets.

@benve
Last active July 21, 2020 03:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save benve/f350e9478a510c77d37d to your computer and use it in GitHub Desktop.
Save benve/f350e9478a510c77d37d to your computer and use it in GitHub Desktop.
Link ed esempi su come monitorare e migliorare le performance della JVM

Link

Info generiche

Approfondimenti

J2EE

JVM Internal

Tools

Profiler

Dump Analyzer

Log4j

Presentazioni

<iframe src="http://www.slideshare.net/slideshow/embed_code/9924858?rel=0" width="342" height="291" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" style="border:1px solid #CCC;border-width:1px 1px 0;margin-bottom:5px" allowfullscreen webkitallowfullscreen mozallowfullscreen> </iframe>

Per verificare tutte le opzioni disponibili e come sono impostate:

java -XX:+UnlockDiagnosticVMOptions -XX:+PrintFlagsFinal -version

-XX:+TraceClassLoading and -XX:+TraceClassUnloading are two JVM options which we use to print logging information whenever classes loads into JVM or unloads from JVM. These JVM flags are extremely useful if you have any memory leak related to classloader and or suspecting that classes are not unloading or garbage collected.

-Djava.awt.headless=true

UseStringCache http://stackoverflow.com/questions/19026112/what-is-current-status-of-oracle-java-hotspot-vm-performance-options-usestring

Java Mission Control

VisualVM

VisualVM plugin MEMORY POOL VIEW to look at JVM memory pools.

JMap

Histo

jmap -histo $PID

Permette di stampare gli oggetti presenti nell'Heap Heap Histogram of Running Process

Si puo' profilare con ad esempio

while true; do jmap -histo $PID > `date +%s`.histo.log; date; sleep 60; done

L'output e' nel formato: Class.getName

Dump

jmap -J-d64 -dump:format=b,file=dump $PID

"An alternate method using standard tools in the Unix/Linux arsenal to achieve a heap dump that only requires mere seconds of additional downtime allowing the slow jmap process to happen once the application is back in service": http://blogs.atlassian.com/2013/03/so-you-want-your-jvms-heap/

HPROF - Heap Profiler

Agent

heroku-javaagent

Esempio di come creare un agent per monitorare uso memoria e altro

-Xprof

jinfo

Per ottenere proprieta' di sistema associate ad un processo della JVM

Tools generici

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment