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

Although applications can explicitly invoke GC with the System.gc() method, doing so is a
bad idea since this forces major collections, and inhibits scalability on large systems. It is best to
disable explicit GC by using the ag -XX:+DisableExplicitGC.
The Enterprise Server uses RMI in the Administration module for monitoring. Garbage cannot
be collected in RMI-based distributed applications without occasional local collections, so RMI
forces a periodic full collection. Control the frequency of these collections with the property
-sun.rmi.dgc.client.gcInterval. For example, - java
-Dsun.rmi.dgc.client.gcInterval=3600000 species explicit collection once per hour
instead of the default rate of once per minute.
To specify the attributes for the Java virtual machine, use the Admin Console and set the
property under cong-name > JVM settings (JVM options).
Tuning the Java Heap
This section discusses topics related to tuning the Java Heap for performance.
■
“Guidelines for Java Heap Sizing” on page 87
■
“Heap Tuning Parameters” on page 88
Guidelines for Java Heap Sizing
Maximum heap size depends on maximum address space per process. The following table
shows the maximum per-process address values for various platforms:
TABLE 4–1 Maximum Address Space Per Process
Operating System Maximum Address Space
Per Process
Redhat Linux 32 bit 2 GB
Redhat Linux 64 bit 3 GB
Windows 98/2000/NT/Me/XP 2 GB
Solaris x86 (32 bit) 4 GB
Solaris 32 bit 4 GB
Solaris 64 bit Terabytes
Maximum heap space is always smaller than maximum address space per process, because the
process also needs space for stack, libraries, and so on. To determine the maximum heap space
that can be allocated, use a proling tool to examine the way memory is used. Gauge the
maximum stack space the process uses and the amount of memory taken up libraries and other
Managing Memory and Garbage Collection
Chapter 4 • Tuning the Java Runtime System 87










