“The definitive master class in performance tuning Java applications…if you love all the gory details, this is the book for you.” –James Gosling, creator of the Java Programming Language Improvements in the Java platform and new multicore/multiprocessor hardware have made it possible to dramatically improve the performance and scalability of Java software. Java™ Performance covers the latest Oracle and third-party tools for monitoring and measuring performance on a wide variety of hardware architectures and operating systems. The authors present dozens of tips and tricks you’ll find nowhere else. You’ll learn how to construct experiments that identify opportunities for optimization, interpret the results, and take effective action. You’ll also find powerful insights into microbenchmarking–including how to avoid common mistakes that can mislead you into writing poorly performing software. Then, building on this foundation, you’ll walk through optimizing the Java HotSpot VM, standard and multitiered applications; Web applications, and more. Coverage includes Taking a proactive approach to meeting application performance and scalability goals Monitoring Java performance at the OS level in Windows, Linux, and Oracle Solaris environmentsUsing modern Java Virtual Machine (JVM) and OS observability tools to profile running systems, with almost no performance penaltyGaining “under the hood” knowledge of the Java HotSpot VM that can help you address most Java performance issues Integrating JVM-level and application monitoringMastering Java method and heap (memory) profilingTuning the Java HotSpot VM for startup, memory footprint, response time, and latencyDetermining when Java applications require rework to meet performance goalsSystematically profiling and tuning performance in both Java SE and Java EE applicationsOptimizing the performance of the Java HotSpot VM Using this book, you can squeeze maximum performance and value from all your Java applications–no matter how c
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 deep, tool-driven master class in Java performance tuning: it teaches you how to measure, interpret, and fix performance problems across the OS, JVM, and application layers. Best for experienced Java developers, architects, and performance engineers who want the "gory details" rather than quick tips.
【Book Arc】
- **Opening (~0%–10%)**: Frames performance as a process problem, not a late-stage emergency—covering the traditional development phases, the forces that trigger tuning efforts, and top-down vs. bottom-up tuning strategies.
- **Early (~10%–30%)**: Builds OS-level observability on Windows, Linux, and Solaris—CPU utilization (user vs. kernel), context-switch cost estimation, and mapping OS threads to Java threads with tools like prstat, pstack, and jstack.
- **Early–Middle (~30%–40%)**: Goes under the hood of the HotSpot VM: class loading phases, safepoints and stop-the-world mechanics, the C++ heap, and how VM internals shape observable performance.
- **Middle (~40%–55%)**: Compares garbage collectors (Serial, Parallel, Mostly-Concurrent/CMS) by throughput vs. latency trade-offs, and covers JIT compiler choices, tiered compilation, and ergonomics-driven adaptive tuning.
- **Middle–Late (~55%–75%)**: Turns to measurement practice—reading GC logs, using JConsole/VisualVM/JMX for local and remote monitoring, and integrating JVM-level with application-level data.
- **Late (~75%–100%)**: Applies the foundation to profiling and tuning Java SE and Java EE applications, including method and heap profiling, microbenchmarking pitfalls, and deciding when an application needs rework rather than tuning.
【Key Takeaways】
- **Performance must be designed in, not bolted on** (Opening): the book argues that treating performance as a testing-phase afterthought is the root cause of most tuning pain, and proposes integrating it into analysis, design, and coding.
- **Kernel CPU time is wasted opportunity** (Early): high system/kernel utilization signals shared-resource contention or heavy I/O interaction; driving it toward zero frees cycles for application code.
- **OS-level tools can pinpoint the guilty Java thread** (Early): prstat/pstack on Solaris plus jstack let you map a hot lightweight process to a specific Java thread and method without a profiler.
- **Hardware architecture changes what "CPU busy" means** (Early): on SPARC T-series, each hardware thread is reported as a virtual processor, so mpstat/vmstat can show a processor as busy even when stalled—misreading this leads to wrong conclusions.
- **Safepoints explain many mysterious pauses** (Early–Middle): stop-the-world GC, biased-lock revocation, and stack dumps all require threads to reach safepoint-safe states, and the cooperative polling mechanism determines pause behavior.
- **Choose a GC by your priority: throughput or latency** (Middle): Parallel GC suits batch/scientific workloads, while CMS targets response-time-sensitive applications by doing most old-generation work concurrently with only short pauses.
- **Ergonomics reduces manual tuning burden** (Middle): since Java 5, the VM auto-selects GC, heap size, and JIT compiler based on the platform, with adaptive heap sizing—knowing the defaults helps you decide when to override them.
- **GC logs are a primary diagnostic instrument** (Middle): PrintGCDetails output reveals generation sizes, collection durations, and user/sys/real time splits that let you calculate old-generation size and spot pause problems.
【Reading Tips】
- Deep-read the OS monitoring and GC chapters (Early–Middle); these are the highest-leverage sections and the ones you will return to during real incidents.
- Skim the HotSpot internals chapter on a first pass, then revisit it when a specific safepoint or class-loading issue appears—it is reference material as much as narrative.
- Treat the tool examples (prstat, pidstat, jstack, JConsole, VisualVM) as recipes: reproduce them on your own JVM rather than reading passively.
- Pay special attention to the microbenchmarking warnings; misdesigned benchmarks are a common source of false optimization conclusions.
- Keep the throughput-vs-latency framing in mind throughout—most tuning decisions reduce to which one your application actually needs.
【Coverage Limits】
The excerpts cover the book's opening framing, OS-level monitoring, HotSpot internals, GC/JIT tuning, and monitoring tools, but do not detail the later Java SE/Java EE profiling chapters or specific microbenchmarking techniques beyond brief mentions. Chapter titles and exact percentages are inferred from position markers, not from a full table of contents.
Excerpt 1
rd and multitiered applications; Web applications, and more. Coverage includes Taking a proactive approach to meeting application performance and scalability...
d the Java thread that corresponds to Solaris thread# 2 by searching for a “nid” label. The thread number, 2 in decimal, is also 2 in hexadeci- mal. The foll...
136 an interface, or the direct superclass is an interface. The link phase first does verification, which checks the classfile semantics, checks the constant...
e old generation space. For example, the Java heap size is 764672K, and the young generation size is 109312K. Hence, the old generation size is 764672K - 109...
ble with this type of installer. In contrast, the tar file installer does not require root access to install the Performance Analyzer. However, it is not eli...
methods Data Structure Resizing 235 Data Structure Resizing Java applications tend to make high use of Java SE’s StringBuilder or String- Buffer for assembli...
be short in duration relative to full garbage collections. Objects that remain live for some number of minor garbage collections eventually get promoted (cop...
%. You may be able to drive the overhead down to as little as 1% to 3%. Generally, if you are currently observing garbage collection overhead with CMS at 3%...
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.
Loading comments...
Reply to Comment
Edit Comment