Download Java Performance: The Definitive Guide PDF

TitleJava Performance: The Definitive Guide
File Size12.7 MB
Total Pages425
Table of Contents
Table of Contents
	Who Should (and Shouldn’t) Read This Book
	Conventions Used in This Book
	Using Code Examples
	Safari® Books Online
	How to Contact Us
Chapter 1. Introduction
	A Brief Outline
	Platforms and Conventions
		JVM Tuning Flags
	The Complete Performance Story
		Write Better Algorithms
		Write Less Code
		Oh Go Ahead, Prematurely Optimize
		Look Elsewhere: The Database Is Always the Bottleneck
		Optimize for the Common Case
Chapter 2. An Approach to Performance Testing
	Test a Real Application
		Common Code Examples
	Understand Throughput, Batching, and Response Time
		Elapsed Time (Batch) Measurements
		Throughput Measurements
		Response Time Tests
	Understand Variability
	Test Early, Test Often
Chapter 3. A Java Performance Toolbox
	Operating System Tools and Analysis
		CPU Usage
		The CPU Run Queue
		Disk Usage
		Network Usage
	Java Monitoring Tools
		Basic VM Information
		Thread Information
		Class Information
		Live GC Analysis
		Heap Dump Postprocessing
	Profiling Tools
		Sampling Profilers
		Instrumented Profilers
		Blocking Methods and Thread Timelines
		Native Profilers
	Java Mission Control
		Java Flight Recorder
		Enabling JFR
		Selecting JFR Events
Chapter 4. Working with the JIT Compiler
	Just-in-Time Compilers: An Overview
		Hot Spot Compilation
	Basic Tunings: Client or Server (or Both)
		Optimizing Startup
		Optimizing Batch Operations
		Optimizing Long-Running Applications
	Java and JIT Compiler Versions
	Intermediate Tunings for the Compiler
		Tuning the Code Cache
		Compilation Thresholds
		Inspecting the Compilation Process
	Advanced Compiler Tunings
		Compilation Threads
		Escape Analysis
		Not Entrant Code
		Deoptimizing Zombie Code
	Tiered Compilation Levels
Chapter 5. An Introduction to Garbage Collection
	Garbage Collection Overview
		Generational Garbage Collectors
		GC Algorithms
		Choosing a GC Algorithm
	Basic GC Tuning
		Sizing the Heap
		Sizing the Generations
		Sizing Permgen and Metaspace
		Controlling Parallelism
		Adaptive Sizing
	GC Tools
Chapter 6. Garbage Collection Algorithms
	Understanding the Throughput Collector
		Adaptive and Static Heap Size Tuning
	Understanding the CMS Collector
		Tuning to Solve Concurrent Mode Failures
		Tuning CMS for Permgen
		Incremental CMS
	Understanding the G1 Collector
		Tuning G1
	Advanced Tunings
		Tenuring and Survivor Spaces
		Allocating Large Objects
		Full Control Over Heap Size
Chapter 7. Heap Memory Best Practices
	Heap Analysis
		Heap Histograms
		Heap Dumps
		Out of Memory Errors
	Using Less Memory
		Reducing Object Size
		Lazy Initialization
		Immutable and Canonical Objects
		String Interning
	Object Lifecycle Management
		Object Reuse
		Weak, Soft, and Other References
Chapter 8. Native Memory Best Practices
		Measuring Footprint
		Minimizing Footprint
		Native NIO Buffers
		Native Memory Tracking
	JVM Tunings for the Operating System
		Large Pages
		Compressed oops
Chapter 9. Threading and Synchronization Performance
	Thread Pools and ThreadPoolExecutors
		Setting the Maximum Number of Threads
		Setting the Minimum Number of Threads
		Thread Pool Task Sizes
		Sizing a ThreadPoolExecutor
	The ForkJoinPool
		Automatic Parallelization
	Thread Synchronization
		Costs of Synchronization
		Avoiding Synchronization
		False Sharing
	JVM Thread Tunings
		Tuning Thread Stack Sizes
		Biased Locking
		Lock Spinning
		Thread Priorities
	Monitoring Threads and Locks
		Thread Visibility
		Blocked Thread Visibility
Chapter 10. Java Enterprise Edition Performance
	Basic Web Container Performance
		HTTP Session State
	Thread Pools
	Enterprise Java Session Beans
		Tuning EJB Pools
		Tuning EJB Caches
		Local and Remote Instances
	XML and JSON Processing
		Data Size
		An Overview of Parsing and Marshalling
		Choosing a Parser
		XML Validation
		Document Models
		Java Object Models
	Object Serialization
		Transient Fields
		Overriding Default Serialization
		Compressing Serialized Data
		Keeping Track of Duplicate Objects
	Java EE Networking APIs
		Sizing Data Transfers
Chapter 11. Database Performance Best Practices
		JDBC Drivers
		Prepared Statements and Statement Pooling
		JDBC Connection Pools
		Result Set Processing
		Transaction Handling
		Optimizing JPA Writes
		Optimizing JPA Reads
		JPA Caching
		JPA Read-Only Entities
Chapter 12. Java SE API Tips
	Buffered I/O
	Random Numbers
	Java Native Interface
	String Performance
	Java Collections API
		Synchronized Versus Unsynchronized
		Collection Sizing
		Collections and Memory Efficiency
		Alternate Implementations
		Miscellaneous Flags
	Lambdas and Anonymous Classes
		Lambda and Anonymous Classloading
	Stream and Filter Performance
		Lazy Traversal
Appendix A. Summary of Tuning Flags
About the Author

Similer Documents