Local interfaces  Pass-by-reference semantics

Chapter 3: Component Tuning

Lightweight container

EAServer provides a lightweight version of the standard EJB component container. The performance of some intercomponent calls in EAServer can be improved by enabling the lightweight container (LWC). The LWC coexists with the standard container. The LWC provides optimized performance for in-server EJB calls, while preserving all expected EJB semantics (such as pass by value when using remote interfaces). You can use the LWC for calls that use local or remote interfaces. The LWC can reduce CPU utilization for calls from session beans to entity beans, such that EJB-standard entity beans become as fast as lightweight persistence frameworks.


Comparing LWC to local interfaces

Both LWC and local interfaces improve performance by eliminating parameter marshalling, but the LWC provides even better performance by eliminating internal calls to enforce transactional and security requirements. You can also use LWC on EJB components that lack local interfaces, including EJB 1.1 components.


Determining if your component can use LWC

Because the LWC eliminates standard dispatcher code to enforce transaction semantics and security restrictions, you must verify that your components and the application’s use of them satisfies these restrictions before enabling LWC.

The LWC is suitable for EJB components with transaction attribute set to Required, when such components are called by other EJB components with transaction attributes “Required” or “Requires New.” EAServer verifies the following before using the lightweight container for EJB-to-EJB calls to ensure that EJB 1.1/2.0 semantics are fully preserved:

If the LWC is enabled for the called component, but the constraints are not satisfied, the call fails and EAServer logs an error.

When using the LWC, object references cannot be marshalled. For example, if component A calls B using the remote interface, and B returns a reference to component C, B will fail with exception java.io.NotSerializableException or ClassCastException if LWC is enabled for component C. To avoid this issue, disable LWC for the target components whose object references are passed as parameters or return values, or use local interfaces to call these components.


Enabling LWC

You must enable the lightweight container in server and component properties. To enable LWC for a server, select the LWC option on the Components tab in EAServer Manager’s Server Properties dialog box. If using jagtool, set the server property com.sybase.jaguar.server.lwc to true.

To enable LWC for components, select the LWC option on the Instances tab in EAServer Manager’s Component Properties dialog box. If using jagtool, set the component property com.sybase.jaguar.component.lwc to true.

By default, the LWC supports only EJB-to-EJB intercomponent calls. You can additionally enable calls from the Web tier (servlets and JSPs) by selecting the Enable Skeletons option in the Component Properties Instances tab and on the Server Properties Components tab. This option causes EAServer to generate a skeleton that allows non-LWC invocations from the Web tier. If using jagtool, enable this option by setting the server property com.sybase.jaguar.server.lwc.enableSkeletons to true and the component property com.sybase.jaguar.component.lwc.enableSkeletons to true.

You must regenerate stubs and skeletons for your components after changing any of these settings.

You can set the server property com.sybase.jaguar.server.lwc.debug to enable logging of additional information about LWC invocations.





Copyright © 2005. Sybase Inc. All rights reserved. Pass-by-reference semantics

View this book as PDF