Book Image

WildFly Performance Tuning

Book Image

WildFly Performance Tuning

Overview of this book

Table of Contents (17 chapters)
WildFly Performance Tuning
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Tuning an enterprise stack


Tuning can be broadly divided into different categories based on the different layers of an enterprise IT environment. This environment is often called an enterprise stack and consists of the layers shown in the following diagram. We will now turn our attention to these layers one by one and discuss what tuning means and consists of in each of them, starting from the bottom:

Layers of an enterprise stack.

Network

Network tuning typically involves the configuration of various network equipment such as firewalls, routers, and network interfaces, but can also include verifying the use of the correct type of cables and connectors. This type of tuning is often initially missed during performance tuning, but in today's communication-heavy solutions, it is absolutely vital to have a network that runs smoothly and at its highest performance. Network tuning is also highly related to, and thus overlaps, hardware and OS tuning.

Hardware

Hardware tuning includes selecting the right hardware components—CPU, memory, discs, and so on—for a given system and its requirements. Shortage of memory will increase I/O operations. Slow disks might make databases and entire systems crawl.

Data encryption and other computing-heavy functions will require a relatively large amount of CPU. Often, the solution can be to just to add more or better hardware, but it is equally important that the hardware is well-balanced and plays well together.

Operating System

Operating System (OS) tuning is closely related to network and hardware tuning as it defines how the OS and hardware/network will cooperate and what restrictions will be enforced. For example, CPU time slicing, I/O behavior, and network access.

Through the OS, a lot of information can also be retrieved regarding the health of not only the OS itself, but also of the hardware and network.

Java Virtual Machine

Java Virtual Machine (JVM) tuning involves configuring the memory levels and the garbage collector of the JVM. Although modern JVMs are considerably more intelligent, effective, and advanced compared to older versions, they often still need a bit of love and application-specific tuning. Tuning a JVM can drastically improve the performance of the application that is being executed in the JVM. This tuning is, however, quite volatile as things can easily go wrong and create new bottlenecks and even worsen performance unless used in a very controlled way. More about this will be covered in detail in Chapter 3, Tuning the Java Virtual Machine.

Middleware

Middleware tuning includes adjusting various configuration parameters of the platform called middleware. This is done in order to make the platform and its services more optimized for the applications and its components that run within it. A middleware platform is often realized as an advanced application server; for example, WildFly. Others might be simpler and won't include as many services; for example, a web container like Apache Tomcat.

Some parameters and services of the middleware can be utilized by all applications, while others can be application specific. For WildFly, some configuration and services include thread pools, connection pools for EJBs, JMS (queues/topics) and databases, EJB component lifecycle management, and much more. All these configurations have default values that might be just fine, but they also might be tweaked in order to achieve magnitudes of improved performance. Middleware is arguably where most configuration-related tuning can be made in the stack, but more of this will be discussed in chapters to come.

Application

Application tuning is first and foremost achieved by making a thoughtful design and writing good, efficient code. This also involves selecting the best algorithms and libraries for your specific application. If the original design proves to be insufficient, and other tuning types won't solve the problem, the design or code might need to be redone completely or at least be improved in some way.

This can, for example, involve changing an entire platform, framework, or programming model, or it can involve just improving a specific function or pattern. It could also involve making better use of APIs or available resources. For example, by using the StringBuffer or StringBuilder classes instead of String or by improving the speed of database calls by using indexes. Application tuning, in terms of initial design and implementation of a system, is often not directly seen as tuning. However, creating a tuned application is, without a doubt, the most important type of tuning you can do. Think about it. If you make poor design decisions or write poor code, it will be really hard, if not impossible, to fix that by just tuning the hardware or JVM. It would also be quite expensive—both in terms of time and money—to make large design and code changes to a system.

As we have seen from the preceding text above and in the following diagram, tuning can be performed pretty much everywhere in the stack, and tuning in one place can and will affect things in all locations. Thus, having a broad and open-minded view about possible ripple effects of singular changes will aid you in making the best decisions.

Iterative tuning in the enterprise stack. Tuning is everywhere and everything depends on many direct and indirect relations. Here, WildFly is depicting the middleware. Also hardware- and network-tuning is included in the OS tuning.