Avoid component designs that require the use of long-running transactions. For each transaction that your application runs, the database server may lock tables, rows, indexes, and other resources required to guarantee the required transaction outcome. Long-running transactions reduce the scalability of the application, since the required locks may be held for the duration of the transaction and other users must wait for them to be released.
Many design patterns that depend on long-running transactions can be easily modified to use optimistic concurrency control and short transactions. That is, rather than running all the database work in one transaction, select the initial values and perform all computations without starting a transaction. Use a timestamp or value comparisons before updates to verify that data has not been modified since it was first selected.
For EJB components, minimize the use of bean-managed transactions. If you do use bean-managed transactions, avoid implementations that allow the transaction to remain open when a method returns.
For CORBA and PowerBuilder components, avoid stateful components that are transactional and call the continueWork or disallowCommit state primitives, and other designs that require transactions to span client method invocations. If the transaction remains open when the business method returns, it can remain open if the client hangs or the user changes their mind.
Beginning in version 6.0, you can disable support for
long-running transactions started by CORBA stateful components.
For details, see “Long versus
short transactions” in Chapter
2, “CORBA Component Life Cycles and Transaction Semantics,” in
the CORBA Components Guide.