Java Performance: The Definitive Guide. Java Performance: The Definitive Guide
518 pages
English
PDF
4.5

Java Performance: The Definitive Guide. Java Performance: The Definitive Guide

Java Performance: The Definitive Guide. Java Performance: The Definitive Guide

Author:

Year:

Summary:

Introduction

The book «Java Performance: The Definitive Guide» by Scott Oaks is not just another language reference. It is a fundamental work dedicated to a deep understanding of how the Java Virtual Machine (JVM) works, how to measure and improve application performance. Published in 2020 (second edition), the book covers Java versions 11 and 14, making it relevant for modern projects. On the PythonLib website, we often talk about Python, but understanding the principles of performance in Java helps to look at optimization more broadly — many concepts (garbage collection, profiling, memory management) are universal.

What is this book about?

Scott Oaks, a veteran of Sun Microsystems and Oracle, focuses on the practical aspects of performance. The book consists of several logical blocks:

  • JVM Basics: HotSpot architecture, compilation (C1, C2, Graal JIT), type system, memory management.
  • Garbage Collection (GC): detailed analysis of all collectors — G1, ZGC, Shenandoah, Epsilon. Algorithms, tuning, logging.
  • Profiling and Monitoring: tools (JFR, JMC, VisualVM, async-profiler), dump analysis, benchmarking with JMH.
  • Code Optimization: working with threads, synchronization, I/O, database interaction, JPA/Hibernate.
  • Operating System and Container Tuning: impact of Docker, cgroups, NUMA, file systems.

Who is this book for?

The book is intended for experienced Java developers, architects, and DevOps engineers who already know how to write code but want to understand why it runs slowly and how to fix it. Beginners will find it challenging — knowledge of Java at the middle+ level is assumed.

What will the reader learn?

  • How JIT compilation works and how to control it (flags, deoptimization).
  • How to choose and configure a garbage collector for a specific workload (latency vs throughput).
  • How to profile an application without stopping it (JFR, async-profiler).
  • How to write microbenchmarks with JMH and avoid pitfalls.
  • How to optimize memory usage: avoid leaks, use caches effectively.
  • How to tune the JVM in containers (Docker, Kubernetes).
  • How to diagnose issues with threads, locks, and I/O.

Strengths of the book

The first thing that stands out is the depth and relevance. Oaks doesn't just paraphrase the documentation; he explains the internal mechanisms of the JVM at the source code level. The second is the practical focus: each chapter contains specific examples of settings, flags, and scenarios. The third is the structured approach: the book reads like a textbook, but can also be used as a reference. The chapters on G1 GC and ZGC deserve special mention — they are the best material on the topic in English.

Weaknesses: the book is not for beginners and requires thoughtful reading. Some sections (for example, about GraalVM) could have been expanded, but this is compensated by references to additional sources.

Who is it recommended for

Essential reading for anyone working with high-load Java services, optimizing latency or throughput, as well as those who want to migrate to modern Java versions (11+) and use new GCs. The book will also be useful for developers in other languages (including Python) — understanding how the JVM and GC work broadens horizons and helps write more efficient code.

At PythonLib, we highly value quality technical guides. «Java Performance: The Definitive Guide» is exactly that: authoritative, comprehensive, and practical. We recommend it.

Recommendations