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

■
Pool Idle Timeout: the maximum time that a stateless session bean, entity bean, or
message-driven bean is allowed to be idle in the pool. After this time, the bean is destroyed if
the bean in case is a stateless session bean or a message driver bean. This is a hint to server.
The default value is 600 seconds. The corresponding EJB deployment descriptor attribute is
pool-idle-timeout-in-seconds.
If there are more beans in the pool than the maximum pool size, the pool drains back to
initial and minimum pool size, in steps of pool resize quantity at an interval specied by the
pool idle timeout. If the resize quantity is too small and the idle timeout large, you will not
see the pool draining back to steady size quickly enough.
Tuning the EJB Cache
A bean in the cache represents the ready state in the EJB lifecycle. This means that the bean has
an identity (for example, a primary key or session ID) associated with it.
Beans moving out of the cache have to be passivated or destroyed according to the EJB lifecycle.
Once passivated, a bean has to be activated to come back into the cache. Entity beans are
generally stored in databases and use some form of query language semantics to load and store
data. Session beans have to be serialized when storing them upon passivation onto the disk or a
database; and similarly have to be deserialized upon activation.
Any incoming request using these “ready” beans from the cache avoids the overhead of
creation, setting identity, and potentially activation. So, theoretically, it is good to cache as
many beans as possible. However, there are drawbacks to caching:
■
Memory consumed by all the beans aects the heap available in the Virtual Machine.
■
Increasing objects and memory taken by cache means longer, and possibly more frequent,
garbage collection.
■
The application server might run out of memory unless the heap is carefully tuned for peak
loads.
Keeping in mind how your application uses stateful session beans and entity beans, and the
amount of trac your server handles, tune the EJB cache size and time-out settings to minimize
the number of activations and passivations.
EJB Cache Settings
An individual EJB component can specify cache settings that override those of the EJB
container in the <bean-cache> element of the EJB component’s sun-ejb-jar.xml deployment
descriptor.
The EJB cache settings are:
EJB Container Settings
Chapter 3 • Tuning the Enterprise Server 55










