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

Profiling for JVM

Kengo TODA
October 16, 2012

Profiling for JVM

Simple introduction about how to judge the reason why your Java program is slow

Kengo TODA

October 16, 2012
Tweet

More Decks by Kengo TODA

Other Decks in Technology

Transcript

  1. Process to detect the cause of performance problem Make hypothesis

    from experience and knowledge Get Servlet’s log from middle ware like Jetty Read source code, do debugging, do profiling 3
  2. What is “profiling”? where? why? GC storm algorithm CPU Other

    reading code heap dump I/O Lock? Waiting other system? I/O GC Other thread dump IZQPUIFTJT WFSJpDBUJPO 4
  3. Judging the reason why JVM uses CPU heavily $ jstat

    -gcutil [PID] 250 7 S0 S1 E O P YGC YGCT FGC FGCT GCT 12.44 0.00 27.20 9.49 96.70 78 0.176 5 0.495 0.672 12.44 0.00 62.16 9.49 96.70 78 0.176 5 0.495 0.672 12.44 0.00 83.97 9.49 96.70 78 0.176 5 0.495 0.672 0.00 7.74 0.00 9.51 96.70 79 0.177 5 0.495 0.673 0.00 7.74 23.37 9.51 96.70 79 0.177 5 0.495 0.673 0.00 7.74 43.82 9.51 96.70 79 0.177 5 0.495 0.673 0.00 7.74 58.11 9.51 96.71 79 0.177 5 0.495 0.673 GC was fired Young generation GC was fired 7
  4. How to read method name Foo.x() means “method x of

    Foo class” Foo$Bar.x() means “method x of Bar class, and Bar is inner class of Foo” Foo.<init> means “constructor of Foo class” Foo.<clinit> means “static initializer of Foo class” 9
  5. Key points Hypothesis needs verification Know “normal” performance to detect

    “abnormal” one Imagine globally, verify locally (narrow down step by step) 13
  6. Reference JDK tools and utilities Browsing heap dump VisualVM Diagnosis

    documentation @ developerWorks My gist about JVM profiling, blog article and another article 14