Sun Java System Application Server Enterprise Edition 8.1 2005Q2 Performance Tuning Guide

- Previous: Use High Performance Beans
- Next: Use the Appropriate Stubs

### Use Caching

Caching can greatly improve performance when used wisely. For example:

- Cache EJB references: To avoid a JNDI lookup for every request, cache EJB references in servlets.

- Cache home interfaces: Since repeated lookups to a home interface can be expensive, cache references to EJBHomes in the `init()` methods of servlets.

- 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.

- Previous: Use High Performance Beans
- Next: Use the Appropriate Stubs

- © 2010, Oracle Corporation and/or its affiliates