2009/11/19

Devoxx 2009: Performance for the Performance-shy

19/11/2009, Holly Cummins, IBM

costs of bad performance
  • electricity
  • employee productivity
  • lost business (e.g. slow pages)
  • hard cash (e.g. trading)
tuning technique
  • find the bottleneck in the application
    • cpu → consistently high
    • I/O → cpu not consistently high
    • lock → cpu not consistently high
    • space ??? cpu can be low or high ...
  • what is the JVM doing? → tools … must have:
    • visual indicators
    • explanation
    • suggested solution (command line)
  • measure performance
    • risk to make it worse
    • get a baseline
    • system must be as similar as possible to production
    • how:
      • System.currentTimeMillis()
      • warm up your system
        • JIT
        • trigger caches
tools: IBM Perfomance Tools
  • for IBM jvm's
  • free
  • IBM Support Assistant: centralized repository for IBM tools
space-bound applications: heap
  • diagnose:
    • lower throughput
    • crash (out-of-memory exception)
    • trigger gc's → higher cpu
  • tools:
    • verbosegc: very low overhead → use on production
    • live memory monitoring → IBM Monitoring & Diagnostic tools for Java
      • GC and Memory Visualizer
        • for Websphere → also works on Solaris & HP-UX (i.e. sun jvm syntax)
        • heap details, including heap histogram
        • get dominator tree
        • search inefficiently used data structures & redundant data
        • recommendations
          • increase heap size
          • gc takes between 10% - 20% cpu → tune gc policy
      • Health Center
        • agent in JVM
        • client (IBM Support Assistant)
        • visualize gc
        • recommendations
        • check gc performance
    • Memory Analyzer (not from IBM → eclipse.org): diagnose footprint issues:
      • heapdumps
        • automatically on out-of-memory
        • trigger programmatically
        • tool support is essentialµ
    • OS-tools
      • track native memory: perfmon, vmstart, ps (os-specific)
      • use gcmv to visualize os-specific dump
      • some native structures have java-wrappers in the heap (e.g. Threads and NIO buffers)
cpu-bound applications
  • target your optimizations → measure
  • diagnose:
    • method trace:
      • System.out.println()
      • log4j
      • ibm-jvm param -Xtrace:print=mt,methods=(HW*)
    • method profiler:
      • health center: low overhead sampler
I/O bound applications
  • gc and memory analyser → long gc times might indicate paging
  • method trace for network and disk I/O
  • os-specific tools
synchronization issues (concurrency)
  • sample thread dumps
  • health center:
    • lock analysis
    • identify contended locks

No comments:

Post a Comment