Overview

This course is targeted at experienced Java developers who want to get the best performance out of their applications. It distils the approaches and techniques used to measure performance, correctly identify performance issues and remove performance bottlenecks. This is an intensive hands-on course with plenty of labs and deep dive explanations. It is delivered by a Java Champion.

Outline

Introduction & Setting the Scene

  • Why is Java Performance hard?
  • An overview of JVM structure and subsystems
  • Objects at runtime (oops, conceptual views of GC and JIT)

Empirical Performance Analysis

  • Hardware, Operating System, Thread Scheduling
  • Cognitive Biases in Performance
  • Review of statistics for the JVM
  • Lab: Introduction to noisy data

Benchmarking

  • A simple system model and simple analysis techniques
  • Basic Analysis Techniques
  • Pitfalls & Best Practices
  • Tools and system benchmarking
  • Lab: Hands-on introduction to diagnosis

Introduction to Garbage Collection

  • Introduction to GC Theory (allocation, evacuating, exact, compacting)
  • Hotspot’s Heap
  • Parallel Collection
  • Lab: Simple model of allocation

Advanced GC (& Tuning & Tools)

  • Advanced Garbage Collection
  • Alternate Collectors (CMS, G1GC & Future Collectors)
  • Understanding trade-offs
  • GC Parameters & GC Logging
  • GC Tools (VisualGC, GCViewer, Censum)
  • GC Tuning & Common Problems
  • Lab: JVM Flags health check / clinic
  • Lab: Spotting GC problems from tools (including jmap)

JVM Execution & JIT compilation

  • Overview of JVM bytecode
  • JIT Compilation Strategies (including low-level strategies used by HS)
  • JIT Logging (PrintCompilation & LogCompilation)
  • JITWatch
  • Lab: Sizing code cache and tuning JIT

Profiling and Microbenchmarking

  • Large-scale profiling
  • Profiling pitfalls
  • Lab: Profiling tools
  • Introduction to Java agents
  • Microbenchmarking caveats
  • JMH
  • Lab: Writing a simple agent
  • Lab: JMH Hands-on (Optional)

General language-level techniques

  • Common Data structures (ArrayList, HashMap, Streams)
  • Immutable objects
  • Atomic access
  • sun.misc.Unsafe
  • Lock-free algorithms & mechanical sympathy
  • Classloading
  • Lab: Building and Using Immutable objects
  • Lab: Simple custom classloader

Parallel Techniques

  • Task vs data parallel
  • Fork and Join
  • Design aspects - Caching, Buffering, Batching vs Parallelism vs Asynchrony
  • Concurrent Data Structures
  • Parallel Streams
  • Lab: Implementing a concurrent map

Java Post-8

  • Modules and their impact
  • Java 9 Flow
  • Lab: Using Flow
  • New performance enhancements
  • Graal, GraalVM and AOTC
  • Valhalla, Panama, GPU compute