This training is for
Java developers who want to improve their abilities to tune-up the performance of their Java applications
1. JVM runtime behavior
The “90/10” rule
- Pause sources
- Memory consumption
GC algorithms, main memory areas, etc
Chose the right GC policy for your application
JVM live tracing: see how and when the byte codes are transformed into machine code, GC activity, etc.
Know the tools:
- Built-in: jconsole, jvisualvm, jfr, jps, etc.
Generate and analyze heap dumps
Heap inspection, memory leaks detection, etc.
Profile a simple JPA application
3. Programming techniques: how to optimize for performance. Some techniques presented here are bad; we consider and analyse them in order to see when they are worth using.
Reduce (e.g. StringBuffer instead of Strings for concatenation or scan problems)
- Reuse buffers, flyweight pattern
- Does flyweight really bring performance boost in heavily threaded applications?
Recycle: recycle objects, use ObjectPool
The cost of reflection
The cost of casts
Cache frequently computed values
- Cache static and instance variables
- Cached exceptions
- Quick memcache intro
4. JMM (Java Memory Model)
- Examples and pitfalls
- Data contention versus lock contention
Modern multi-threading constructs (hands-on)
- Types of locks
- Atomic DS
- Executors, thread blocks
- ConcurrentMap, BlockingQueue, BlockingDequeue
- COW data structures
5. Smart” collections
Goldman Sachs Collections
6. Parallelism (with examples in Java 8)
Theory: map/reduce, scatter, gather, filter, etc.
Parallel map, parallel reduce, scan, histogram
Pitfalls (e.g. be careful at deadlocks): if the developer is not careful, he can call a blocking method from within a parallel stream.
7. JNI brief intro: write a small native utility (C code is given) and call it from Java.
Discuss main JNI architecture
JNI is sometimes useful: we will analyse these situations and see some real-life examples.
For the best experience we can offer, we will need details about each trainee:
- We assume the participants are already proficient in writing Java programs
- The operating system of your choice
- Your preferred IDE or editor
- If the system has at least 4GB of memory, the following should be installed on the host operating system: VirtualBox 4.3.x or later, Vagrant 1.7.x or later
- If the system has less than 4GB of memory: latest JDK 8 installed on the host operating system