You are previewing WildFly Performance Tuning.
O'Reilly logo
WildFly Performance Tuning

Book Description

Develop high-performing server applications using the widely successful WildFly platform

In Detail

The hugely successful JBoss Application Server has been updated and is now called WildFly. This cutting edge technology provides a free JEE-certified platform for the software of today and tomorrow. Learning to tune such a platform for optimal performance is vital for a healthy business organization, efficient development, and the smooth running of operations.

This practical book explores how to tune one of the leading open source application servers in its latest reincarnation. In this book, you will learn what performance tuning is and how it can be performed on WildFly and the JVM using solely free and open source tools and utilities.

Learn about various free tools for performance monitoring and tuning, all focused on making them work with WildFly. The tuning journey ventures through the landscape of the major JEE technologies, EJB, Servlets, JPA, JSF, and JMS. Discover best practices for the internal high-performing web container Undertow, WebServices, and REST services so that you end your journey feeling confident in tuning WildFly for optimal performance.

What You Will Learn

  • Tune and monitor an OS, a JVM, and WildFly with components and applications
  • Make various tuning tools work with WildFly
  • Configure and tune the JVM by analyzing its behavior
  • Understand numerous best practices and how-tos
  • Monitor and tune various JEE technologies within WildFly, such as EJBs, WebServices, and JSF-based applications
  • Know the ins-and-outs for getting the most out of the platform, its components, and surrounding infrastructure
  • Discover how to tune a clustered WildFly environment
  • Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

    Table of Contents

    1. WildFly Performance Tuning
      1. Table of Contents
      2. WildFly Performance Tuning
      3. Credits
      4. About the Authors
      5. About the Reviewers
      6. www.PacktPub.com
        1. Support files, eBooks, discount offers, and more
          1. Why subscribe?
          2. Free access for Packt account holders
      7. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Reader feedback
        6. Customer support
          1. Errata
          2. Piracy
          3. Questions
      8. 1. The Science of Performance Tuning
        1. Performance
          1. Response time
          2. Throughput
          3. Utilization efficiency
        2. Scalability
        3. Performance tuning anti-patterns
          1. The one-off
          2. The wrong team
          3. The lack of mandate
          4. The clever developer
        4. Software development and quality assurance
        5. Software development with performance focus
          1. Analysis
          2. Design
          3. Implementation
          4. Performance testing and tuning
        6. The iterative performance-tuning process
          1. Test cases and iteration
            1. Setting the baseline
            2. Running tests and collecting data
            3. Analyzing the data
            4. Tuning and retesting
          2. Test data
          3. Documentation
        7. The environment of performance tests
        8. The software life cycle
          1. Upgrades
          2. Metrics
        9. Tuning an enterprise stack
          1. Network
          2. Hardware
          3. Operating System
          4. Java Virtual Machine
          5. Middleware
          6. Application
        10. Summary
      9. 2. Tools of the Tuning Trade
        1. The key features of performance tuning
        2. Profiling
          1. Profiling in production
          2. Profiling a JVM
        3. Profiling and sampling
        4. VisualVM
          1. Standard features
          2. The features of plugins
          3. Connecting to a JVM
            1. Local JVM
            2. Remote JVM
              1. On the remote host
              2. On the monitoring host
          4. Monitoring a JVM
            1. Features
            2. Test scenarios
          5. A JMX connection to WildFly
            1. Local or remote WildFly server
            2. Setting up VisualVM
            3. Connection in VisualVM
        5. Monitoring
        6. OS tools
          1. Unix and Linux
            1. Low CPU utilization
            2. High CPU utilization
            3. High resource contention
            4. High disk utilization
          2. OS X
          3. Windows
        7. WildFly tools
          1. The Command-line Interface
          2. The WildFly Management Console
          3. JBoss DMR
          4. JConsole
        8. Generating load
        9. Apache JMeter
          1. Building a basic test plan
          2. Improving the test plan
          3. Recording a web session using the JMeter HTTP proxy
          4. Standalone and distributed load generation
        10. Summary
      10. 3. Tuning the Java Virtual Machine
        1. JVM
        2. JVM memory areas
          1. The JVM stack and native stack
          2. The heap
          3. Other JVM memory concepts
        3. GC
        4. JVM memory management with the GC
        5. Configuring the JVM
          1. Default settings
          2. Client versus Server VM
          3. The stack
          4. The heap
            1. Setting the maximum heap size
            2. Setting the initial heap size
            3. Determining what maximum size the heap should be
            4. Determining what initial size the heap should be
            5. Setting the size of the young and old generations
            6. Setting the size ratio of Eden and the survivor spaces
            7. PermGen
        6. Large objects
        7. Large memory pages
        8. The java.lang.OutOfMemoryError error
          1. From the heap
          2. From the PermGen
          3. Too large an array
          4. Not enough native threads
        9. Memory leaks
          1. A leak-finding process
          2. A step-by-step example using VisualVM
        10. Types of GC strategies
          1. The serial collector
          2. The parallel collector
          3. The concurrent collector
          4. The G1 collector
        11. Which collector to use
        12. Setting VM parameters in WildFly
        13. Having the relevant information available
        14. VM parameters in production
          1. verbose:gc
          2. PrintGCDetails
          3. PrintTenuringDistribution
          4. loggc
        15. Using tools
        16. VM and GC stability
        17. Summary
      11. 4. Tuning WildFly
        1. WildFly's history
        2. WildFly's architecture
        3. Various subsystem configurations
          1. The thread pool executor subsystem
            1. unbounded-queue-thread-pool
            2. bounded-queue-thread-pool
            3. blocking-bounded-queue-thread-pool
            4. queueless-thread-pool
            5. blocking-queueless-thread-pool
            6. scheduled-thread-pool
          2. Monitoring
            1. The future of the thread subsystem
          3. Java EE Connector Architecture and resource adapters
          4. The Batch API subsystem
          5. The Remoting subsystem
          6. The Transactions subsystem
            1. XA – Two Phase Commit (2PC)
        4. Logging
          1. Optimized logging code
          2. Performance tuning logging in WildFly
            1. Logging to the console
            2. Logging to files
            3. Using asynchronous logging to improve log throughput
            4. Logging hierarchy and performance
            5. Per-deployment logging
        5. Summary
      12. 5. EJB Tuning in WildFly
        1. The history of EJBs
        2. The different types of EJBs
          1. Stateless Session Beans (SLSB)
          2. Stateful Session Beans
          3. Singleton Session Beans
          4. Message Driven Beans (MDB)
        3. Performance tuning EJBs in WildFly
          1. Enabling detailed statistics
          2. Optimizations of Local and Remote method calls
          3. Session beans and transactions
          4. Remote EJB calls
          5. Optimizing Stateless Session Beans
            1. Tuning the SLSB pool
          6. Optimizing Stateful Session Beans
            1. Disabling passivation for individual SFSB
          7. Optimizing Singleton Session Beans
            1. Adjust lock mechanisms and time-outs
            2. Container Managed Concurrency versus Bean Managed Concurrency
            3. Monitoring
          8. Optimizing Message Driven Beans
        4. Summary
      13. 6. Tuning the Persistence Layer
        1. Designing a good database
          1. Database normalization and denormalization
          2. Database partitioning
            1. Horizontal partitioning
            2. Vertical partitioning
          3. Using indexes
        2. Tuning the Java Database Connectivity API
          1. Connection pooling
            1. Performance tuning a connection pool in WildFly
          2. Setting the proper fetch size
          3. Using batch updates for bulk insert/updates
          4. Prepared statements
          5. Isolation levels
          6. Tuning JDBC networking
        3. Tuning JPA and Hibernate
          1. Optimizing object retrieval
          2. Transactional integrity and performance
          3. Limiting retrieved data by pagination
          4. Fetching parent and child objects
          5. Combining pagination and JOIN fetches
          6. Improving the speed of collection queries using batches
          7. Minimizing query compilation with JPA-named queries
          8. Improving the performance of bulk SQL statements
          9. Entity caching
            1. The first-level cache
            2. The second-level cache
            3. The query cache
            4. Query hints
            5. Entity versus query cache
            6. Optimizing data synchronization
        4. Summary
      14. 7. Tuning the Web Container in WildFly
        1. Enter Undertow
          1. Undertow internals
          2. HTTP Upgrades
          3. The default caching of static resources
          4. Server and container topologies
        2. Using XNIO
          1. NIO basics
          2. XNIO Workers
        3. Tuning Undertow
          1. Worker
          2. The buffer pool
        4. Tuning the servlet container and JSP compilation
          1. Tuning hints for Jastow
        5. Using Apache as a frontend
          1. HTTP and AJP
          2. Configuration
            1. The Apache HTTPD configuration
            2. The WildFly configuration
        6. Summary
      15. 8. Tuning Web Applications and Services
        1. Web applications
          1. Choosing a web framework
          2. The evolution of web frameworks
          3. Tuning a web component – the data table
          4. Tuning servlet/JSP applications
            1. Choose the scope wisely
              1. Session timeouts
            2. JSP use of HttpSession
            3. JSP include
            4. Compression
            5. Asynchronous servlets
          5. Undertow's proprietary solutions
          6. Tuning JSF-based applications
            1. Configuring JSF state saving efficiently
              1. The state saving method in server mode
              2. The state saving method in client mode
              3. A summary of state saving method configurations
            2. The project stage
            3. JSF Immediate
            4. Using AJAX support in JSF
              1. Partial DOM updates by a component and attribute
              2. Single partial AJAX async (form) requests
              3. Filters
            5. Loading resource files efficiently
          7. WebSockets
        2. Services
          1. Web services
            1. Performance factors
          2. RESTful services
        3. Summary
      16. 9. JMS and HornetQ
        1. Introducing JMS
        2. The message and its optimizations
        3. Tuning the session
        4. Tuning MessageProducer
        5. Optimizing HornetQ
          1. Persistence storage tuning
          2. Handling large messages
          3. Optimizing paging
          4. Message deliverance optimizations
          5. Flow control
          6. Miscellaneous tips and tricks
          7. Monitoring
        6. Summary
      17. 10. WildFly Clustering
        1. Cluster
        2. Load balancing
        3. Replication
        4. Failover, failback, and session state
        5. High Availability
        6. The real need of clustering
        7. A single point of failure
        8. WildFly clustering basics
          1. JGroups
            1. Tuning UDP transport
            2. Tuning node fault detection
            3. Tuning flow control
          2. Infinispan
        9. Clustering in Java EE and WildFly
          1. Clustered EJBs
            1. MDB
            2. SLSB
            3. SFSB
            4. Load balancing
          2. Clustered Persistence (JPA) layer
          3. Clustered web applications
            1. Load balancing with mod_cluster
          4. Clustering the HornetQ messaging system
        10. Summary
      18. Index