Object Request Broker (ORB)
Several settings are available for controlling internal Object Request Broker (ORB) processing. Use these to improve application performance in the case of applications containing enterprise beans.
You can change these settings for the default server or any appserver configured in the administrative domain from the Administrative Console.
Pass by reference
For EJB 1.1 beans, the EJB 1.1 specification states that method calls are to be Pass by value. For every remote method call, the parameters are copied onto the stack before the call is made. This can be expensive. The Pass by reference, which passes the original object reference without making a copy of the object, can be specified.
For EJB 2.0 beans, interfaces can be local or remote. For local interfaces, method calls are Pass by reference, by default.
If the EJB client and EJB server are installed in the same WAS instance, and the client and server use remote interfaces, specifying Pass by reference can improve performance up to 50%.
Note that Pass by reference helps performance only when non-primitive object types are being passed as parameters. Therefore, int and floats are always copied, regardless of the call model.
Pass by reference can be dangerous and can lead to unexpected results. If an object reference is modified by the remote method, the change might be seen by the caller.
The use of this option for enterprise beans with remote interfaces violates EJB Specification, V2.0 section 5.4. Object references passed to EJB methods or to EJB home methods are not copied and can be subject to corruption.
In Example 17-7, a reference to the same MyPrimaryKey object passes into WAS with a different ID value each time. Running this code with Pass by reference enabled causes a problem within the appserver because multiple enterprise beans are referencing the same MyPrimaryKey object. To avoid this problem, set the system property...
com.ibm.websphere.ejbcontainer.allowPrimaryKeyMutation...to true when Pass by reference is enabled. Setting allowPrimaryKeyMutation to true causes the EJB container to make a local copy of the PrimaryKey object. As a result, however, a small portion of the performance advantage of setting Pass by reference is lost.
Example 17-7 Pass by reference problem demonstration
Iterator iterator = collection.iterator(); MyPrimaryKey pk = new MyPrimaryKey(); while (iterator.hasNext()) { pk.id = (String) iterator.next(); MyEJB myEJB = myEJBHome.findByPrimaryKey(pk); }![]()
To set allowPrimaryKeyMutation:
- Go to...
Servers | Application servers | <AppServer_Name > | Container Services | ORB Service | Custom Properties | New- Assign the new property the name com.ibm.websphere.ejbcontainer.allowPrimaryKeyMutation and a value of true.
- Click OK and save the changes.
- Stop and restart the appserver.
As a general rule, any application code that passes an object reference as a parameter to an enterprise bean method or to an EJB home method must be scrutinized to determine if passing that object reference results in loss of data integrity or in other problems.
- From the the Administrative Console...
Servers | Application servers | <AppServer_Name> | Container Services | ORB Service- Select the check box Pass by reference.
- Click OK and Apply to save the changes.
- Stop and restart the appserver.
If you use command line scripting, the full name of this system property is com.ibm.CORBA.iiop.noLocalCopies.
The default is Pass by value for remote interfaces and Pass by reference for EJB 2.0 local interfaces.
If the appserver expects a large workload for enterprise bean requests, the ORB configuration is critical. Take note of the following properties.
com.ibm.CORBA.ServerSocketQueueDepth
This property corresponds to the length of the TCP/IP stack listen queue and prevents WAS from rejecting requests when there is no space in the listen queue.
If there are many simultaneous clients connecting to the server-side ORB, this parameter can be increased to support the heavy load up to 1000 clients. The default value is 50.
To set the property (in our example we set it to 200), follow these steps:
- Select...
Servers | Application servers | <AppServer_Name | Container Services | ORB Service | Custom Properties | New- Create a new name/value pair with the name com.ibm.CORBA.ServerSocketQueueDepth and the value 200.
- Click OK and Apply to save the changes.
- Stop and restart the appserver.
Connection cache maximum
This property has two names and corresponds to the size of the ORB connection table. The property sets the standard for the number of simultaneous ORB connections that can be processed.
If there are many simultaneous clients connecting to the server-side ORB, this parameter can be increased to support the heavy load up to 1000 clients. The default value is 240.
If you use command line scripting, the full name of this system property is com.ibm.CORBA.MaxOpenConnections.
Use the Administrative Console to set this value:
Servers | Application servers | <AppServer_Name | Container Services | ORB ServiceUpdate the Connection cache maximum field and click OK.
Click Apply to save the changes then restart the appserver.