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

EJB PerformanceTuning
The Enterprise Server’s high-performance EJB container has numerous parameters that aect
performance. Individual EJB components also have parameters that aect performance. The
value of individual EJB component’s parameter overrides the value of the same parameter for
the EJB container. The default values are designed for a single-processor computer
system—change them to optimize for other system congurations.
This section covers the following topics:
■
“Goals” on page 32
■
“Monitoring EJB Components” on page 32
■
“General Guidelines” on page 35
■
“Using Local and Remote Interfaces” on page 36
■
“Improving Performance of EJB Transactions” on page 38
■
“Using Special Techniques” on page 39
■
“Tuning Tips for Specic Types of EJB Components” on page 42
■
“JDBC and Database Access” on page 46
■
“Tuning Message-Driven Beans” on page 47
Goals
The goals of EJB performance tuning are:
■
Increased speed - Cache as many beans in the EJB caches as possible to increase speed
(equivalently, decrease response time). Caching eliminates CPU-intensive operations.
However, since memory is nite, as the caches become larger, housekeeping for them
(including garbage collection) takes longer.
■
Decreased memory consumption - Beans in the pools or caches consume memory from
the Java virtual machine heap. Very large pools and caches degrade performance because
they require longer and more frequent garbage collection cycles.
■
Improved functional properties - Functional properties such as user time-out, commit
options, security, and transaction options, are mostly related to the functionality and
conguration of the application. Generally, they do not compromise functionality for
performance. In some cases, you might be forced to make a “trade-o” decision between
functionality and performance. This section oers suggestions in such cases.
Monitoring EJB Components
When the EJB container has monitoring enabled, you can examine statistics for individual
beans based on the bean pool and cache settings.
For example, the monitoring command below gives the Bean Cache statistics for a stateful
session bean.
EJB PerformanceTuning
Sun GlassFish Enterprise Server 2.1 Performance Tuning Guide • January 200932










