Sun GlassFish Enterprise Server v2.1.1 Performance Tuning Guide

General Tuning Concepts

Some key concepts that affect performance tuning are:

The following table describes these concepts, and how they are measured in practice. The left most column describes the general concept, the second column gives the practical ramifications of the concept, the third column describes the measurements, and the right most column describes the value sources.

Table 1–2 Factors That Affect Performance


In practice 


Value sources 

User Load

Concurrent sessions at peak load 

Transactions Per Minute (TPM) 

Web Interactions Per Second (WIPS) 

(Max. number of concurrent users) * (expected response time) / (time between clicks) 


(100 users * 2 sec) / 10 sec = 20 

Application Scalability

Transaction rate measured on one CPU 


Measured from workload benchmark. Perform at each tier. 

Vertical scalability 

Increase in performance from additional CPUs 

Percentage gain per additional CPU 

Based on curve fitting from benchmark. Perform tests while gradually increasing the number of CPUs. Identify the “knee” of the curve, where additional CPUs are providing uneconomical gains in performance. Requires tuning as described in this guide. Perform at each tier and iterate if necessary. Stop here if this meets performance requirements. 

Horizontal scalability 

Increase in performance from additional servers 

Percentage gain per additional server process and/or hardware node. 

Use a well-tuned single application server instance, as in previous step. Measure how much each additional server instance and hardware node improves performance. 

Safety Margins

High availability requirements 

If the system must cope with failures, size the system to meet performance requirements assuming that one or more application server instances are non functional 

Different equations used if high availability is required. 


Excess capacity for unexpected peaks 

It is desirable to operate a server at less than its benchmarked peak, for some safety margin 

80% system capacity utilization at peak loads may work for most installations. Measure your deployment under real and simulated peak loads. 

Capacity Planning

The previous discussion guides you towards defining a deployment architecture. However, you determine the actual size of the deployment by a process called capacity planning. Capacity planning enables you to predict:

You can estimate these values through careful performance benchmarking, using an application with realistic data sets and workloads.

ProcedureTo Determine Capacity

  1. Determine performance on a single CPU.

    First determine the largest load that a single processor can sustain. You can obtain this figure by measuring the performance of the application on a single-processor machine. Either leverage the performance numbers of an existing application with similar processing characteristics or, ideally, use the actual application and workload in a testing environment. Make sure that the application and data resources are tiered exactly as they would be in the final deployment.

  2. Determine vertical scalability.

    Determine how much additional performance you gain when you add processors. That is, you are indirectly measuring the amount of shared resource contention that occurs on the server for a specific workload. Either obtain this information based on additional load testing of the application on a multiprocessor system, or leverage existing information from a similar application that has already been load tested.

    Running a series of performance tests on one to eight CPUs, in incremental steps, generally provides a sense of the vertical scalability characteristics of the system. Be sure to properly tune the application, Application Server, backend database resources, and operating system so that they do not skew the results.

  3. Determine horizontal scalability.

    If sufficiently powerful hardware resources are available, a single hardware node may meet the performance requirements. However for better availability, you can cluster two or more systems. Employing external load balancers and workload simulation, determine the performance benefits of replicating one well-tuned application server node, as determined in step (2).

User Expectations

Application end-users generally have some performance expectations. Often you can numerically quantify them. To ensure that customer needs are met, you must understand these expectations clearly, and use them in capacity planning.

Consider the following questions regarding performance expectations: