Java Performance
Hands-on practice with thorough explanations, presentations, demos, small standalone exercises during the training.
A 3 days seminar for middle .NET developers
This training is for
Java developers who want to improve their abilities to tune-up the performance of their Java applications
GET COMPREHENSIVE TRAINING FOR YOUR TEAM
Agenda
Day 1
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.
2. Profiling(hands-on)
Know the tools:
- Built-in: jconsole, jvisualvm, jfr, jps, etc.
- JProfiler
Real-time analysis
Generate and analyze heap dumps
Heap inspection, memory leaks detection, etc.
Profile a simple JPA application
Day 2
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
- 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
Weak references
4. JMM (Java Memory Model)
Building blocks
- 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
- Future
- COW data structures
Day 3
5. Smart” collections
FastUtil
Goldman Sachs Collections
HPPC
Koloboke
Trove
6. Parallelism (with examples in Java 8)
Theory: map/reduce, scatter, gather, filter, etc.
Parallel map, parallel reduce, scan, histogram
Fork/Join
Pitfalls (e.g. be careful at deadlocks): if the developer is not careful, he can call a blocking method from within a parallel stream.
Trove
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.
REQUIREMENTS
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