
EJB Performance Tuning
source are going to be involved in a transaction. If a database participates in some distributed transactions, but mostly in local or single database transactions, it is advisable to register two separate JDBC resources and use the appropriate resource in the application.
Configure JDBC Resources as One-Phase Commit Resources
To improve performance of transactions involving multiple resources, the Application Server uses last agent optimization (LAO), which allows the configuration of one of the resources in a distributed transaction as a
In global transactions involving multiple JDBC resources, LAO will still improve performance, however, not as much as for one JDBC resource. In this situation, one of the JDBC resources should be configured as 1PC, and all others should be configured as XA.
Use the Least Expensive Transaction Attribute
Set the following transaction attributes in the EJB deployment descriptor file
1.NEVER
2.TX_NOTSUPPORTED
3.TX_MANDATORY
4.TX_SUPPORTS
5.TX_REQUIRED
6.TX_REQUIRESNEW
Using Special Techniques
Special
■“Version Consistency” on page 39
■“Request Partitioning” on page 41
Version Consistency
Note – The technique in section applies only to the EJB 2.1 architecture. In the EJB 3.0 architecture, use the Java Persistence API (JPA).
Chapter 2 • Tuning Your Application | 39 |