Optimizing Java. Practical Techniques for Improving JVM Application Performance - Helion
ISBN: 978-14-920-3927-3
stron: 440, Format: ebook
Data wydania: 2018-04-17
Księgarnia: Helion
Cena książki: 194,65 zł (poprzednio: 226,34 zł)
Oszczędzasz: 14% (-31,69 zł)
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
Osoby które kupowały "Optimizing Java. Practical Techniques for Improving JVM Application Performance", wybierały także:
- Wprowadzenie do Javy. Programowanie i struktury danych. Wydanie XII 193,23 zł, (59,90 zł -69%)
- Spring i Spring Boot. Kurs video. Testowanie aplikacji i bezpiecze 129,00 zł, (51,60 zł -60%)
- Metoda dziel i zwyci 89,00 zł, (35,60 zł -60%)
- JavaFX. Kurs video. Wzorce oraz typy generyczne 79,00 zł, (31,60 zł -60%)
- Platforma Xamarin. Kurs video. Poziom drugi. Zaawansowane techniki tworzenia aplikacji cross-platform 99,00 zł, (39,60 zł -60%)
Spis treści
Optimizing Java. Practical Techniques for Improving JVM Application Performance eBook -- spis treści
- Foreword
- Preface
- Conventions Used in This Book
- Using Code Examples
- OReilly Safari
- How to Contact Us
- Acknowledgments
- 1. Optimization and Performance Defined
- Java PerformanceThe Wrong Way
- Java Performance Overview
- Performance as an Experimental Science
- A Taxonomy for Performance
- Throughput
- Latency
- Capacity
- Utilization
- Efficiency
- Scalability
- Degradation
- Connections Between the Observables
- Reading Performance Graphs
- Summary
- 2. Overview of the JVM
- Interpreting and Classloading
- Executing Bytecode
- Introducing HotSpot
- Introducing Just-in-Time Compilation
- JVM Memory Management
- Threading and the Java Memory Model
- Meet the JVMs
- A Note on Licenses
- Monitoring and Tooling for the JVM
- VisualVM
- Summary
- 3. Hardware and Operating Systems
- Introduction to Modern Hardware
- Memory
- Memory Caches
- Modern Processor Features
- Translation Lookaside Buffer
- Branch Prediction and Speculative Execution
- Hardware Memory Models
- Operating Systems
- The Scheduler
- A Question of Time
- Context Switches
- A Simple System Model
- Basic Detection Strategies
- Utilizing the CPU
- Garbage Collection
- I/O
- Kernel bypass I/O
- Mechanical Sympathy
- Virtualization
- The JVM and the Operating System
- Summary
- 4. Performance Testing Patterns and Antipatterns
- Types of Performance Test
- Latency Test
- Throughput Test
- Load Test
- Stress Test
- Endurance Test
- Capacity Planning Test
- Degradation Test
- Best Practices Primer
- Top-Down Performance
- Creating a Test Environment
- Identifying Performance Requirements
- Java-Specific Issues
- Performance Testing as Part of the SDLC
- Introducing Performance Antipatterns
- Boredom
- Résumé Padding
- Peer Pressure
- Lack of Understanding
- Misunderstood/Nonexistent Problem
- Performance Antipatterns Catalogue
- Distracted by Shiny
- Description
- Example comment
- Reality
- Discussion
- Resolutions
- Distracted by Simple
- Description
- Example comments
- Reality
- Discussion
- Resolutions
- Performance Tuning Wizard
- Description
- Example comment
- Reality
- Discussion
- Resolutions
- Tuning by Folklore
- Description
- Example comment
- Reality
- Discussion
- Resolutions
- The Blame Donkey
- Description
- Example comment
- Reality
- Discussion
- Resolutions
- Missing the Bigger Picture
- Description
- Example comments
- Reality
- Discussion
- Resolutions
- UAT Is My Desktop
- Description
- Example Comment
- Reality
- Discussion
- Resolutions
- Production-Like Data Is Hard
- Description
- Example comments
- Reality
- Discussion
- Resolutions
- Distracted by Shiny
- Cognitive Biases and Performance Testing
- Reductionist Thinking
- Confirmation Bias
- Fog of War (Action Bias)
- Risk Bias
- Ellsbergs Paradox
- Summary
- Types of Performance Test
- 5. Microbenchmarking and Statistics
- Introduction to Measuring Java Performance
- Introduction to JMH
- Dont Microbenchmark If You Can Help It (A True Story)
- Heuristics for When to Microbenchmark
- The JMH Framework
- Executing Benchmarks
- Statistics for JVM Performance
- Types of Error
- Systematic error
- Random error
- Spurious correlation
- Non-Normal Statistics
- Types of Error
- Interpretation of Statistics
- Summary
- 6. Understanding Garbage Collection
- Introducing Mark and Sweep
- Garbage Collection Glossary
- Introducing the HotSpot Runtime
- Representing Objects at Runtime
- GC Roots and Arenas
- Allocation and Lifetime
- Weak Generational Hypothesis
- Garbage Collection in HotSpot
- Thread-Local Allocation
- Hemispheric Collection
- The Parallel Collectors
- Young Parallel Collections
- Old Parallel Collections
- Limitations of Parallel Collectors
- The Role of Allocation
- Summary
- Introducing Mark and Sweep
- 7. Advanced Garbage Collection
- Tradeoffs and Pluggable Collectors
- Concurrent GC Theory
- JVM Safepoints
- Tri-Color Marking
- CMS
- How CMS Works
- Basic JVM Flags for CMS
- G1
- G1 Heap Layout and Regions
- G1 Algorithm Design
- G1 Phases
- Basic JVM Flags for G1
- Shenandoah
- Concurrent Compaction
- Obtaining Shenandoah
- C4 (Azul Zing)
- The Loaded Value Barrier
- Balanced (IBM J9)
- J9 Object Headers
- Large Arrays in Balanced
- NUMA and Balanced
- Legacy HotSpot Collectors
- Serial and SerialOld
- Incremental CMS (iCMS)
- Deprecated and Removed GC Combinations
- Epsilon
- Summary
- 8. GC Logging, Monitoring, Tuning, and Tools
- Introduction to GC Logging
- Switching On GC Logging
- GC Logs Versus JMX
- Drawbacks of JMX
- Benefits of GC Log Data
- Log Parsing Tools
- Censum
- GCViewer
- Different Visualizations of the Same Data
- Basic GC Tuning
- Understanding Allocation
- Understanding Pause Time
- Collector Threads and GC Roots
- Tuning Parallel GC
- Tuning CMS
- Concurrent Mode Failures Due to Fragmentation
- Tuning G1
- jHiccup
- Summary
- Introduction to GC Logging
- 9. Code Execution on the JVM
- Overview of Bytecode Interpretation
- Introduction to JVM Bytecode
- Simple Interpreters
- HotSpot-Specific Details
- AOT and JIT Compilation
- AOT Compilation
- JIT Compilation
- Comparing AOT and JIT Compilation
- HotSpot JIT Basics
- Klass Words, Vtables, and Pointer Swizzling
- Logging JIT Compilation
- Compilers Within HotSpot
- Tiered Compilation in HotSpot
- The Code Cache
- Fragmentation
- Simple JIT Tuning
- Summary
- Overview of Bytecode Interpretation
- 10. Understanding JIT Compilation
- Introducing JITWatch
- Basic JITWatch Views
- Debug JVMs and hsdis
- Introducing JIT Compilation
- Inlining
- Inlining Limits
- Tuning the Inlining Subsystem
- Loop Unrolling
- Loop Unrolling Summary
- Escape Analysis
- Eliminating Heap Allocations
- Locks and Escape Analysis
- Limitations of Escape Analysis
- Monomorphic Dispatch
- Intrinsics
- On-Stack Replacement
- Safepoints Revisited
- Core Library Methods
- Upper Method Size Limit for Inlining
- Improve performance with a domain-specific method
- Benefits of small methods
- Upper Method Size Limit for Compilation
- Upper Method Size Limit for Inlining
- Summary
- Introducing JITWatch
- 11. Java Language Performance Techniques
- Optimizing Collections
- Optimization Considerations for Lists
- ArrayList
- LinkedList
- ArrayList versus LinkedList
- Optimization Considerations for Maps
- HashMap
- LinkedHashMap
- TreeMap
- Lack of MultiMap
- HashMap
- Optimization Considerations for Sets
- Domain Objects
- Avoid Finalization
- War Story: Forgetting to Clean Up
- Why Not Use Finalization to Solve the Problem?
- try-with-resources
- Method Handles
- Summary
- 12. Concurrent Performance Techniques
- Introduction to Parallelism
- Fundamental Java Concurrency
- Understanding the JMM
- Building Concurrency Libraries
- Unsafe
- Atomics and CAS
- Locks and Spinlocks
- Summary of Concurrent Libraries
- Locks in java.util.concurrent
- Read/Write Locks
- Semaphores
- Concurrent Collections
- Latches and Barriers
- Executors and Task Abstraction
- Introducing Asynchronous Execution
- Selecting an ExecutorService
- Fork/Join
- Modern Java Concurrency
- Streams and Parallel Streams
- Lock-Free Techniques
- Actor-Based Techniques
- Summary
- Introduction to Parallelism
- 13. Profiling
- Introduction to Profiling
- Sampling and Safepointing Bias
- Execution Profiling Tools for Developers
- VisualVM Profiler
- JProfiler
- YourKit
- Flight Recorder and Mission Control
- Operational Tools
- Red Hat Thermostat
- New Relic
- jClarity Illuminate
- Modern Profilers
- Allocation Profiling
- Heap Dump Analysis
- hprof
- Summary
- 14. High-Performance Logging and Messaging
- Logging
- Logging Microbenchmarks
- No logging
- Logback format
- java.util.logging format
- Log4j format
- Measurements
- Logger results
- Logging Microbenchmarks
- Designing a Lower-Impact Logger
- Low Latency Using Real Logic Libraries
- Agrona
- Buffers
- Lists, maps, and sets
- Queues
- Ring buffers
- Simple Binary Encoding
- Copy-free and native type mapping
- Steady-state allocation
- Streaming access and word-aligned access
- Working with SBE
- Aeron
- Why build something new?
- Publishers
- Subscribers
- The Design of Aeron
- Transport requirements
- Latency and application principles
- How it works under the hood
- Agrona
- Summary
- Logging
- 15. Java 9 and the Future
- Small Performance Enhancements in Java 9
- Segmented Code Cache
- Compact Strings
- New String Concatenation
- C2 Compiler Improvements
- New Version of G1
- Java 10 and Future Versions
- New Release Process
- Java 10
- Unsafe in Java 9 and Beyond
- VarHandles in Java 9
- Project Valhalla and Value Types
- Graal and Truffle
- Future Directions in Bytecode
- Future Directions in Concurrency
- Conclusion
- Small Performance Enhancements in Java 9
- Index