# Deployment Maintenance Guide

# Performance Tuning

This chapter details the process of tuning application servers and standalone AquaLogic User Interaction products to the needs of your AquaLogic User Interaction deployment.

The standalone AquaLogic User Interaction products are:

- AquaLogic Interaction Analytics
- AquaLogic Interaction Automation Server
- AquaLogic Interaction Collaboration
- AquaLogic Interaction Document Repository
- AquaLogic Interaction Notification
- AquaLogic Interaction PTUpload
- AquaLogic Interaction Publisher
- AquaLogic Interaction Studio
- AquaLogic Interaction Workflow

## Tuning a Java Application Server or Standalone AquaLogic User Interaction Product

For Java application servers and standalone AquaLogic User Interaction products, tuning is a matter of adjusting various Java Virtual Machine (JVM) settings to optimize garbage collection. Sun provides a comprehensive document on this subject, Tuning Garbage Collection with the 1.4.2 Java[tm] Virtual Machine, which you can find at http://java.sun.com/docs/hotspot/gc1.4.2/.

The following provides a brief background on the garbage collection process and a detailed, AquaLogic User Interaction focused process for tuning JVM garbage collection.

### Garbage Collection Concepts

Garbage collection is the process the JVM undergoes to remove unused objects from memory. The following description of the garbage collection process is simplified for the purpose of this guide.

The JVM stores objects in two sections of the heap: the young generation and the tenured generation. The young generation is where objects are first created and provides the quickest, least CPU intensive access to objects. When the young generation fills, older active objects are transfered to the larger tenured generation. Objects in the tenured generation are more CPU intensive to access than those in the young generation.

The JVM undertakes two types of garbage collection. The minor collection runs when the young generation fills. It clears garbage objects and copies surviving objects to the tenured generation. The major collection runs when the tenured generation fills. The minor collection is signficantly less CPU-intensive than the major collection.

### Garbage Collection Logs

In order to analyze garbage collection impact on application server performance, a garbage collection log needs to be collected. The process is:

1. Enable garbage collection logging in the JVM. This is done in different places for each of the supported application servers and standalone AquaLogic User Interaction products. For details on enabling garbage collection logging, see Java Virtual Machine Configuration.
2. Restart the application service to start logging garbage collection memory usage.
3. Run the until the problem occurs. If the problem is continuous, collect approximately a 24 hours of data.

Note: | Every time the application server is restarted, the garbage collection log is overwritten. It is important to turn off automatic restarting of services, especially if you are investigating an issue that yields a server crash.

### Analyzing the Garbage Collection Log

Tagtraum industries ( http://tagtraum.com) provides a free utility, gcviewer, for analyzing garbage collection logs generated by the JVM. Load the garbage collection log into gcviewer and determine which issue is occuring based on the descriptions in Table 3-1.

Table 3-1 Garbage Collection Performance Issues
Issue | Symptoms in Garbage Collection Log | Impact of the Issue
--- | --- | ---
Insufficient total (heap) memory allocated | Memory usage trends upwards and reaches the top of the total memory allocated. | Reduces the performance or potentially crashes the AquaLogic User Interaction product.
Excessive total (heap) memory allocated | Memory usage peaks much lower than total memory allocated. | Can cause a slowdown across all applications on the server. The application server or AquaLogic User Interaction product is taking up too much of the system memory.
Insufficient young generation memory allocated | Sawtoothed memory usage. | Reduces the performance of the AquaLogic User Interaction product. This represents excessive minor garbage collector runs, which increases the number of objects in the tenured generation. Objects in the tenured generation are more resource intensive when called.

### Resolving Garbage Collection Performance Issues

Resolving the issues described in Analyzing the Garbage Collection Log is a matter of adjusting the JVM memory settings and reanalyzing the garbage collection log. Table 3-2 shows what memory settings to adjust for each issue. For details on how to adjust these settings for each supported application server and standalone AquaLogic User Interaction product, see Java Virtual Machine Configuration.

Table 3-2 Garbage Collection Performance Issue Resolution
Issue | Resolution | JVM Memory Parameter
--- | --- | ---
Insufficient total (heap) memory allocated | Increase total heap memory allocation until memory usage stays reasonably below total memory. | Increase `-Xmx`
Excessive total (heap) memory allocated | Decrease total heap memory allocation until memory usage is reasonably, but not excessively, below total memory. | Decrease `-Xmx`
Insufficient young generation memory allocated | Increase young generation memory allocation until the memory usage trend is horizontal. | Adjust `-XX:NewRatio`