Performance tuning is an experimental science, but that doesn't mean engineers should resort to guesswork and folklore to get the job done. Yet that's often the case.
With this practical book, intermediate to advanced Java technologists working with complex technology stacks will learn how to tune Java applications for performance using a quantitative, verifiable approach.
Most resources on performance tend to discuss the theory and internals of Java virtual machines, but this book focuses on the practicalities of performance tuning by examining a wide range of aspects. There are no simple recipes, tips and tricks, or algorithms to learn.
Performance tuning is a process of defining and determining desired outcomes. And it requires diligence.
Learn how Java principles and technology make the best use of modern hardware and operating systems
Explore several performance tests and common anti-patterns that can vex your team.
Understand the pitfalls of measuring Java performance numbers and the drawbacks of microbenchmarking
Dive into JVM garbage collection logging, monitoring, tuning, and tools
Explore JIT compilation and Java language performance techniques
Learn performance aspects of the Java Collections API and get an overview of Java concurrency
AI Reading Assistant
Whole-book reading guide from stratified index samples; jump to passages in the text
Tip the Site
Support this siteYour recognition and a small knowledge-service contribution help keep this technical work open source.Scan the WeChat Pay or Alipay code below. Logged-in and guest visitors can both tip.
WeChat Pay
Alipay
Open WeChat or Alipay and scan. No login required.
AI guide
【One-Line Pitch】
A practical, experiment-driven guide for intermediate-to-advanced Java developers who want to move beyond folklore and guesswork, learning how to measure, analyze, and tune JVM applications using quantitative methods and modern tools.
【Book Arc】
- **Opening (~0%–9%)**: Defines performance as an experimental science, introduces a taxonomy (throughput, latency, capacity, utilization, efficiency, scalability, degradation), and warns against outdated advice and "hero" performance culture.
- **Early (~9%–25%)**: Covers measurement fundamentals—statistics, non-normal distributions, and the pitfalls of microbenchmarking—plus an introduction to JVM internals, including garbage collection basics (mark-sweep, HotSpot runtime, weak generational hypothesis).
- **Middle (~25%–47%)**: Deep dive into advanced GC (CMS, G1, Shenandoah, C4, Balanced), GC logging/monitoring/tuning tools, and JIT compilation (tiered compilation, code cache, inlining, escape analysis, intrinsics).
- **Late (~47%–60%)**: Focuses on Java language performance techniques—collections (ArrayList vs LinkedList, HashMap vs TreeMap), domain objects, finalization pitfalls, try-with-resources, and method handles—plus concurrency (JMM, locks, atomics, executors, fork/join, parallel streams).
- **Ending (~60%–100%)**: Covers profiling tools (VisualVM, JFR, YourKit), allocation profiling, heap dump analysis, and high-performance logging/messaging (Agrona, SBE, Aeron), wrapping up with operational considerations.
【Key Takeaways】
- **Performance is an experimental science, not folklore** (Early): Define desired outcomes, measure, change, retest—this process builds quantitative objectives and avoids outdated advice that can harm modern JVMs.
- **Java performance data is rarely normally distributed** (Early): Outliers matter (e.g., low-latency trading), so naive statistics like standard deviation mislead; sampling can miss critical events, and measurement itself adds overhead.
- **Garbage collection tuning requires understanding collectors, not just flags** (Middle): From parallel collectors to G1 and Shenandoah, each has tradeoffs—knowing allocation, pause times, and GC roots is key to effective tuning.
- **JIT compilation is where Java performance lives** (Middle): Inlining, escape analysis, loop unrolling, and intrinsics eliminate overhead; code that avoids small methods is now unfriendly to modern JITs.
- **Collections and language techniques have real tradeoffs** (Late): ArrayList vs LinkedList, HashMap vs TreeMap—no universal winner; finalization is a pitfall, prefer try-with-resources and method handles.
- **Concurrency is about choosing the right abstraction** (Late): From locks and atomics to executors and parallel streams, understanding the JMM and task abstraction prevents subtle bugs and improves scalability.
- **Profiling is essential, but safepoint bias skews results** (Late): Tools like JFR and VisualVM help, but sampling can miss events; allocation profiling and heap dump analysis reveal hidden costs.
- **High-performance messaging benefits from specialized libraries** (Ending): Agrona, SBE, and Aeron show how low-latency logging and messaging can be designed with minimal impact.
【Reading Tips】
- **Skim the foreword and preface** (~0%–9%): They set the philosophy—skip if you're already convinced, but the taxonomy chapter is worth a slow read.
- **Deep-read the GC chapters** (~25%–47%): This is the heart of the book; focus on G1 and Shenandoah if you use modern JVMs, and skim legacy collectors (CMS, Serial) unless you maintain old systems.
- **Treat the JIT chapters as reference material** (~47%–60%): Inlining and escape analysis are crucial, but don't memorize flags—understand the concepts and use JITWatch for practical insight.
- **Use the collections and concurrency chapters as a checklist** (~60%–75%): These are practical, code-level techniques; skim for anti-patterns and apply selectively.
- **The profiling and messaging chapters are for operational scenarios** (~75%–100%): If you're not doing low-latency work, skim Aeron/SBE; profiling tools are worth a deeper look for any production engineer.
【Coverage Limits】
This guide synthesizes the book's core themes—methodology, GC, JIT, language techniques, concurrency, profiling, and messaging—but does not cover specific code examples, detailed flag tables, or step-by-step tool walkthroughs, which require reading the full text.
Excerpt 1
etween the Observables Reading Performance Graphs Summary 2. Overview of the JVM Interpreting and Classloading Executing Bytecode Introducing HotSpot Introdu...
n architect, you may measure performance in broader metrics. You may be more concerned about resource utilization than straight-line execution. You might pay...
r more information, please visit http://oreilly.com/safari . How to Contact Us Please address comments and questions concerning this book to the publisher: O...
recedented growth in hardware capability that it represents. The most amazing achievement of the computer software industry is its continuing cancellation of...
called the degradation of the system under additional load. Connections Between the Observables The behavior of the various performance observables is usuall...
actually execute the user code in the HelloWorld class file. The entry point into the application will be the main() method of HelloWorld.class . In order to...
] args ) { for ( int i = 0 ; i < 10 ; i ++) { System . out . println ( "Hello World" ); } } } Java ships with a class file disassembler called javap , allowi...
cost of forcing a lot of low-level complexity onto the user. Note that “more predictable” does not necessarily mean “better.” AOT compilers produce code that...
Support this siteYour recognition and a small knowledge-service contribution help keep this technical work open source.
Scan the WeChat Pay or Alipay code below. Logged-in and guest visitors can both tip.
WeChat PayAlipay
Open WeChat or Alipay and scan. No login required.
Add Tag
Enter tag name (max 50 characters)
Share E-Book
Optimizing Java (Benjamin J. Evans, James Gough etc.)(Z-Library)
Scan QR code with your phone to access
Copy the link or scan the QR code to access this e-book on your phone
Share E-Book via Email
Please enter email address
Donation Statistics
¥.00
Total Donations
0
Donation Count
Optimizing Java (Benjamin J. Evans, James Gough etc.)(Z-Library)
Find Your Favorite Books
Only registered users can comment after logging in. Comments need to be reviewed by administrators before being displayed
Loading comments...
Reply to Comment
Edit Comment