Sun Microsystems 820434310 manual General Guidelines, Use High Performance Beans, Use Caching

Models: 820434310

1 128
Download 128 pages 34.03 Kb
Page 35
Image 35
General Guidelines

EJB Performance Tuning

To find the possible objects (applications, modules, beans, and methods) and object attributes that can be monitored, use the Admin Console. For more information, see Chapter 18, “Monitoring Components and Services,” in Sun GlassFish Enterprise Server 2.1 Administration Guide. Alternatively, use the asadmin list command. For more information, see list(1).

For statistics on stateful session bean passivations, use this command:

asadmin get -m serverInstance.application.appName.ejb-module.moduleName

.stateful-session-bean.beanName.bean-cache.*

From the attribute values that are returned, use this command:

num-passivationsnum-passivation-errorsnum-passivation-success

General Guidelines

The following guidelines can improve performance of EJB components. Keep in mind that decomposing an application into many EJB components creates overhead and can degrade performance. EJB components are not simply Java objects. They are components with semantics for remote call interfaces, security, and transactions, as well as properties and methods.

Use High Performance Beans

Use high-performance beans as much as possible to improve the overall performance of your application. For more information, see “Tuning Tips for Specific Types of EJB Components” on page 42

The types of EJB components are listed below, from the highest performance to the lowest:

1.Stateless Session Beans and Message Driven Beans

2.Stateful Session Beans

3.Container Managed Persistence (CMP) entity beans configured as read-only

4.Bean Managed Persistence (BMP) entity beans configured as read-only

5.CMP beans

6.BMP beans

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.

Chapter 2 • Tuning Your Application

35

Page 35
Image 35
Sun Microsystems 820434310 manual General Guidelines, Use High Performance Beans, Use Caching