Java Advanced II: High Performance Java
Description
This course focuses on improving the performance of Java applications. The training covers various approaches to profiling, finding bottlenecks, tuning a virtual machine, setting JVM flags, serialization and caching libraries, off-heap data storage, benchmarking, memory monitoring / tuning, and other topics.
is issued on the Luxoft Training form
Objectives
To introduce students to modern approaches for improving Java application performance.
Target Audience
- Java developers
- Java architects
Prerequisites
Good knowledge of Java
Roadmap
Module 1: Performance tuning overview [6h]
- Common practices
- Tuning strategies
- Performance metrics (latency, throughput, bandwidth)
- How to improve performance
- Tools for performance measurement
- JMeter
- Writing load tests with JMeter
- How to improve database performance
- How to improve performance via architecture: streams, queues, microservices, clouds
- Common best practices for improving code performance [Homework 3h]
Module 2: GC algorithms [6h]
- Usage of memory by Java objects
- Common approaches and algorithms of garbage collectors
- Serial GC garbage collector
- Parallel GC garbage collector
- CMS garbage collector
- G1 garbage collector
- Shenandoah garbage collector
- Garbage collectors tuning
- Instruments to gather metrics of garbage collection
- How to select the optimal garbage collector
Module 3: HotSpot JIT compiler [5h]
- JIT compilation
- Java byte code
- Tiered compilation
- Code cache and tuning
- Code optimizations
- Code deoptimization (and when it happens)
- JITWatch instrument to analyze compiling results
- Types of optimization
- Speculative optimizations
- Compiler tuning
- AOT compilation
- GraalVM [Homework 2h]
Module 4: JVM flags [3h]
- Purpose and categories of JVM flags
- Common flags
- String-related flags
- Memory management flags
- Safepoints and related flags
- TLABs and related flags
- JVM tuning plan
Module 5: Java benchmarking with JMH [2h]
- What is benchmarking?
- Introduction to JMH
- API of JMH
- Untrivial examples
- JMH practice [Homework 2h]
Module 6: Using off-heap memory and efficient data structures [4h]
- JSON serializers (GSON, Jackson)
- Binary serializers (Protobuf, Jackson Smile, Kryo, FST, One NIO)
- Performance comparison of various serializators
- Networking performance when connecting using various protocols: HTTP/REST, TCP, Async TCP, RSocket, Netty server/client
- When and how to do profiling
- Sampling and instrumenting profilers
- Using Java VisualVM for profiling
- Profiling with Spring AOP
- Profiling with IDEA and async profiler
- Java Flight Recorder
- Analysis of Java Flight Recorder logs using Mission Control
- Create and log custom JFR events
- Using Java agents injected into code (to record events in Java Flight Recorder)
- Writing programs for automatic analysis of JFR logs
- Collecting and analyzing SQL queries using JFR
- Collecting and analyzing REST requests using JFR
- Application Performance Management tools
- Using Glowroot for SQL queries and REST requests profiling and analysis [Homework 2h]
Module 9: Monitoring and analysis of heap data / Memory leaks [3 hours]
- Tools for analyzing heap memory
- Signs of memory leaks
- Main causes of memory leaks
- Search and detection of memory leaks
- Weak and phantom references
- IDEA tools to analyze heap dumps
- Async profiler to analyze memory consumption
- Using VisualVM profiler generations count to detect a memory leak
- Using MissionControl/JFR for automatic memory leaks analysis
- Eclipse Memory Analyser – denominators and heap analysis
Module 10: Java caching [3 h]
- Caching patterns
- HTTP caching
- Creating intermediate cache with nginx
- Caching libraries configuration
- Popular caching libraries: EhCache, Caffeine
- Service level caching
- Caching Spring Services
- Input/Output bufferin
- Processor caches and contiguous memory
- JPA/Hibernate caching
- Using caches on different layers of application
Total: theory 40h (100%), homework 11h (+28%)