Debugger

  • When a breakpoint is hit, the debugger automatically suspends all threads of the process.

Reactive Tools

  • info about performance issues that have happened
  • example:
    • thread dump analyzer
    • jcmd
    • jstack
    • JFR

Proactive tools

  • info about problems about to start or already in progress
  • realtime monitoring of latency+throughput
  • alerting capability
  • example:
    • Pinpoint (used for tracing)
    • Datadog
    • Prometheus
    • New Relic
    • Java Mission Control (JMC)
    • jvisualvm

Java Mission Control

  • GUI tool (to be downloaded separately after JDK 11)
  • Click MBean Server > Threads to see live threads

Java Flight Recording

  • Very lightweight and very detailed analysis
  • Can be done via Java Mission Control
  • Click Flight Recorder and start the recording
  • To save the recording right click and dump the data

Java Microbenchmark Harness (JMH)

  • provided in JDK 12 or above
  • Helps perform microbenchmarking (specific parts of the program)
  • library to help benchmark performance and throughput (recording time/speed/number of operations/etc.) different parts of the program
  • Annotations can be used at class as well as method level

Memory leaks

  • objects are unintentionally retained in memory and not released for garbage collection
  • symptoms:
    • increase memory usage over time
    • out of memory errors
    • unresponsive and crashing
    • growing heap size
  • diagnosis:
    • analyze heap dumps
    • use memory profilers
    • monitor memory usage
  • take a memory snapshot
  • tools for heap dump:
    • jmap
    • jcmd
  • tools for memory profiling:
    • visualvm
    • your kit
    • eclipse MAT

CPU profiling

  • CPU usage
  • Method hotspots
  • Thread CPU usage
  • Method Call tree