Java EE 7 Performance Tuning and Optimization

Java EE 7 Performance Tuning and Optimization
eBook: $29.99
Formats: PDF, PacktLib, ePub and Mobi formats
save 15%!
Print + free eBook + free PacktLib access to the book: $79.98    Print cover: $49.99
save 6%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Table of Contents
Sample Chapters
  • Learn to plan a performance investigation in enterprise applications
  • Build a performance troubleshooting strategy
  • Design and implement high performing Java enterprise applications

Book Details

Language : English
Paperback : 478 pages [ 235mm x 191mm ]
Release Date : June 2014
ISBN : 178217642X
ISBN 13 : 9781782176428
Author(s) : Osama Oransa
Topics and Technologies : All Books, Enterprise Products and Platforms, Enterprise

Table of Contents

Chapter 1: Getting Started with Performance Tuning
Chapter 2: Understanding Java Fundamentals
Chapter 3: Getting Familiar with Performance Testing
Chapter 4: Monitoring Java Applications
Chapter 5: Recognizing Common Performance Issues
Chapter 6: CPU Time Profiling
Chapter 7: Thread Profiling
Chapter 8: Memory Profiling
Chapter 9: Tuning an Application's Environment
Chapter 10: Designing High-performance Enterprise Applications
Chapter 11: Performance Tuning Tips
Chapter 12: Tuning a Sample Application
  • Chapter 1: Getting Started with Performance Tuning
    • Understanding the art of performance tuning
    • Understanding performance issues
      • Classifying performance issues by the discovery phase
        • Requirement phase and design-time issues
        • Development-time issues
        • Testing-time issues
        • Production-time issues
      • Classifying performance issues by the root phase
        • Requirement phase issues
        • Design/architecture phase issues
        • Development phase issues
        • Testing phase issues
        • Operational and environmental-specific issues
      • Performance-handling tactics
      • Proactive measures (preventive)
      • Reactive measures (curative)
        • Understanding the different layers of an enterprise application
        • The three pillars required for performance tuning
      • The cycle of learning
      • Tuning yourself before tuning the application
        • Be a true leader
        • Use your power
        • Be responsible
        • Trust your team
        • Keep it simple
        • Respect roles and responsibilities
        • Understand the application domain and context
        • Protect your reputation
    • Standalone applications versus web applications
      • The standalone application
      • Thick client application – client-server model
      • Thin client application – web-based model
    • Dealing with web applications' performance tuning
      • The two dimensions of web applications' performance tuning
        • Horizontal dimension (node-to-node)
        • Vertical dimension (intranode)
      • Exploring vertical dimension nodes in horizontal dimension nodes
        • Client side
        • Network components
        • HTTP servers (web servers)
        • Application servers
        • Database servers
        • Middleware integration servers
        • Operating system and hardware
        • CPU utilization
        • Network traffic
        • Memory usage
        • Storage I/O performance
    • Summary
  • Chapter 2: Understanding Java Fundamentals
    • Discussing the new Java EE 7 features
      • Bean Validation 1.1 (JSR 349)
      • Java API for JSON processing – JSON-P 1.0 (JSR 353)
      • Java API for RESTful web services – JAX-RS 2.0 (JSR 339)
      • Java Servlet 3.1 (JSR 340)
      • Context and Dependency Injection – CDI 1.1 (JSR 346)
      • Interceptors 1.2 (JSR 318)
      • Enterprise JavaBeans – EJB 3.2 (JSR 345)
      • Java Message Service – JMS 2.0 (JSR 343)
      • Concurrency Utilities 1.0 (JSR 236)
      • Batch Applications 1.0 (JSR 352)
      • Java Persistence APIs – JPA 2.1 (JSR 338)
      • JavaServer Faces – JSF 2.2 (JSR 344)
      • Expression language 3.0 (JSR 341)
      • Java Transaction APIs – JTA 1.2 (JSR 907)
      • Java API for WebSocket 1.0 (JSR 356)
    • Understanding memory structure in the JVM
      • The JVM specifications
        • Heap area
        • Method area and runtime constant pool
        • JVM stack
        • Native method stacks (C stacks)
        • PC registers
      • Memory structure in the Java HotSpot virtual machine
        • Generational memory structure
        • The Java HotSpot virtual machine generations
    • Understanding the Java garbage collection policies
      • Different GC options
        • Concurrent versus stop-the-world
        • Serial versus parallel collector
        • Compacting versus non-compacting
        • The Garbage-first collector – G1
    • Different application scopes
    • Understanding concurrency in Java
      • Process versus thread
      • Exploring an object monitor
    • Using the Java concurrency utilities
      • Creating a thread pool
      • Using explicit locking with the Lock interface
      • Concurrent resources and utilities
        • The ManagedExecutorService class
        • The ManagedScheduledExecutorService class
        • The ManagedThreadFactory class
    • The important Java EE concurrency features
      • The SingleThreadModel interface
      • Asynchronous servlet and filter
      • The new Java EE non-blocking I/O APIs
      • Session beans asynchronous method invocation
      • A singleton session bean
      • Sending asynchronous JMS messages
    • More information about Java EE 7
    • Summary
  • Chapter 3: Getting Familiar with Performance Testing
    • Dissecting performance testing
      • Exploring performance testing aspects
        • Selecting the performance test environment
        • Project milestones and performance
        • Defining different rules and responsibilities
        • Performance testing types
        • Performance testing components
        • Performance testing tools
        • Performance benchmarking and baseline
        • Isolation testing
        • Performance fixing cycle
        • When to stop tuning?
    • Performance testing terminologies
    • Performance testing in a cloud environment
    • Starting with Apache JMeter
      • Different components of the JMeter test plan
        • The execution order of components
    • Testing with JMeter
      • Using JMeter to test web services
        • Creating a thread group
        • Creating the SOAP sampler
        • Creating listeners
      • Using JMeter to test a web application
        • Recording our testing scenarios
      • Using JMeter to test database scripts
        • Configuring the JDBC connection
        • Adding a JDBC request sampler
        • Adding a CSV dataset configuration
        • Adding listeners to capture test results
    • Summary
  • Chapter 4: Monitoring Java Applications
    • Exploring the Java monitoring tools
      • The operating system monitoring tools
        • The Microsoft Windows tools
        • The Unix/Linux tools
      • The Java monitoring tools
        • The JDK monitoring tools
        • The monitoring tools for application servers
        • The IDE monitoring tools
        • The standalone monitoring tools
        • The multifunction monitoring tools
    • Understanding the profiling tools
      • Profilers modes
      • JVM TI
      • Profiler agent
        • The command-line options
        • Agent start-up
      • Different profiling patterns
        • What we need to know from this section
    • Understanding the different JDK tools
      • The monitoring tool for Java virtual machine statistics
      • The JVM memory map tool
      • The Java heap analysis tool
      • The Java monitoring and management console tool
      • Java VisualVM
      • Oracle Java Mission Control
    • Starting with the NetBeans profiler
      • The NetBeans profiler calibration
      • Using the NetBeans profiler
    • The Eclipse tools/plugins
      • The JVM monitor
      • The Test and Performance Tools Platform
    • Advanced profiler – JProfiler
    • Using the offline profiling mode
      • Building our script using JProfiler triggers
      • Further reading
    • Summary
  • Chapter 5: Recognizing Common Performance Issues
    • Going through a slow response time umbrella
      • Isolating the issue
        • Client side
        • HTTP server side (web servers)
        • Application server issue
        • Database server issue
        • Integrated systems
        • Networking components
        • Code and script analysis
        • Profiling the application
      • Common performance issues
        • Threading performance issues
        • Memory performance issues
        • Algorithmic performance issues
        • Work as designed performance issues
        • Interfacing performance issues
        • Miscellaneous performance issues
        • Fake performance issues
    • Threading performance issues
      • Blocking threads
        • Performance symptoms
        • An example of thread blocking
      • Thread deadlock
    • Memory performance issues
      • Memory leakage
        • Performance symptoms
        • An example of memory leakage
      • Improper data caching
        • Improper caching issue types
        • Performance symptoms
        • An example of improper caching techniques
    • Work as designed performance issues
      • Synchronous where asynchronous is required
        • Performance symptoms
        • An example of improper synchronous code
      • Neglecting remoteness
        • Performance symptoms
        • An example of using remote calls as local calls
      • Excessive serialization performance impact
        • Performance symptoms
        • An example of excessive serialization
    • Selected performance issues
      • Unnecessary application logic
      • Excessive application logging
      • Database performance issues
      • Missing proactive tuning
    • Client-side performance issues
      • Chrome developer tools
        • Network analysis
        • JavaScript profiling
        • Speed Tracer
      • Internet Explorer developer tools
      • Firefox developer tools
      • Navigating time specifications
    • Summary
  • Chapter 6: CPU Time Profiling
    • When to use CPU profiling
    • Different CPU profiling options
      • Using a NetBeans profiler
        • Profiling a Java application
        • Profiling a web application
      • Using Java Mission Control (JMC)
      • Using JProfiler
    • Reading and interpreting CPU profiling results
      • The call tree view
      • The HotSpots view
    • Analyzing the method time versus the method invocation count
      • The HotSpot method types
        • Methods with high self-time
        • Methods with high invocation events
        • Methods with high self-time and invocation events
      • Identifying a HotSpot type
    • Identifying potential performance issues
      • Algorithmic/logic issues
      • Caching issues
      • Resourcing issues
      • Threading issues
    • Fixing algorithmic/logic performance
      • Simple algorithmic evaluation
      • Evaluating an algorithm's complexity
    • Our first performance fixing strategy
      • Fixing the application logic/algorithm
      • Adding support for caching
      • Optimizing the performance of resources
      • Implementing concurrency or multithreading
      • Using asynchronous methods
    • Summary
  • Chapter 7: Thread Profiling
    • Determining when to use thread profiling
    • Exploring the different thread profiling options
      • Thread monitoring using NetBeans
      • Thread monitoring using JProfiler
      • Thread monitoring using Java Mission Control
    • Reading the thread profiling results
    • Dealing with thread dumps
      • Taking a thread dump using the operating system commands
        • Using the keyboard shortcut Ctrl + Pause Break
        • Sending SIGQUIT to the Java process
      • Taking a thread dump using the JDK tools
        • Thread dump using jstack
        • Thread dump using the Java VisualVM
      • Taking thread dumps using an application's server admin console/tools
      • Taking a thread dump using profiler tools
    • Reading and analyzing the thread dumps
      • Understanding the thread dump structure
      • Analyzing the thread dumps
      • Using Thread Dump Analyzer
    • Exploring potential threading issues
      • Threading performance issues
        • Threading deadlock
        • Blocked/starving/stuck threads
        • Low/over threading
        • Threading memory issues
        • Using unmanaged threads
      • Detecting the root cause of a hung application
        • Detecting the hang location using thread dumps
        • Detecting the hang location using profilers
    • Enhancing our fixing strategy
      • Fixing thread deadlocks and thread blocking
    • Summary
  • Chapter 8: Memory Profiling
    • When to use memory profiling?
    • Different memory profiling options
      • Memory profiling using NetBeans
      • Memory profiling using JProfiler
    • Analyzing memory profiling results
      • Analyzing memory space graphs
      • Analyzing detailed object statistics
      • Analyzing garbage collection activity logs (HotSpot JVM)
        • Reading garbage collection activity logs (HotSpot VM)
        • Visualizing the garbage collection activity
    • Dealing with memory heap dumps
      • Taking heap dumps on the occurrence of JVM OutOfMemoryError
      • Taking heap dumps using the JDK tools
        • Taking heaps dump using jmap
        • Taking heap dumps using Java VisualVM
        • Taking heap dumps using the JRockit command utility
      • Taking heap dumps using the profiler tools
        • Taking heap dumps using the NetBeans profiler
        • Taking heap dumps using Eclipse Memory Analyzer Tool (MAT)
        • Taking heap dumps using JProfiler
    • Analyzing the heap dump
      • Navigating inside a heap dump using visual tools
      • Query heap dumps using OQL
        • Using simple OQL queries
        • Using OQL built-in objects and functions
    • Potential memory performance issues
      • Application memory leakage (session leakage versus global leakage)
      • Improper caching implementation
      • Memory issues of objects that contain the finalize() method
      • Invalid contract for the equals() and hashCode() methods
      • Different reasons for OOME
    • Adding memory performance issues to our fixing strategy
      • Fixing memory leakage issues
    • Summary
  • Chapter 9: Tuning an Application's Environment
    • Understanding environment tuning
    • Tuning the JVM
      • Tuning the Java HotSpot virtual machine
        • Understanding the different types of the JVM parameters
        • Selecting the HotSpot JVM type
        • Tuning memory size
        • Tuning garbage collection
      • Tuning the JRockit virtual machine
        • Tuning JRockit memory size
        • Tuning JRockit garbage collection
    • Tuning application servers
      • Tuning the Oracle GlassFish application server
        • Deployment tuning options
        • Web container tuning options
        • EJB container tuning options
        • Thread pool tuning options
        • JDBC connection pool tuning options
        • Tuning file cache components
        • Tuning DNS caching
        • Tuning logging information
      • Tuning the Oracle Weblogic application server
        • Tuning the internal applications' deployment
        • Tuning network components
        • Tuning stuck thread configuration
    • Tuning web servers (HTTP servers)
      • Tuning the Apache web server (Apache HTTP server)
      • Tuning the Oracle web server (Oracle HTTP server)
    • Tuning the operating system and hardware
      • Optimizing capacity planning and hardware
      • Optimizing operating system configurations
    • Summary
  • Chapter 10: Designing High-performance Enterprise Applications
    • Potential performance impact of different design decisions
      • Potential performance impact of the application layer's decisions
      • Potential performance impact of a component's selection decisions
      • Potential performance impact of integration decisions
      • Potential performance impact of security decisions
      • Potential performance impact of framework and UI decisions
      • Potential performance impact of application interaction decisions
      • Potential performance impact of regulatory decisions
      • Potential performance impact of some miscellaneous decisions
    • Avoiding performance anti-patterns
    • Performance aspects of Service Oriented Architecture (SOA)
    • Performance aspects of Resource Oriented Architecture (ROA)
    • Dissecting performance aspects of data caching
      • Data caching versus no caching
      • Caching concurrency and performance
      • Different levels of application data caching
      • Caching an invalidation/expiration algorithm
      • Caching data store interaction
      • Caching replacement policies
      • Data caching performance evaluation
    • Performance considerations in cloud deployment
    • Summary
  • Chapter 11: Performance Tuning Tips
    • Performance and development processes
      • Agile and performance
      • Performance and test-driven development (TDD)
      • Manual and automated code review
    • Java EE performance tuning tips
      • Web service (WS) performance tuning tips
      • EJB performance tuning tips
      • Servlets and JSP performance tuning tips
      • JSF performance tuning tips
      • JPA performance tuning tips
    • Java performance tuning tips
      • String manipulation performance tuning tips
        • String creation tips
        • String concatenation tips
        • The JVM String tuning parameters
      • Java collections and performance
      • Using synchronized blocks
      • The I/O operations and performance
      • Exception handling and performance
      • Application logging and performance
    • Using the javap tool to understand micro-optimizations
    • Database performance tuning tips
    • Client-side optimization
    • Summary
  • Chapter 12: Tuning a Sample Application
    • Reaching our final destination
    • Setting up the ExcellentSurvey application
    • Functional overview of the ExcellentSurvey application
    • ExcellentSurvey performance assessment
    • Performance investigation plan
    • Profiling our ExcellentSurvey application
      • Getting CPU profiling results
      • Getting memory and thread profiling results
      • Getting database CPU profiling results
    • Profiling performance findings
      • Detected HotSpot methods
      • Detected HotSpot database statements
      • Potential wrong logic issues
    • ExcellentSurvey issues and possible resolutions
      • Fixing the EmailSender.sendEmail() HotSpot method
      • Fixing the DAOHelper.createNewSurvey() HotSpot method
      • Fixing the LoginFilter.log() HotSpot method
      • Fixing the HotSpot autogen table update statement
      • Fixing HotSpot statements to insert questions and survey questions
      • Fixing HotSpot queries that get the notification templates/question rating types
      • Fixing the HotSpot query that counts user surveys
    • Performance code review
    • Testing the application after our fixes
    • Result and conclusion
    • Summary

