Java Platform performance
Java Platform performance
Tim Cramer, David Dagastine, Ben Kim
Sun Microsystems
Focus: Understand how to measure performance.
Should performance be added as a step to the development process?
Why taking the average when using benchmarks doesn't work
2 runs score 24 and 26 vs. score of 1 and 49.
Both average 25
Beware Microbenchmarks!
Student's T-Test
Determine confidence between 2 data sets
Want 95% or higher confidence level, p-value 0.05
Modern Java Virtual Machine(JVM) Software Microbenchmark Negating Characteristics
Warmup period for Dynamic compilation
on-stack replacement
separate compile thread
disk cache
On by default on on-solaris x86 OS-based systems
Off by default on Solaris x86 OS-based systems
Statistical Gathering
Monomorphic call transformation
branch targets
execution frequency
Background Compilation
-Xbatch
Compiler Optimizations
Dead code removal
Inlining
Tips and Tricks
JVM Software Performance Tuning, pre 1.5
Java hotspot VM is highly tunable
Select Server compiler with -server flag
Correctly size the overall heap
set min/max of heap to same value to minimize resizing
+AggressiveHeap flag
size of initial heap based on avail memory MIN(1/2 RAM, RAM-160M)
flag can change at anytime!
Monitor JVM software using JVMstat tools
New garbage collectors
Default
Incremental
Throughput
New Features of JDK 1.5
Smart Tuning
Provide good out of the box performance without hand tuning
examine host machine and configure hotspot appropriately
dynamically adjust java hotspot VM software at runtime
adaptive heap sizing policy during life of application.
client performance
Class data sharing
faster classload = faster startup time
shared class archive, reduce footprint
JFC/Swing and Java 2D API improvements
Overall
know how to write a microbenchmark before doing so
upgrade to jdk 1.5
understand OS and hardware
http://java.sun.com/docs/performance