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 one-phase commit (1PC) resource. Since the overhead of multiple-resource transactions is much higher for a JDBC resource than a message queue, LAO substantially improves performance of distributed transactions involving one JDBC resource and one or more message queues. To take advantage of LAO, configure a JDBC resource as a 1PC resource. Nothing special needs to be done to configure JMS resources.

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 (ejb-jar.xml). Options are listed from best performance to worst. To improve performance, choose the least expensive attribute that will provide the functionality your application needs:

1.NEVER

2.TX_NOTSUPPORTED

3.TX_MANDATORY

4.TX_SUPPORTS

5.TX_REQUIRED

6.TX_REQUIRESNEW

Using Special Techniques

Special performance-enhancing techniques are discussed in the following sections:

“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

Page 39
Image 39
Sun Microsystems 820434310 manual Using Special Techniques, Configure Jdbc Resources as One-Phase Commit Resources