Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Diving into JVM for profiling

Diving into JVM for profiling

To profile JVM, you need to know Java Heap, JMX and Class loader. This slide introduces them for you.

Need an introduction for GC? Please see another slide.
https://speakerdeck.com/eller86/garbage-collection-of-oracle-jdk6

Kengo TODA

May 18, 2012
Tweet

More Decks by Kengo TODA

Other Decks in Technology

Transcript

  1. Java Heap Mainly JVM uses Java Heap to store instances

    You can use `-Xmx` and `-Xms` to specify the size of Java Heap Mark & Sweep is famous algorithm, but JVM can use another ones 12೥4݄18೔ਫ༵೔
  2. JMX JMX provides probe for JVM JDK contains tools to

    use JMX jconsole VisualVM We can create original reporters 12೥4݄18೔ਫ༵೔
  3. Class loader Class loader has a parent CL may have

    some child CL loads class if its parent doesn’t have it (default behavior) 12೥4݄18೔ਫ༵೔
  4. How JVM calls CL public void main() { // To

    call static method, CL // gets class from Bootstrap CL Integer i = Integer.valueOf(0); // Bootstrap CL doesn’t have our // original class, so CL will // load it from .class OriginalClass.hello(i); } 12೥4݄18೔ਫ༵೔
  5. Singletons in 1 JVM I loaded Singleton class and it

    has static field Really? My singleton class also has static field! 12೥4݄18೔ਫ༵೔
  6. Summary You have to know GC and Java Heap to

    understand Java performance JMX is the easiest way to know issue Sometimes Class Loader creates complex bug 12೥4݄18೔ਫ༵೔
  7. References Java virtual machine - Wikipedia From Java code to

    Java heap Java classes and class loading Visual VM 12೥4݄18೔ਫ༵೔