Osama Oransa

Osama Oransa is an IT solution architect with more than 12 years of solid technical experience in Java EE. He is a certified Java enterprise architect and an SME in web services technology. He has worked for most of the key players in the IT industry, such as IBM, Oracle, and Hewlett Packard. He previously worked as a performance consultant at DevFactory, and he is currently working with the Vodafone Group as a solution architect. He has also participated in establishing Pulse Corp as a medical software services company in Egypt.

He has a diploma in IT from the Information Technology Institute (ITI) and a diploma in CS from the Arab Academy for Science, Technology and Maritime Transport (AASTM). He is currently working towards a Master's degree in CS. Being from Cairo, he is a frequent speaker at the Java Developer Conference (JDC) in Cairo.

In 2010, one of his projects in Pulse Corp, "Health Intact", won Oracle Duke's Choice Award. He is the founder of more than 12 open source projects hosted on SourceForge. He has also been selected by Oracle for the future of the Java campaign for his valuable contribution to the industry.

He is a volunteer Java technology evangelist who gives technical sessions at different companies, conferences, and on blogs. His technical blog can be found at

Sorry, we don't have any reviews for this title yet.

Code Downloads

Download the code and support files for this book.

Submit Errata

Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.

Sample chapters

You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

Frequently bought together

Java EE 7 Performance Tuning and Optimization +    Haskell Data Analysis Cookbook =
50% Off
the second eBook
Price for both: $43.05

Buy both these recommended eBooks together and get 50% off the cheapest eBook.

What you will learn from this book

  • Master the art of performance tuning and become a performance tuning expert
  • Create and execute enterprise performance tests
  • Understand the fundamentals of Java needed for performance tuning
  • Use a number of profiling tools to diagnose common performance issues
  • Understand the basic aspects of the Java virtual machine and application server performance tuning
  • Design guidelines for better enterprise application performance
  • Discover different Java optimization tips and tricks
  • Tune a real-world sample application

In Detail

With the expansion of online enterprise services, the performance of an enterprise application has become a critical issue. Even the smallest change to service availability can severely impact customer satisfaction, which can cause the enterprise to incur huge losses. Performance tuning is a challenging topic that focuses on resolving tough performance issues.

In this book, you will explore the art of performance tuning from all perspectives using a variety of common tools, while studying many examples.

This book covers performance tuning in Java enterprise applications and their optimization in a simple, step-by-step manner. Beginning with the essential concepts of Java, the book covers performance tuning as an art. It then gives you an overview of performance testing and different monitoring tools. It also includes examples of using plenty of tools, both free and paid.


The book adopts a step-by-step approach, starting from building the basics and adding to it gradually by using different tools and examples. The book sequence is easy to follow and all topics are fully illustrated showing you how to make good use of different performance diagnostic tools.

Who this book is for

If you are an experienced Java developer, architect, team leader, consultant, support engineer, or anyone else who needs performance tuning in your Java applications, and in particular, Java enterprise applications, this book is for you. No prior experience of performance tuning is required.

Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software