Sun Java System Application Server Platform Edition 8.1 2005Q2 Update 2 Administration Guide

- Previous: To configure EJB pool settings
- Next: Configuring the Message-Driven Bean Settings

## To configure EJB cache settings

The container maintains a cache of enterprise bean data for the most used enterprise beans. This allows the container to respond more quickly to requests from other application modules for data from the enterprise beans. This section applies only to stateful session beans and entity beans.

Cached enterprise beans are in one of three states: active, idle, or passivated. An active enterprise bean is currently being accessed by clients. An idle enterprise bean’s data is currently in the cache, but no clients are accessing the bean. A passivated bean’s data is temporarily stored, and read back into the cache if a client requests the bean.

1. In the tree component, select the Configuration node.

2. Select the EJB Container node.

3. Adjust the maximum cache size in the Max Cache Size field.

   Increase the maximum number of beans to cache to eliminate the overhead of bean creation and destruction. However, if the cache is increased, the server consumes more memory and resources. Be sure your operating environment is sufficient for your cache settings.

4. Adjust the cache resize quantity in the Cache Resize Quantity field.

   When the maximum number of cached beans is reached, the container removes a number of passivated beans from the backup store, set to 32 by default.

5. Adjust the rate, in seconds, at which the cache cleanup is scheduled for entity beans in the Cache Idle Timeout field.

   If a cached entity bean has been idle a certain amount of time, it is passivated. That is, the bean’s state is written to a backup store.

6. Adjust the time, in seconds, after which stateful session beans are removed from the cache or passivated store in the Removal Timeout field.

7. Configure the policy the container uses to remove stateful session beans in the Removal Selection Policy field.

   The container decides which stateful session beans to remove based on the policy set in the Removal Selection Policy field. There are three possible policies the container uses to remove beans from the cache:

   - Not recently used (NRU)

   - First in, first out (FIFO)

   - Least recently used (LRU)

   The NRU policy removes a bean that hasn’t been used recently. The FIFO policy removes the oldest bean in the cache. The LRU policy removes the least recently accessed bean. By default, the NRU policy is used by the container.

   Entity beans are always removed using the FIFO policy.

8. Click Save.

9. Restart the Application Server.

##### See Also

- The EJB Container

- Previous: To configure EJB pool settings
- Next: Configuring the Message-Driven Bean Settings

- © 2010, Oracle Corporation and/or its affiliates