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

When the new generation lls up, it triggers a minor collection in which the surviving objects
are moved to the old generation. When the old generation lls up, it triggers a major collection
which involves the entire object heap.
Both HotSpot and Solaris JDK use thread local object allocation pools for lock-free, fast, and
scalable object allocation. So, custom object pooling is not often required. Consider pooling
only if object construction cost is high and signicantly aects execution proles.
Choosing the Garbage Collection Algorithm
Pauses during a full GC of more than four seconds can cause intermittent failures in persisting
session data into HADB.
While GC is going on, the Application Server isn’t running. If the pause is long enough, the
HADB times out the existing connections. Then, when the application server resumes its
activities, the HADB generates errors when the application server attempts to use those
connections to persist session data. It generates errors like, “Failed to store session data,”
“Transaction Aborted,” or “Failed to connect to HADB server.”
To prevent that problem, use the CMS collector as the GC algorithm. This collector can cause a
drop in throughput for heavily utilized systems, because it is running more or less constantly.
But it prevents the long pauses that can occur when the garbage collector runs infrequently.
▼
To use the CMS collector
Make sure that the system is not using 100 percent of its CPU.
Congure HADB timeouts, as described in the Administration Guide.
Congure the CMS collector in the server instance.
To do this, add the following JVM options:
■
-XX:+UseConcMarkSweepGC
■
-XX:SoftRefLRUPolicyMSPerMB=1
Additional Information
Use the jvmstat utility to monitor HotSpot garbage collection. (See “Further Information” on
page 91
For detailed information on tuning the garbage collector, see Tuning Garbage Collection with
the 5.0 Java Virtual Machine
.
1
2
3
Managing Memory and Garbage Collection
Chapter 4 • Tuning the Java Runtime System 85










