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

- Previous: Configuring Web Container Sessions
- Next: Configuring the Message-Driven Bean Settings

## Configuring the General EJB Settings

This section describes the following settings, which apply to all enterprise bean containers on the server:

- Session Store Location

- To configure EJB pool settings

- To configure EJB cache settings

To override the defaults on a per-container basis, adjust the values in the enterprise bean’s `sun-ejb-jar.xml` file. For details, see the Application Server Developer’s Guide.

### Session Store Location

The Session Store Location field specifies the directory where passivated beans and persisted HTTP sessions are stored on the file system.

Passivated beans are enterprise beans that have had their state written to a file on the file system. Passivated beans typically have been idle for a certain period of time, and are not currently being accessed by clients.

Similar to passivated beans, persisted HTTP sessions are individual web sessions that have had their state written to a file on the file system.

The Commit Option field specifies how the container caches passivated entity bean instances between transactions.

Option B caches entity bean instances between transactions, and is selected by default. Option C disables caching.

### To configure EJB pool settings

The container maintains a pool of enterprise beans in order to respond to client requests without the performance hit that results from creating the beans. These settings only apply to stateless session beans and entity beans.

If you experience performance problems in an application that uses deployed enterprise beans, creating a pool, or increasing the number of beans maintained by an existing pool, can help increase the application’s performance.

By default, the container maintains a pool of enterprise beans.

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. Under Pool Settings in the Initial and Minimum Pool Size field enter the minimum number of beans the container creates in the pool.

5. In the Maximum Pool Size field enter the maximum number of beans the container maintains in the pool, at any time.

6. In the Pool Resize Quantity field enter the number of beans that will be removed from the pool if they are idle for more than the time specified in Pool Idle Timeout.

7. In the Pool Idle Timeout field enter the time, in seconds, that a bean in the pool can remain idle before it will be removed from the pool.

8. Click Save.

9. Restart the Application Server.

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

- Previous: Configuring Web Container Sessions
- Next: Configuring the Message-Driven Bean Settings

- © 2010, Oracle Corporation and/or its affiliates