![]()
WildFly Performance Tuning
Table of Contents
WildFly Performance Tuning
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Errata
Piracy
Questions
1. The Science of Performance Tuning
Performance
Response time
Throughput
Utilization efficiency
Scalability
Performance tuning anti-patterns
The one-off
The wrong team
The lack of mandate
The clever developer
Software development and quality assurance
Software development with performance focus
Analysis
Design
Implementation
Performance testing and tuning
The iterative performance-tuning process
Test cases and iteration
Setting the baseline
Running tests and collecting data
Analyzing the data
Tuning and retesting
Test data
Documentation
The environment of performance tests
The software life cycle
Upgrades
Metrics
Tuning an enterprise stack
Network
Hardware
Operating System
Java Virtual Machine
Middleware
Application
Summary
2. Tools of the Tuning Trade
The key features of performance tuning
Profiling
Profiling in production
Profiling a JVM
Profiling and sampling
VisualVM
Standard features
The features of plugins
Connecting to a JVM
Local JVM
Remote JVM
On the remote host
On the monitoring host
Monitoring a JVM
Features
Test scenarios
A JMX connection to WildFly
Local or remote WildFly server
Setting up VisualVM
Connection in VisualVM
Monitoring
OS tools
Unix and Linux
Low CPU utilization
High CPU utilization
High resource contention
High disk utilization
OS X
Windows
WildFly tools
The Command-line Interface
The WildFly Management Console
JBoss DMR
JConsole
Generating load
Apache JMeter
Building a basic test plan
Improving the test plan
Recording a web session using the JMeter HTTP proxy
Standalone and distributed load generation
Summary
3. Tuning the Java Virtual Machine
JVM
JVM memory areas
The JVM stack and native stack
The heap
Other JVM memory concepts
GC
JVM memory management with the GC
Configuring the JVM
Default settings
Client versus Server VM
The stack
The heap
Setting the maximum heap size
Setting the initial heap size
Determining what maximum size the heap should be
Determining what initial size the heap should be
Setting the size of the young and old generations
Setting the size ratio of Eden and the survivor spaces
PermGen
Large objects
Large memory pages
The java.lang.OutOfMemoryError error
From the heap
From the PermGen
Too large an array
Not enough native threads
Memory leaks
A leak-finding process
A step-by-step example using VisualVM
Types of GC strategies
The serial collector
The parallel collector
The concurrent collector
The G1 collector
Which collector to use
Setting VM parameters in WildFly
Having the relevant information available
VM parameters in production
verbose:gc
PrintGCDetails
PrintTenuringDistribution
loggc
Using tools
VM and GC stability
Summary
4. Tuning WildFly
WildFly's history
WildFly's architecture
Various subsystem configurations
The thread pool executor subsystem
unbounded-queue-thread-pool
bounded-queue-thread-pool
blocking-bounded-queue-thread-pool
queueless-thread-pool
blocking-queueless-thread-pool
scheduled-thread-pool
Monitoring
The future of the thread subsystem
Java EE Connector Architecture and resource adapters
The Batch API subsystem
The Remoting subsystem
The Transactions subsystem
XA – Two Phase Commit (2PC)
Logging
Optimized logging code
Performance tuning logging in WildFly
Logging to the console
Logging to files
Using asynchronous logging to improve log throughput
Logging hierarchy and performance
Per-deployment logging
Summary
5. EJB Tuning in WildFly
The history of EJBs
The different types of EJBs
Stateless Session Beans (SLSB)
Stateful Session Beans
Singleton Session Beans
Message Driven Beans (MDB)
Performance tuning EJBs in WildFly
Enabling detailed statistics
Optimizations of Local and Remote method calls
Session beans and transactions
Remote EJB calls
Optimizing Stateless Session Beans
Tuning the SLSB pool
Optimizing Stateful Session Beans
Disabling passivation for individual SFSB
Optimizing Singleton Session Beans
Adjust lock mechanisms and time-outs
Container Managed Concurrency versus Bean Managed Concurrency
Monitoring
Optimizing Message Driven Beans
Summary
6. Tuning the Persistence Layer
Designing a good database
Database normalization and denormalization
Database partitioning
Horizontal partitioning
Vertical partitioning
Using indexes
Tuning the Java Database Connectivity API
Connection pooling
Performance tuning a connection pool in WildFly
Setting the proper fetch size
Using batch updates for bulk insert/updates
Prepared statements
Isolation levels
Tuning JDBC networking
Tuning JPA and Hibernate
Optimizing object retrieval
Transactional integrity and performance
Limiting retrieved data by pagination
Fetching parent and child objects
Combining pagination and JOIN fetches
Improving the speed of collection queries using batches
Minimizing query compilation with JPA-named queries
Improving the performance of bulk SQL statements
Entity caching
The first-level cache
The second-level cache
The query cache
Query hints
Entity versus query cache
Optimizing data synchronization
Summary
7. Tuning the Web Container in WildFly
Enter Undertow
Undertow internals
HTTP Upgrades
The default caching of static resources
Server and container topologies
Using XNIO...