Server User Manual
Table Of Contents
- Sun GlassFish Enterprise Server 2.1 Performance Tuning Guide
- Preface
- Overview of Enterprise Server Performance Tuning
- Tuning Your Application
- Java Programming Guidelines
- Java Server Page and Servlet Tuning
- EJB Performance Tuning
- Goals
- Monitoring EJB Components
- General Guidelines
- Using Local and Remote Interfaces
- Improving Performance of EJB Transactions
- Use Container-Managed Transactions
- Don’t Encompass User Input Time
- Identify Non-Transactional Methods
- Use TX_REQUIRED for Long Transaction Chains
- Use Lowest Cost Database Locking
- Use XA-Capable Data Sources Only When Needed
- Configure JDBC Resources as One-Phase Commit Resources
- Use the Least Expensive Transaction Attribute
- Using Special Techniques
- Tuning Tips for Specific Types of EJB Components
- JDBC and Database Access
- Tuning Message-Driven Beans
- Tuning the Enterprise Server
- Deployment Settings
- Logger Settings
- Web Container Settings
- EJB Container Settings
- Java Message Service Settings
- Transaction Service Settings
- HTTP Service Settings
- ORB Settings
- Thread Pool Settings
- Resources
- Tuning the Java Runtime System
- Tuning the Operating System and Platform
- Tuning for High-Availability
- Index

■
Decide the total amount of memory you can aord for the JVM. Accordingly, graph your
own performance metric against young generation sizes to nd the best setting.
■
Make plenty of memory available to the young generation. The default is calculated from
NewRatio and the -Xmx setting.
■
Larger eden or younger generation spaces increase the spacing between full GCs. But young
space collections could take a proportionally longer time. In general, keep the eden size
between one fourth and one third the maximum heap size. The old generation must be
larger than the new generation.
For up-to-date defaults, see
Java HotSpot VM Options.
EXAMPLE 4–1 Heap Conguration on Solaris
This is an exmple heap conguration used by Enterprise Server on Solaris for large applications:
-Xms3584m
-Xmx3584m
-verbose:gc
-Dsun.rmi.dgc.client.gcInterval=3600000
Survivor Ratio Sizing
The SurvivorRatio parameter controls the size of the two survivor spaces. For example,
-XX:SurvivorRatio=6 sets the ratio between each survivor space and eden to be 1:6, each
survivor space will be one eighth of the young generation. The default for Solaris is 32. If
survivor spaces are too small, copying collection overows directly into the old generation. If
survivor spaces are too large, they will be empty. At each GC, the JVM determines the number
of times an object can be copied before it is tenured, called the tenure threshold. This threshold
is chosen to keep the survivor space half full.
Use the option -XX:+PrintTenuringDistribution to show the threshold and ages of the
objects in the new generation. It is useful for observing the lifetime distribution of an
application.
Rebasing DLLs on Windows
When the JVM initializes, it tries to allocate its heap using the -Xms setting. The base addresses
of Application Server DLLs can restrict the amount of contiguous address space available,
causing JVM initialization to fail. The amount of contiguous address space available for Java
memory varies depending on the base addresses assigned to the DLLs. You can increase the
amount of contiguous address space available by rebasing the Application Server DLLs.
Managing Memory and Garbage Collection
Chapter 4 • Tuning the Java Runtime System 89










