Book Image

Java EE 7 Performance Tuning and Optimization

By : Osama Oransa
Book Image

Java EE 7 Performance Tuning and Optimization

By: Osama Oransa

Overview of this book

<p>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.</p> <p>In this book, you will explore the art of Java performance tuning from all perspectives using a variety of common tools, while studying many examples.</p> <p>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.</p>
Table of Contents (20 chapters)
Java EE 7 Performance Tuning and Optimization
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Identifying potential performance issues


In the previous section, we diagnosed different hot spot areas and classified them into different types (either the method's self-time or the invocation count is high, or both). Now let's describe some examples of the potential root causes of these hot spots.

Algorithmic/logic issues

When the application logic is generally the root cause of the performance issue, there can be many variants such as unnecessary loops, underperforming algorithms, repeated calculations, and no caching.

If we look at our online shopping project, ExampleTwo, we see some samples of this ineffective application logic, shown as follows:

Product[] allProducts = catalogSessionBean.loadAllActiveProductCatalogByCriteria(new SearchCriteria());
for (Product allProduct : allProducts) {
  if(allProduct.getId()==productId){
    outputStream.write(allProduct.getImage());
    outputStream.close();
    return;
  }
}

In this logic, instead of getting the product by its ID, we get all the catalog...