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

Cache Bean-Specic Resources
Use the setMessageDrivenContext() or ejbCreate() method to cache bean specic
resources, and release those resources from the ejbRemove() method.
Limit Use of JMS Connections
When designing an application that uses JMS connections make sure you use a methodology
that sparingly uses connections, by either pooling them or using the same connection for
multiple sessions.
The JMS connection uses two threads and the sessions use one thread each. Since these threads
are not taken from a pool and the resultant objects aren’t pooled, you could run out of memory
during periods of heavy usage.
One workaround is to move createTopicConnection into the init of the servlet.
Make sure to specically close the session, or it will stay open, which ties up resources.
EJB PerformanceTuning
Sun GlassFish Enterprise Server 2.1 Performance Tuning Guide • January 200948










