Sun Java System Application Server Enterprise Edition 8.1 2005Q2 Administration Guide

ProcedureTo 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 Configurations node.

  2. Select the instance to configure:

    • To configure a particular instance, select the instance’s config node. For example, the default instance, server, select the server-config node.

    • To configure the default settings for all instances, select the default-config node.

  3. Select the EJB Container node.

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

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

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

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

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

  9. Click Save.

  10. Restart the Application Server.