Share E-Book
Scan to open this page

Scan with your phone to open this page

Author: Benjamin J. Evans, James Gough

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 platforms will learn how to tune Java cloud applications for performance using a quantitative, verifiable, and repeatable approach. In response to the ubiquity of cloud computing, this updated edition of Optimizing Cloud Native Java addresses topics that are key to high performance of Java applications in the cloud. Many resources on performance tend to focus on the theory and internals of Java virtual machines, but this book discusses the low-level technical aspects within the context of performance-tuning practicalities and examines a wide range of aspects. With this book, you will • Learn how Java principles and technology make the best use of modern hardware, operating systems, and cloud stacks • Examine the pitfalls of measuring Java performance numbers and the drawbacks of microbenchmarking • Understand how to package, deploy, operate, and debug Java/JVM applications in modern cloud environments • Apply emerging observability approaches to obtain deep understanding of cloud native applications • Use Java language performance techniques including concurrent and distributed forms

AI Reading Assistant

Whole-book reading guide from stratified index samples; jump to passages in the text

AI guide
# Optimizing Cloud Native Java: Practical Techniques for Improving JVM Application Performance ## 【One-Line Pitch】 A practical, evidence-based guide for intermediate to advanced Java developers who want to move beyond performance folklore and adopt a quantitative, repeatable approach to tuning JVM applications in cloud environments. If you're responsible for the performance of Java services running on modern infrastructure, this book gives you the measurement discipline and JVM internals knowledge to make defensible optimization decisions. ## 【Book Arc】 - **Opening (~0%–9%)**: Establishes performance tuning as an experimental science and lays out the book's scope—covering hardware, JVM internals, cloud environments, and distributed systems. The foreword frames performance work as a discovery process rooted in understanding "the whole system," not just isolated components. - **Early (~9%–25%)**: Introduces core performance concepts and measurement methodology. Covers the taxonomy of performance observables (latency, throughput), common graph patterns like the "performance elbow," and the dangers of performance antipatterns—including a memorable case study of outdated Java advice that persisted in search results and actively harmed applications. - **Early (~25%–34%)**: Dives into performance testing methodology, including statistical analysis of results and the use of tools like HdrHistogram for understanding latency distributions. Emphasizes why simple averages are insufficient and why percentile-based analysis matters for real-world performance understanding. - **Middle (~34%–47%)**: Explains JVM fundamentals—bytecode execution, class file structure, threading, and the Java Memory Model. Introduces virtual threads (Project Loom) as a solution to the "thread bottleneck" problem, and covers JVM distributions, heap layout, and garbage collection basics including the weak generational hypothesis. - **Middle (~47%–53%+)**: Moves into advanced garbage collection territory, covering tradeoffs between collectors, concurrent GC theory, JVM safepoints, tri-color marking, and detailed looks at G1, Shenandoah, and ZGC. Also touches on OpenJ9's Balanced collector and object header considerations. ## 【Key Takeaways】 - **Performance tuning is an experimental science, not guesswork** (Opening): The book's central thesis is that optimization decisions must be quantitative, verifiable, and repeatable—otherwise you risk following folklore that can actively harm your applications. - **Measurement methodology matters more than tools** (Early): Simple averages hide the truth about latency; percentile distributions and proper statistical analysis reveal what users actually experience. Tools like HdrHistogram help visualize these distributions effectively. - **Performance antipatterns have organizational roots** (Early): Boredom, résumé padding, and social pressure within teams lead to unnecessary technology choices and code complexity that can burden projects for years after the original developers leave. - **The JVM is language-agnostic** (Middle): The J in JVM is misleading—any language producing valid class files (Kotlin, Scala, etc.) runs on it. Understanding bytecode and class file structure is foundational to understanding JVM performance. - **Virtual threads solve the thread bottleneck** (Middle): Project Loom's virtual threads (Java 21+) address the scalability limits of the traditional one-application-thread-per-platform-thread model, which has become a constraint as applications have grown massively. - **The weak generational hypothesis drives GC design** (Middle): Most objects are short-lived, so heaps should separate short-lived from long-lived objects to enable efficient collection. This experimentally validated observation shapes how modern collectors are structured. - **Modern GCs balance complex tradeoffs** (Middle): G1, Shenandoah, and ZGC each make different tradeoffs between pause times, throughput, and memory overhead. Understanding safepoints, tri-color marking, and forwarding pointers is essential for choosing and tuning the right collector. ## 【Reading Tips】 - **Skim the early chapters on performance definitions** (~9%–16%) if you're already familiar with latency/throughput concepts—but don't skip the antipatterns section, which contains valuable organizational insights. - **Deep-read the performance testing methodology chapter** (~25%–34%): The statistical analysis content and HdrHistogram examples are immediately applicable to real performance work. - **Pay special attention to the GC chapters** (~47%–53%+): These are the most technically dense but also the most valuable for practical tuning. The comparisons between G1, Shenandoah, and ZGC will help you make informed collector choices. - **Use the JVM internals chapters** (~34%–47%) as reference material—you may not need all the bytecode details immediately, but the threading and memory model content is crucial context for understanding performance behavior. - **Take away the measurement discipline**: The book's real value is in its approach—treat every performance claim as a hypothesis to be tested, and build your own repeatable measurement workflows. ## 【Coverage Limits】 The excerpts cover roughly the first half of the book (through advanced GC topics). Later sections on cloud deployment, observability, and distributed/concurrent performance techniques are mentioned in the table of contents but not covered in detail in this guide. ##
Excerpt 1
77 Garbage Collection Glossary 79 Introducing the HotSpot Runtime 80 Representing Objects at Runtime 81 GC Roots 84 Allocation and Lifetime 85 Weak Generatio...
View in text
Excerpt 2
different definitions, or even different metrics, are used, but in most cases these will be the basic system numbers that will normally be used to guide perf...
View in text
Excerpt 3
ftware” by Mahmoud Hashemi is a great introduction to their methodologies and includes a version of the hat/elephant problem discussed earlier.8 Also worth m...
View in text
Excerpt 4
l.LinkedList$Node 15: 29375 940000 java.util.LinkedList 16: 25944 830208 jdk.nashorn.interna...FinalScriptFunctionData 17: 20 655680 [Lscala.concurrent.forkj...
View in text
Excerpt 5
re the application has allocated all available heap memory, then G1 will have no choice but to perform a full GC—this is sometimes called a concurrent mode f...
View in text
Excerpt 6
ative workloads? 162 | Chapter 6: Code Execution on the JVM Hardware has become increasingly complex to make good use of the “transistor budget” available in...
View in text
Excerpt 7
egories in the CNCF Landscape, you will find the individual CNCF projects, the statistics of the project, and where the ownership of each project resides. No...
View in text
Excerpt 8
at runs for only a few seconds, the cost is extremely high. Image size is only part of the issue because start-up times for Java can be slow under certain fr...
View in text
Tags
AI categories
Cloud NativeJavaperformance tuning
ISBN: 1098149343
Publisher: O'Reilly Media
Publish Year: 2024
Language: English
Pages: 497
File Format: PDF
File Size: 16.4 MB
Text Preview (First 20 pages)
Registered users can read the full content for free

Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.

Generating text preview…