General EJB Tuning Tips

10 Tuning WebLogic Server EJBs 10-1 10 Tuning WebLogic Server EJBs The following sections describe how to tune WebLogic Server EJBs to match your application needs: ■ Section 10.1, General EJB Tuning Tips ■ Section 10.2, Tuning EJB Caches ■ Section 10.3, Tuning EJB Pools ■ Section 10.4, CMP Entity Bean Tuning ■ Section 10.5, Tuning In Response to Monitoring Statistics ■ Section 10.6, Using the JDT Compiler

10.1 General EJB Tuning Tips

■ Deployment descriptors are schema-based. Descriptors that are new in this release of WebLogic Server are not available as DTD-based descriptors. ■ Avoid using the RequiresNew transaction parameter. Using RequiresNew causes the EJB container to start a new transaction after suspending any current transactions. This means additional resources, including a separate data base connection are allocated. ■ Use local-interfaces or set call-by-reference to true to avoid the overhead of serialization when one EJB calls another or an EJB is called by a servletJSP in the same application. Note the following: – In release prior to WebLogic Server 8.1, call-by-reference is turned on by default. For releases of WebLogic Server 8.1 and higher, call-by-reference is turned off by default. Older applications migrating to WebLogic Server 8.1 and higher that do not explicitly turn on call-by-reference may experience a drop in performance. – This optimization does not apply to calls across different applications. ■ Use Stateless session beans over Stateful session beans whenever possible. Stateless session beans scale better than stateful session beans because there is no state information to be maintained. ■ WebLogic Server provides additional transaction performance benefits for EJBs that reside in a WebLogic Server cluster. When a single transaction uses multiple EJBs, WebLogic Server attempts to use EJB instances from a single WebLogic Server instance, rather than using EJBs from different servers. This approach minimizes network traffic for the transaction. In some cases, a transaction can use EJBs that reside on multiple WebLogic Server instances in a cluster. This can occur 10-2 Performance and Tuning for Oracle WebLogic Server in heterogeneous clusters, where all EJBs have not been deployed to all WebLogic Server instances. In these cases, WebLogic Server uses a multitier connection to access the datastore, rather than multiple direct connections. This approach uses fewer resources, and yields better performance for the transaction. However, for best performance, the cluster should be homogeneous — all EJBs should reside on all available WebLogic Server instances.

10.2 Tuning EJB Caches