
EJB Performance Tuning
Prefer Local Interfaces
An EJB component can have remote and local interfaces. Clients not located in the same application server instance as the bean (remote clients) use the remote interface to access the bean. Calls to the remote interface require marshalling arguments, transportation of the marshalled data over the network,
If an EJB component has a local interface, then local clients in the same application server instance can use it instead of the remote interface. Using the local interface is more efficient, since it does not require argument marshalling, transportation, and
If a bean is to be used only by local clients then it makes sense to provide only the local interface. If, on the other hand, the bean is to be
Using Pass-By-Reference Semantics
By default, the Enterprise Server uses
However, local clients can use
Using the remote and local interfaces appropriately means that clients can access EJB components efficiently. That is, local clients use the local interface with
However, in some instances it might not be possible to use the local interface, for example when:
■The application predates the EJB 2.0 specification and was written without any local interfaces.
■There are
For these cases, the Enterprise Server provides a
You can specify the
Chapter 2 • Tuning Your Application | 37 |