EJB Performance Tuning

For example, enable threadpools named priority-1 and priority-2 to the <orb> element as follows:

<orb max-connections="1024"message-fragment-size="1024"use-thread-pool-ids="thread-pool-1,priority-1,priority-2">

3Include the threadpool ID in the use-thread-pool-idelement of the EJB component’s sun-ejb-jar.xmldeployment descriptor.

For example, the following sun-ejb-jar.xml deployment descriptor for an EJB component named “TheGreeter” is assigned to a thread pool named priority-2:

<sun-ejb-jar> <enterprise-beans>

<unique-id>1</unique-id> <ejb>

<ejb-name>TheGreeter</ejb-name> <jndi-name>greeter</jndi-name> <use-thread-pool-id>priority-1</use-thread-pool-id>

</ejb> </enterprise-beans>

</sun-ejb-jar>

4Restart the Application Server.

Tuning Tips for Specific Types of EJB Components

This section provides tips for tuning various specific types of EJB components:

“Entity Beans” on page 42

“Stateful Session Beans” on page 42

“Stateless Session Beans” on page 43

“Read-Only Entity Beans” on page 43

“Pre-fetching Container Managed Relationship (CMR) Beans” on page 44

Entity Beans

Depending on the usage of a particular entity bean, one should tune max-cache-size so that beans that are used less (for example, an order that is created and never used after the transaction is over) are cached less, and beans that are used frequently (for example, an item in the inventory that gets referenced very often), are cached more in numbers.

Stateful Session Beans

When a stateful bean represents a user, a reasonable max-cache-size of beans is the expected number of concurrent users on the application server process. If this value is too low (in relation

42

Sun GlassFish Enterprise Server 2.1 Performance Tuning Guide • January 2009

Page 42
Image 42
Sun Microsystems 820434310 manual Tuning Tips for Specific Types of EJB Components, Entity Beans, Stateful Session Beans