![]() |
![]() |
|
|
This topic describes the EJB application scaling tasks associated with the EJB roles specified in Sun Microsystem's Enterprise JavaBeans Specification 1.1 (Public Release 2 dated October 18, 1999). The WLE JavaServer provides an implementation of the EJB Container as defined in this specification.
This topic includes the following sections:
Before you begin, be sure to read Scaling WLE Applications, for a comprehensive introduction to tuning and scaling WebLogic Enterprise (WLE) applications. The concepts in that chapter apply to EJB applications as well. The main difference is that factory-based routing is not supported in EJB applications.
In addition, for an introduction to using EJB applications in WLE, see The WLE Enterprise JavaBeans (EJB) Programming Environment.
This topic includes the following sections:
Scaling Tasks for EJB Providers
For a general discussion about using stateful and stateless objects, see Using Object State Management.
EJB Providers can increase application scalability by using stateless session beans wherever appropriate. With stateless session beans, the WLE EJB Container can freely pool instances, allocate instances as needed, and apply load balancing strategies to distribute the load across different servers within the domain.
Stateless session beans can be load balanced on a per-request basis. With every method invocation, a stateless session bean can be relocated to the least busy server within a group or across groups within a domain. For more information about stateless session beans, see "Types of Beans Supported in WLE" in The WLE Enterprise JavaBeans (EJB) Programming Environment.
EJB Providers can increase application scalability by minimizing, in stateful session beans, the state information that must be stored and retrieved during passivation and reactivation.
Stateful objects (stateful session beans and entity beans) are generally more resource intensive than stateless objects because they allocate and exclusively reserve resources during the private conversation with the client. After the state is allocated for an object, the object remains linked to that server for the duration of the method invocation or the transaction. Stateful session beans can be load balanced using any server that supports the bean within the group only (not across groups).
EJB Providers can increase application scalability by using pooled database connections. The JDBC connection pool optimizes performance for database connections by reducing the overhead associated with opening each connection. For more information about configuring and using JDBC connection pools, see To optimize application performance, the WLE EJB Container manages the passivation and reactivation of stateful objects (stateful session beans and entity beans) automatically, based on available system resources. The container can pool instances of a bean and decide when an instance can be removed from the pool to provide a more efficient use of system resources. The WLE EJB Container may passivate an object after a method invocation.
Note:
An object will not be passivated while it participates in a transaction. The WLE EJB Container may passivate it only after the transaction is completed.
The WLE EJB Container manages load balancing with passivated objects. After it is passivated, the WLE EJB Container can relocate an object to the least busy server within the group as long as the object is idle (there are no pending requests on that object). This is particularly important when the bean accesses a database using cursors, because these cursors could become invalid after the passivation (the EJB container can reactivate the bean on a different server).
For stateful session beans and entity beans, EJB Providers can increase application scalability by implementing the ejbPassivate
and ejbActivate
methods in an efficient manner. For more information about persistence in EJB applications, see "EJBs and Persistence" in The WLE Enterprise JavaBeans (EJB) Programming Environment.
Finally, for stateful session beans with container-managed persistence, EJB Providers should favor using JDBC-based persistence over file-based persistence. File-based persistence is generally less scalable. If the client process crashes (for example, the network connection is lost or the client machine is turned off), the file is not automatically removed. An accumulation of these files can slow performance.
EJB Providers can increase application scalability by completing transactions efficiently. An object cannot be passivated while it is participating in a transaction. For example, EJB Providers can specify the timeout period for transactions in EJB applications. If the duration of a transaction exceeds the specified timeout setting, then the Transaction Service rolls back the transaction automatically. For more information, see "Transactions in EJB Applications" in Using Transactions.
EJB Providers can increase application scalability by using the process-entity design pattern instead of entity beans for database access. The process-entity design pattern moves database access logic onto the server process, which achieves the following benefits:
Using Stateless Session Beans
Minimizing State Information in Stateful Session Beans
Using Pooled Connections
Implementing Methods for Bean Persistence
Completing Transactions Efficiently
Implementing the Process-Entity Design Pattern
For more information, see the technical article Process-Entity Design Pattern.
Application Assemblers and Deployers contribute to the scalability of EJB applications by determining the optimum combinations of EJBs in an application's ejb-jar files. When partitioning EJBs, Application Assemblers and Deployers should consider the topology and resource management capabilities provided by the deployment environment. Deployers and system administrators usually collaborate on such decisions.
When deploying EJBs, consider the following issues:
Scaling Tasks for Application Assemblers and Deployers
<persistence-store-descriptor>
<persistence-store-file>
<persistence-store-directory-root> /usr/me/pstore</persistence-store-directory-root>
</persistence-store-file>
</persistence-store-descriptor>
System Administrators contribute to the scalability of EJB applications by configuring and tuning the deployment environment for optimum application performance. System Administrators can increase application performance by:
Scaling Tasks for System Administrators
For more information about monitoring and tuning the performance of a WLE system, see "Monitoring a Running System" in the
|
Copyright © 1999 BEA Systems, Inc. All rights reserved.
|