Skip to main content
Summary How to use proxy based load balancing for an Orbix replicated server.
Article Number 17111
Environment Orbix 6.3 Orbix Java Runtime
Question/Problem Description How to use proxy based load balancing for an Orbix replicated server.
How to implement proxy based load balancing for a a replicated server
How to use the ClientLoadBalancingPolicy
How to use com.iona.corba.IT_CORBA.CLIENT_LOAD_BALANCING_POLICY_ID
How to use Orbix client side load balancing
Clarifying Information
Error Message
Defect/Enhancement Number
Cause
Resolution

As documented in the Administrator's Guide, Orbix Java provides two client side load balancing strategies for replicated servers:

  1. per-client ORB (default) - once a client side proxy binding has been established to a server replica, all  subsequent requests from that client ORB to that server will reuse the same client side proxy binding. This results in all requests from a client ORB going the same server replica. 
  2. per_request_lb - for each request the client ORB retrieves an IOR from the locator and the request is forwarded to the server replica specified by that IOR.

It is also possible to turn off the client side proxy binding reuse (described in point 1) by setting the com.iona.corba.IT_CORBA.CLIENT_LOAD_BALANCING_POLICY_ID policy. If the client side proxy binding is not reused, then each time a CORBA proxy is created, the ORB retrieves an IOR from the locator that specifies a server replica. All subsequent requests made on that CORBA proxy will be sent to the same server replica.

To understand how com.iona.corba.IT_CORBA.CLIENT_LOAD_BALANCING_POLICY_ID is used we need to understand when an ORB reuses a client side proxy binding. When a client application invokes the first operation on a CORBA Proxy, the ORB takes the following details into account as it determines whether or not it can reuse an existing client side proxy binding:

 

• Associated ORB instance—the identity of the ORB instance on the client side with which the object reference is associated.

 

• Endpoint ID—from the IOR profile currently used by the object.

 

• IOR Components—from the IOR profile currently used by the object.

 

• Effective policy set—the client policies that are effective for this CORBA proxy. On the client side, it is possible to set policies at several granularity levels, down to the level of a single CORBA proxy. The effective policy set is obtained by merging CORBA proxy and ORB-level policies.

 

 

When two CORBA Proxies have all of the above details in common, they can share a client side proxy binding. By setting CLIENT_LOAD_BALANCING_POLICY_ID on a CORBA proxy, it introduces a new policy into the effective policy set for that CORBA proxy. The CORBA proxy is then considered "not equal" to another instance of that CORBA proxy with a different value for CLIENT_LOAD_BALANCING_POLICY_ID, hence  preventing reuse/sharing of the client side proxy binding.

 

The client side code sample below illustrates how to set CLIENT_LOAD_BALANCING_POLICY_ID on a CORBA proxy.

 

...

java.util.Properties props = System.getProperties();
props.put("org.omg.CORBA.ORBClass", "com.iona.corba.art.artimpl.ORBImpl");
props.put("org.omg.CORBA.ORBSingletonClass", "com.iona.corba.art.artimpl.ORBSingleton");

 

//retrieve IOR

org.omg.CORBA.Object default_corba_obj = ...

 

//create policy with a unique (for that proxy) string value.

 

Any any1 = orb.create_any();
any1.insert_string("one");

 

Policy policies1[] = { orb.create_policy(CLIENT_LOAD_BALANCING_POLICY_ID.value, any1) };

//set policy

 

org.omg.CORBA.Object modified_policy_obj = ObjectHelper.set_policy_overrides(default_corba_obj,
                                                                  
policies1,
                                                                  
SetOverrideType.ADD_OVERRIDE);

 

//narrow to interface object in the standard way.

 

SimpleObject simpleObject = SimpleObjectHelper.narrow(modified_policy_obj );

 

  ...

 

For details on client side load balancing strategies see Orbix Administrator's Guide, "Configuring Scalable Applications" - Per-Request Load Balancing..T face="Courier New">//retrieve IOR

org.omg.CORBA.Object default_corba_obj = ...

 

//create policy with a unique (for that proxy) string value.

 

Any any1 = orb.create_any();
any1.insert_string("one");

 

Policy policies1[] = { orb.create_policy(CLIENT_LOAD_BALANCING_POLICY_ID.value, any1) };

//set policy

 

org.omg.CORBA.Object modified_policy_obj = ObjectHelper.set_policy_overrides(default_corba_obj,
                                                                  
policies1,
                                                                  
SetOverrideType.ADD_OVERRIDE);

 

//narrow to interface object in the standard way.

 

SimpleObject simpleObject = SimpleObjectHelper.narrow(modified_policy_obj );

 

  ...

 

For details on client side load balancing strategies see Orbix Administrator's Guide, "Configuring Scalable Applications" - Per-Request Load Balancing..
Workaround
Notes
Attachment
Created date: 06 September 2011
Last Modified: 13 February 2013
Last Published: 23 June 2012
First Published date: 10 September 2011

#Orbix
#KnowledgeDocs