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

Reduce the database transaction isolation level when appropriate. Reduced isolation levels
reduce work in the database tier, and could lead to better application performance. However,
this must be done after carefully analyzing the database table usage patterns.
Set the database transaction isolation level with the Admin Console on the Resources > JDBC >
Connection Pools > PoolName page. For more information on tuning JDBC connection pools,
see
“JDBC Connection Pool Settings” on page 77 .
Tuning Message-Driven Beans
This section provides some tips to improve performance when using JMS with message-driven
beans (MDBs).
Use getConnection()
JMS connections are served from a connection pool. This means that calling getConnection()
on a Queue connection factory is fast.
Caution – Previous to version 8.1, it was possible to reuse a connection with a servlet or EJB
component. That is, the servlet could call getConnection() in its init() method and then
continually call getSession() for each servlet invocation. If you use JMS within a global
transaction, that no longer works: applications can only call getSession() once for each
connection. After than, the connection must be closed (which doesn’t actually close the
connection; it merely returns it to the pool). This is a general feature of portable Java EE 1.4
applications; the Sun Java System Application Server enforces that restriction where previous
(Java EE 1.3-based) application servers did not.
Tune the Message-Driven Bean’s Pool Size
The container for message-driven beans (MDB) is dierent than the containers for entity and
session beans. In the MDB container, sessions and threads are attached to the beans in the MDB
pool. This design makes it possible to pool the threads for executing message-driven requests in
the container.
Tune the Message-Driven bean’s pool size to optimize the concurrent processing of messages.
Set the size of the MDB pool to, based on all the parameters of the server (taking other
applications into account). For example, a value greater than 500 is generally too large.
You can congure MDB pool settings in the Admin Console at Congurations > cong-name >
EJB Container (MDB Settings). You can also set it with asadmin as follows:
asadmin set server.mdb-container.max-pool-size = value
EJB PerformanceTuning
Chapter 2 • TuningYour Application 47










