Java Performance: The Definitive Guide

Java Performance: The Definitive Guide
Java Performance: The Definitive Guide

BookInfo

ISBN: 9781449358457Number of Pages: 426 
Publisher: O’reilly, IncorporatedBook Title: Java Performance: the Definitive Guide : Getting the Most Out of Your CODE
Publication Year: 2014Target Audience: Scholarly & Professional
Author: Scott OaksFormat: Trade Paperback

Abstract

There are many books about Java on the market, but not many focus on Java performance, and few can easily show the difficulties of Java performance optimization. Java Performance: The Definitive Guide , The Oreilly Java Performance is one of them.

By using the JVM and Java platform, as well as the Java language and application program interface, Java Performance: The Definitive Guide explains in detail the relevant knowledge of Java performance tuning, helps readers to understand all aspects of the performance of the Java platform, and finally makes the program more powerful.

By reading this book, you can:

  • Use four basic principles to maximize the effect of performance testing
  • Collect performance data of Java applications using the tools included in JDK
  • Understand the advantages and disadvantages of JIT compiler
  • Tune JVM garbage collector to reduce program impact
  • Learn how to manage heap memory and JVM native memory
  • Learn how to maximize the performance of Java threads and synchronization
  • Solve the performance problems of Java EE and Java se application program interfaces
  • Improve the performance of Java driven database applications

About the Author

Scott Oaks is an architect of Oracle, focusing on the performance of Oracle middleware software. Before joining Oracle, he worked for Sun Microsystems for many years and made achievements in many technical fields, including the kernel of SunOS, network program design, RPC of Windows and Open Look Virtual Window manager. In 1996, Scott became a Java evangelist of Sun and joined the Java performance group of Sun in 2001. Since then, he has been focusing on Java performance improvement. In addition, Scott has published many books in O’Reilly press, including Java Security, Java Threads, JXTA in a Nutshell and Jini in a Nutshell.

Java Performance: The Definitive Guide PDF version is avaliable Later ,Please come back soon.

Table of Contents

Preface
Who Should (and Shouldn’t) Read This Book
Conventions Used in This Book
Using Code Examples
Safari® Books Online
How to Contact Us
Acknowledgments

  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
    Summary
  2. An Approach to Performance Testing
    Test a Real Application
    Microbenchmarks
    Microbenchmarks must use their results
    Microbenchmarks must not include extraneous operations
    Microbenchmarks must measure the correct input
    Macrobenchmarks
    Mesobenchmarks
    Common Code Examples
    Understand Throughput, Batching, and Response Time
    Elapsed Time (Batch) Measurements
    Throughput Measurements
    Response Time Tests
    Understand Variability
    Test Early, Test Often
    Summary
  3. A Java Performance Toolbox
    Operating System Tools and Analysis
    CPU Usage
    Java and single-CPU usage
    Java and multi-CPU usage
    The CPU Run Queue
    Disk Usage
    Network Usage
    Java Monitoring Tools
    Basic VM Information
    Working with tuning flags
    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
    JFR overview
    JFR Memory view
    JFR Code view
    Overview of JFR events
    Enabling JFR
    Enabling JFR via Java Mission Control
    Enabling JFR via the command line
    Selecting JFR Events
    Summary
  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
    Inlining
    Escape Analysis
    Deoptimization
    Not Entrant Code
    Deoptimizing Zombie Code
    Tiered Compilation Levels
    Summary
  5. An Introduction to Garbage Collection
    Garbage Collection Overview
    Generational Garbage Collectors
    GC Algorithms
    The serial garbage collector
    The throughput collector
    The CMS collector
    The G1 collector
    Choosing a GC Algorithm
    GC algorithms and batch jobs
    GC algorithms and throughput tests
    GC algorithms and response time tests
    Choosing between CMS and G1
    Basic GC Tuning
    Sizing the Heap
    Sizing the Generations
    Sizing Permgen and Metaspace
    Controlling Parallelism
    Adaptive Sizing
    GC Tools
    Summary
  6. Garbage Collection Algorithms
    Understanding the Throughput Collector
    Adaptive and Static Heap Size Tuning
    Understanding the CMS Collector
    Tuning to Solve Concurrent Mode Failures
    Running the background thread more often
    Adjusting the CMS background threads
    Tuning CMS for Permgen
    Incremental CMS
    Understanding the G1 Collector
    Tuning G1
    Tuning the G1 background threads
    Tuning G1 to run more (or less) frequently
    Tuning G1 mixed GC cycles
    Advanced Tunings
    Tenuring and Survivor Spaces
    Allocating Large Objects
    Thread-local allocation buffers
    Sizing TLABs
    Humongous objects
    G1 region sizes
    G1 allocation of humongous objects
    AggressiveHeap
    Full Control Over Heap Size
    Summary
  7. Heap Memory Best Practices
    Heap Analysis
    Heap Histograms
    Heap Dumps
    Out of Memory Errors
    Out of native memory
    Out of permgen or metaspace memory
    Out of heap memory
    GC overhead limit reached
    Using Less Memory
    Reducing Object Size
    Lazy Initialization
    Eager deinitialization
    Immutable and Canonical Objects
    Creating canonical objects
    String Interning
    Object Lifecycle Management
    Object Reuse
    Object pools
    Thread-local variables
    Weak, Soft, and Other References
    Soft references
    Weak references
    Finalizers and final references
    Summary
  8. Native Memory Best Practices
    Footprint
    Measuring Footprint
    Minimizing Footprint
    Native NIO Buffers
    Native Memory Tracking
    NMT over time
    JVM Tunings for the Operating System
    Large Pages
    Linux huge (large) pages
    Linux transparent huge pages
    Windows large pages
    Large page sizes
    Compressed oops
    Summary
  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
    Synchronization and scalability
    Costs of locking objects
    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
    Blocked threads and JFR
    Blocked threads and JStack
    Summary
  10. Java Enterprise Edition Performance
    Basic Web Container Performance
    HTTP Session State
    HTTP session state memory
    Highly available 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
    Pull parsers
    Push parsers (SAX)
    Alternate parsing implementations and parser factories
    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
    Summary
  11. Database Performance Best Practices
    JDBC
    JDBC Drivers
    Where work is performed
    The JDBC driver type
    Prepared Statements and Statement Pooling
    Setting up the statement pool
    Managing statement pools
    JDBC Connection Pools
    Transactions
    JDBC transaction control
    Transaction isolation and locking
    Result Set Processing
    JPA
    Transaction Handling
    Optimizing JPA Writes
    Optimizing JPA Reads
    Reading less data
    Using JOIN in queries
    Batching and queries
    JPA Caching
    Default caching (lazy loading)
    Caching and eager loading
    Join fetch and caching
    Avoiding queries
    Sizing the JPA cache
    JPA Read-Only Entities
    Summary
  12. Java SE API Tips
    Buffered I/O
    Classloading
    Random Numbers
    Java Native Interface
    Exceptions
    String Performance
    Logging
    Java Collections API
    Synchronized Versus Unsynchronized
    Collection Sizing
    Collections and Memory Efficiency
    AggressiveOpts
    Alternate Implementations
    Miscellaneous Flags
    Lambdas and Anonymous Classes
    Lambda and Anonymous Classloading
    Stream and Filter Performance
    Lazy Traversal
    Summary

1 thought on “Java Performance: The Definitive Guide

Comments are closed.