HAPPY BOOKSGIVING
Use code BOOKSGIVING during checkout to save 40%-55% on books and eBooks. Shop now.
This eBook includes the following formats, accessible from your Account page after purchase:
EPUB The open industry format known for its reflowable content and usability on supported mobile devices.
PDF The popular standard, used most often with the free Acrobat® Reader® software.
This eBook requires no passwords or activation to read. We customize your eBook by discreetly watermarking it with your name, making it uniquely yours.
Also available in other formats.
Register your product to gain access to bonus material or receive a coupon.
Peek Under the Hood of the Complex but Fascinating Java Virtual Machine
Dive into the intricacies of JVM performance with JVM Performance Engineering, the essential guide for seasoned Java developers eager to demystify the JVM. Focusing on the OpenJDK HotSpot VM, this book provides insights into cutting-edge Java performance techniques and trends.
Distinguished Java Champion Monica Beckwith blends theoretical insights and practical tools--encompassing case studies, applications, use-case diagrams, and process flow charts--to demonstrate diagnostic techniques, performance methodologies, and optimizations.
This manual is a portal to excelling in Java performance engineering, offering Java developers, system architects, and software engineers the tools to foster career advancement and success with Java applications.
Register your product for convenient access to downloads, updates, and/or corrections as they become available. See inside for details.
Download the code files from GitHub:
https://github.com/mo-beck/JVM-Performance-Engineering
Preface xv
Acknowledgments xxiii
About the Author xxvii
Chapter 1: The Performance Evolution of Java: The Language and the Virtual Machine 1
A New Ecosystem Is Born 2
A Few Pages from History 2
Understanding Java HotSpot VM and Its Compilation Strategies 3
HotSpot Garbage Collector: Memory Management Unit 13
The Evolution of the Java Programming Language and Its Ecosystem: A Closer Look 18
Embracing Evolution for Enhanced Performance 42
Chapter 2: Performance Implications of Java's Type System Evolution 43
Java's Primitive Types and Literals Prior to J2SE 5.0 44
Java's Reference Types Prior to J2SE 5.0 45
Java's Type System Evolution from J2SE 5.0 until Java SE 8 49
Java's Type System Evolution: Java 9 and Java 10 52
Java's Type System Evolution: Java 11 to Java 17 55
Beyond Java 17: Project Valhalla 58
Conclusion 68
Chapter 3: From Monolithic to Modular Java: A Retrospective and Ongoing Evolution 69
Introduction 69
Understanding the Java Platform Module System 70
From Monolithic to Modular: The Evolution of the JDK 78
Continuing the Evolution: Modular JDK in JDK 11 and Beyond 78
Implementing Modular Services with JDK 17 78
JAR Hell Versioning Problem and Jigsaw Layers 83
Open Services Gateway Initiative 91
Introduction to Jdeps, Jlink, Jdeprscan, and Jmod 93
Conclusion 96
Chapter 4: The Unified Java Virtual Machine Logging Interface 99
The Need for Unified Logging 99
Unification and Infrastructure 100
Tags in the Unified Logging System 101
Diving into Levels, Outputs, and Decorators 103
Practical Examples of Using the Unified Logging System 107
Optimizing and Managing the Unified Logging System 109
Asynchronous Logging and the Unified Logging System 110
Understanding the Enhancements in JDK 11 and JDK 17 113
Conclusion 113
Chapter 5: End-to-End Java Performance Optimization: Engineering Techniques and Micro-benchmarking with JMH 115
Introduction 115
Performance Engineering: A Central Pillar of Software Engineering 116
Metrics for Measuring Java Performance 118
The Role of Hardware in Performance 128
Performance Engineering Methodology: A Dynamic and Detailed Approach 145
The Importance of Performance Benchmarking 158
Conclusion 175
Chapter 6: Advanced Memory Management and Garbage Collection in OpenJDK 177
Introduction 177
Overview of Garbage Collection in Java 178
Thread-Local Allocation Buffers and Promotion-Local Allocation Buffers 179
Optimizing Memory Access with NUMA-Aware Garbage Collection 181
Exploring Garbage Collection Improvements 183
Future Trends in Garbage Collection 210
Practical Tips for Evaluating GC Performance 212
Evaluating GC Performance in Various Workloads 214
Live Data Set Pressure 216
Chapter 7: Runtime Performance Optimizations: A Focus on Strings, Locks, and Beyond 219
Introduction 219
String Optimizations 220
Enhanced Multithreading Performance: Java Thread Synchronization 236
Transitioning from the Thread-per-Task Model to More Scalable Models 259
Conclusion 270
Chapter 8: Accelerating Time to Steady State with OpenJDK HotSpot VM 273
Introduction 273
JVM Start-up and Warm-up Optimization Techniques 274
Decoding Time to Steady State in Java Applications 274
Managing State at Start-up and Ramp-up 278
GraalVM: Revolutionizing Java's Time to Steady State 290
Emerging Technologies: CRIU and Project CRaC for Checkpoint/Restore Functionality 292
Start-up and Ramp-up Optimization in Serverless and Other Environments 295
Boosting Warm-up Performance with OpenJDK HotSpot VM 300
Conclusion 306
Chapter 9: Harnessing Exotic Hardware: The Future of JVM Performance Engineering 307
Introduction to Exotic Hardware and the JVM 307
Exotic Hardware in the Cloud 309
The Role of Language Design and Toolchains 312
Case Studies 313
Envisioning the Future of JVM and Project Panama 333
Concluding Thoughts: The Future of JVM Performance Engineering 336
Index 337