Coding and testing are generally considered separate areas of expertise. In this practical book, Java expert Scott Oaks takes the approach that anyone who works with Java should be adept at understanding how code behaves in the Java Virtual Machine—including the tunings likely to help performance. This updated second edition helps you gain in-depth knowledge of Java application performance using both the JVM and the Java platform.
Developers and performance engineers alike will learn a variety of features, tools, and processes for improving the way the Java 8 and 11 LTS releases perform. While the emphasis is on production-supported releases and features, this book also features previews of exciting new technologies such as ahead-of-time compilation and experimental garbage collections.
• Understand how various Java platforms and compilers affect performance
• Learn how Java garbage collection works
• Apply four principles to obtain best results from performance testing
• Use the JDK and other tools to learn how a Java application is performing
• Minimize the garbage collector’s impact through tuning and programming practices
• Tackle performance issues in Java APIs
• Improve Java-driven database application performance
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, evidence-driven guide to making Java 8 and 11 applications faster by understanding what actually happens inside the JVM—written for developers and performance engineers who want to tune with data rather than folklore.
【Book Arc】
- **Opening (~0%–10%)**: Sets the philosophy—performance is mostly about writing better algorithms and less code, not hunting for a magic JVM flag; introduces the two knowledge domains (JVM behavior and Java platform behavior).
- **Early (~10%–35%)**: Builds the measurement foundation: the four principles of performance testing, warm-up and JIT effects, choosing throughput vs. batch vs. response-time metrics, statistical rigor, and using JMH to avoid common benchmarking traps.
- **Middle (~35%–55%)**: Equips you with a toolbox—OS-level analysis (e.g., iostat), JVM flag inspection via jinfo, and Java Flight Recorder/Mission Control for low-overhead profiling of GC, code, exceptions, and compilation.
- **Late (~55%–85%)**: Moves into the JVM internals that dominate real performance: how the JIT compiles and optimizes bytecode, and how garbage collectors work and can be tuned to reduce pause and overhead.
- **Ending (~85%–100%)**: Applies the knowledge to the Java platform itself—performance pitfalls in core APIs (collections, strings, logging) and in database-driven applications—closing the loop from measurement to code-level practice.
【Key Takeaways】
- **Write better algorithms first** (Opening): No JVM optimization can beat a fundamentally better data structure or algorithm; tuning flags cannot rescue poor design.
- **Less code is faster code** (Opening): Fewer classes, objects, and executed instructions mean faster startup, less GC pressure, and better cache behavior—the "death by 1,000 cuts" of incremental bloat.
- **Measure with the right metric** (Early): Throughput, elapsed/batch time, and response time are interrelated but serve different goals; picking the wrong one leads to optimizing the wrong thing.
- **Warm-up is unavoidable in Java** (Early): JIT compilation, JPA caches, and OS file caching mean early measurements mislead; benchmark only after code reaches steady state.
- **Use JMH and statistics, not ad-hoc loops** (Early): Proper warm-up iterations, forking, parameterization, and confidence intervals turn noisy guesses into defensible results.
- **Don't tune flags blindly** (Middle): Hundreds of JVM flags exist, but most are for support engineers; change a flag only with a compelling, evidence-backed reason, and remember many are not dynamically manageable.
- **JFR gives low-overhead visibility** (Middle): Java Flight Recorder exposes GC events, hot methods, exceptions, and compiler activity, making it a first stop for diagnosing production behavior.
- **GC and JIT are the dominant JVM levers** (Late): Understanding tiered compilation and garbage collection behavior—and tuning or programming around them—delivers the largest JVM-side gains.
【Reading Tips】
- **Deep-read the testing chapters (Early)**: The four principles and JMH material are the foundation for every later claim; skimming here undermines the rest.
- **Skim the tool catalog (Middle)**: Treat jinfo, iostat, and JFR sections as a reference to return to when diagnosing a specific problem, not as linear reading.
- **Pair GC and JIT chapters with your own workload**: The concepts matter more than memorizing flags; test tuning ideas against a real application.
- **Read the API and database chapters last, with your codebase in mind**: They are most useful as a checklist for auditing existing code rather than as abstract theory.
【Coverage Limits】
These excerpts emphasize the book's opening philosophy, performance-testing methodology, and tooling; the later JVM internals (GC, JIT) and Java API/database chapters are represented only by their stated scope, so this guide does not detail their specific techniques.
Page 9
394 Collections and Memory Efficiency 395 Lambdas and Anonymous Classes 397 Stream and Filter Performance 399 Lazy Traversal 399 Object Serialization 402 Tra...
and operate at peak performance. For that (and other) rea‐ sons, performance studies of Java are concerned about warm-up periods: perfor‐ mance is most often...
le JFR recordings have been enabled for a given process. To see the available recordings: % jcmd 21532 JFR.check [verbose] 21532: Recording 1: name=1 maxsize...
iled (rather than continuing to execute in the interpreter). Background compilation is also disabled when -Xbatch is specified. 108 | Chapter 4: Working with...
for the initial and max‐ imum sizes are given in Table 5-9. The JVM will round these values down slightly for alignment purposes; the GC logs that print the...
of the G1 GC region will make G1 GC a little more efficient in this example; select a value so that there will be close to 2,048 regions at the expected heap...
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
Java Performance In-Depth Advice for Tuning and Programming Java 8, 11, and Beyond (Scott Oaks) (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
Java Performance In-Depth Advice for Tuning and Programming Java 8, 11, and Beyond (Scott Oaks) (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