
EJB Performance Tuning
■Cache EJB resources: Use setSessionContext() or ejbCreate() to cache bean resources. This is again an example of using bean lifecycle methods to perform application actions only once where possible. Remember to release acquired resources in the ejbRemove() method.
Use the Appropriate Stubs
The stub classes needed by EJB applications are generated dynamically at runtime when an EJB client needs them. This means that it is not necessary to generate the stubs or retrieve the client JAR file when deploying an application with remote EJB components. When deploying an application, it is no longer necessary to specify the
If you have a legacy
Remove Unneeded Stateful Session Beans
Removing unneeded stateful session beans avoids passivating them, which requires disk operations.
Cache and Pool Tuning Tips
Follow these tips when using the EJB cache and pools to improve performance:
■Explicitly call remove(): Allow stateful session EJB components to be removed from the container cache by explicitly calling of the remove() method in the client.
■Tune the entity EJB component’s pool size: Entity Beans use both the EJB pool and cache settings. Tune the entity EJB component’s pool size to minimize the creation and destruction of beans. Populating the pool with a
■Cache
■Load related data efficiently for
■Identify
Using Local and Remote Interfaces
This section describes some considerations when EJB components are used by local and remote clients.
36 | Sun GlassFish Enterprise Server 2.1 Performance Tuning Guide • January 2009 |