(dist)(iseries)Share connections to benefit from one-phase commit optimization
In some circumstances, we can configure the JMS application to share the JDBC connection that a messaging engine uses. Sharing connections enables you to use one-phase commit optimization. This can improve the performance of the application.
Messaging engines store persistent data in a database, and use a JDBC data source to interact with that database. Some JMS applications also store persistent data in a database, for example if the application uses entity enterprise beans. Typically, such applications use two-phase commit transactions to coordinate updates to the JMS and JDBC resources involved. We can configure the application to share the JDBC connection used by a messaging engine, which enables you to use one-phase commit transactions and improve the performance of the application. We can benefit from the one-phase commit optimization in the following circumstances:
- Your application must use the assured persistent reliability attribute for its JMS messages.
- Your application must use container-managed persistence (CMP) entity beans that are bound to the same JDBC data source that the messaging engine uses for its data store.
Restriction: We cannot benefit from the one-phase commit optimization in the following circumstances:
- If the application uses a reliability attribute other than assured persistent for its JMS messages.
- If the application uses BMP entity beans, or JDBC clients.
- If the application uses DB2 High Availability Disaster Recovery (HADR).
Before you configure the system, ensure that you consider all of the components of the Java EE application that might be affected by one-phase commits.
- Select the assured persistent reliability attribute for your JMS messages.
- Deploy all CMP enterprise beans involved in one-phase commit transactions with res-auth set to Container.
- Deploy all CMP enterprise beans involved in one-phase commit transactions where AccessIntent maps to a transaction isolation level of JDBC Read Committed. We can choose any of the following values for AccessIntent:
- WSOptimisticUpdate
- WSOptimisticRead
- WSPessimisticUpdate-NoCollisions
(WAS v8.5.0.1)
JPA tip: CMP AccessIntent does not apply to JPA applications. JPA applications use the Read Committed isolation level by default.
Oracle tip: All values for AccessIntent, except WSPessimisticUpdateExclusive, map to the JDBC Read Committed transaction isolation level.
DB2 tip: We can use any value for AccessIntent, because WebSphere Application Server exploits the DB2 dynamic transaction isolation level support.
- Ensure that you use the same authentication alias for both your CMP enterprise beans and the messaging engine data store.
- When you configure the JDBC data source, ensure selected the Use data source for CMP beans option.
- Set the value of the JDBC data source custom property jmsOnePhaseOptimization to true.
- Use the JMS connection factory or activation specification panels to select the Share data source with CMP option.
- When we create the JDBC provider and set the Select the implementation type field, ensure selected Connection pool data source (and not XA data source).
Related tasks
Enable CMP entity beans and messaging engine data stores to share database connections