Java Profiling

What, How and Why?

Ufuk Uzun, December 2015

Profiling

  • Profiling is a form of dynamic program analysis that measures, for example
    • Memory
    • CPU
    • ...

Java Profilers

  • Profile Java applications and allow us to
    • Monitor application performance and memory consumption
    • Monitor application threads
    • Analyze memory allocation
    • Take and display thread dumps

How Java Profilers work?

  • The JVM tool interface (JVM TI) is a native programming interface for use by tools
  • It provides both a way
    • to inspect the state
    • to control the execution of applications running in the JVM
  • JVM TI was introduced at JDK 5.0 and replaced JVMPI and JVMDI
  • Java Management Extensions (JMX) is the common communications layer

Popular Java Profilers

Survey which collected responses from over 1500 developers, testers, architects

VisualVM

  • The standard Java profiler
  • JDK 8 contains Java VisualVM tool based on VisualVM 1.3.6
    • From command line:
      $ jvisualvm

  • Or download lastest version from http://visualvm.java.net/

VisualVM - Demo

Demonstration of using CPU Profiler & Call Trees to find slower methods than others

?

Made with Slides.com