OSB and JMS Business Service Configuration

When using distributed message queuing in OSB, it is possible for a large number of messages to arrive on a single physical queue. This happens when the upstream client sends messages in bulk via a single connection. As distributed queue load balancing is done per connection, the use of a single connection this way will not load balance correctly.

This is demonstrated in the example below where an external JMS client connects to a distributed queue. The underlying WebLogic queuing infrastructure actually makes the connection to one of the physical queues. While this connection is kept open, the client sends many messages, which all end up on the single physical queue.

Distributed_Queuing.jpg

In this instance, it is important that OSB correctly load balances the messages from this point so downstream bottlenecks are avoided. JMS based Business Services must be configured correctly to enable load balancing to occur where multiple physical queues make up a single distributed queue. The following configuration will not load balance correctly:

bad_endpoint.JPG

Using a single endpoint with multiple host and port combination's results in the business service selecting the first available host/port combination it finds. So in the above case, one of the four physical instances of queue.Fabric.ProductStatus will end up getting all of the messages. The load balancing algorithm is ignored in the above case as this algorithm is only applicable for two or more endpoints. This is an acceptable configuration for failover, but not for load balancing.

To correctly configure a JMS Business Service, each host/port combination must have a separate endpoint URI configured. This will enable the in-built OSB load balancing functionality to work. Each endpoint will get a share based on the algorithm used. An example is displayed below:

good_endpoint.JPG

The use of the Random-Weighted algorithm gives the added benefit of being able to give certain endpoints a higher load based on its weighting.

Here is an WLST script extract that configures OSB Business Service URI endpoints:



# Setting Load Balancing algorithm to Random Weighted

outboundProps = endPoints.getOutboundProperties()
outboundProps.setLoadBalancingAlgorithm(LoadBalancingAlgorithmEnum.WEIGHTED_RANDOM)

# For each host/port combination, create a new URI
for hostPort in hostPortList:
uri = 'jms://' + hostPort + '/' + qcf + '/' + queue
print 'Adding new endpoint value of: ' + uri
newURI = endPoints.addNewURI()
newURI.setValue(uri)
newURI.setWeight(1)

serviceDef.setEndpointConfig(endPoints)
print 'Updated endpoint config with new endpoints'
serviceConfig.updateService(resourceRef, serviceDef)
print 'Updated Business Service ' + resourceRef.getFullName() + ' with new endpoint config'

Comments:

Post a Comment:
Comments are closed for this entry.
About

Oracle Service Bus Best Practices

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today