Sun Microsystems 820434310 Server User Manual


 
semantics. See “Value Added Features” in Sun GlassFish Enterprise Server 2.1 Developer’s Guide
for more details about the pass-by-reference ag.
To specify that an EJB component will use pass by reference semantics, use the following tag in
the sun-ejb-jar.xml deployment descriptor:
<pass-by-reference>true</pass-by-reference>.
This avoids copying arguments when the EJB component’smethods are invoked and avoids
copying results when methods return. However, problems will arise if the data is modied by
another source during the invocation.
Improving Performance of EJB Transactions
This section provides some tips to improve performance when using transactions.
Use Container-Managed Transactions
Container-managed transactions are preferred for consistency, and provide better
performance.
Don’t Encompass User Input Time
To avoid resources being held unnecessarily for long periods, a transaction should not
encompass user input or user think time.
Identify Non-Transactional Methods
Declare non-transactional methods of session EJB components with NotSupported or Never
transaction attributes. These attributes can be found in the ejb-jar.xml deployment descriptor
le. Transactions should span the minimum time possible since they lock database rows.
UseTX_REQUIRED for LongTransaction Chains
For very large transaction chains, use the transaction attribute TX_REQUIRED. To ensure EJB
methods in a call chain, use the same transaction.
Use Lowest Cost Database Locking
Use the lowest cost locking available from the database that is consistent with any transaction.
Commit the data after the transaction completes rather than after each method call.
Use XA-Capable Data Sources Only When Needed
When multiple database resources, connector resources or JMS resources are involved in one
transaction, a distributed or global transaction needs to be performed. This requires XA capable
resource managers and data sources. Use XA capable data sources, only when two or more data
EJB PerformanceTuning
SunGlassFishEnterpriseServer2.1PerformanceTuningGuide January200938