Saturday, January 26, 2013

Throttling is termed as " regulate the flow". Oracle Service Bus has throttling feature and by using that feature we can control number of requests sent to target service.

But why we need OSB throttling ?

Every system has its own capacity means it can process only certain number of message at one time, if we try to send messages beyond its capacity then that system's performance can degrade or in worst case it can crash. So to avoid all this we can use OSB throttling feature to send limited messages to target system.

OSB Throttling
OSB Throttling
In this Post, I will explain you how to enable throttling in OSB.

To demonstrate how throttling works, we walk through a process of web service creation which takes 1 minute of time to process the message. We call that web service from OSB and limit the number of request messages send to that web service to 5. Once first 5 messages process successfully then only next 5 messages pass to web service for processing.

Follow below steps to create one simple OSB throttling sample.

1.) Create a Synchronous web service which takes 1 minute of time to process the message. For this put a wait activity inside BPEL. Compile it and deploy it on server.
Sync Web Service
Sync Web Service
2.)  Create a new OSB project. Name it and import WSDL and schema of above created synchronous web service to OSB project.

3.) Create Business Service and Proxy Service from above imported WSDL file.

4.) Now to enable throttling inside OSB, Open Business Service then click on "Operational Settings".
Click on Operational Settings
Business Service
5.) Then You can see throttling options available under Operational Setting tab.

OSB Throttling Properties

Throttling State : Check this to enable throttling.

Maximum Concurrency : Number of messages that can be concurrently processed by service.When this limit is reached for business service, all the incoming message for business service are placed in a throttling queue until business service can accept more messages.
             Any change to this setting affects both new messages and those already in the queue. When you increase the value, the Oracle Service Bus run time allows more messages to be sent to the business service after processing those in the queue first. When you decrease the value, the Oracle Service Bus run time places any new messages in a throttling queue until the concurrency setting goes below the new threshold, if you have defined a throttling queue. If you have not defined a throttling queue, the messages are discarded.
             In a cluster environment, the number of messages that can be concurrently processed by a business service is equally divided among the managed servers.

Throttling Queue : Restrict the number of messages in the throttling queue. The length of the throttling queue must be positive integer. All the incoming messages beyond the maximum concurrency limit for the business service are placed in the throttling queue. When the queue is full, the message in the queue with the lowest priority will be removed from the queue if a new incoming message has a higher priority.
If you set this length to be equal to zero, it implies that a throttling queue does not exist for the business service.
        Any change to this setting is dynamically implemented. When you decrease the value for this setting, all the messages beyond the new length are discarded.
Note:You can set this operational setting only if you enable throttling for the business service.
In a cluster environment, this is equally divided among the managed servers.

Message Expiration: Restrict the maximum time (in milliseconds) spent by a message in the throttling queue of a business service. This must be a positive integer. When this time has elapsed, the message is removed from the queue. These messages are referred to as expired messages.
If the message expiration is set to zero for a service, the messages in throttling queue for this service will never expire.
When you increase the value for this setting, the expiration time for the new messages and the messages that are already present in the queue is increased. When you decrease the value, all the messages that have exceeded the new value are immediately discarded.
Note:You can set this operational setting only if you enable throttling for the business service.

6.) Now to test the OSB throttling feature, invoke OSB proxy service multiple times (Load Test) and chek SOA em console, you see only 5 instances as we set that limit.

Throttling Result
Throttling Results
Now if you want to access Throttling Matrices then follow below steps.

1.) Go to Business Service and click on "Operation Setting" tab. Enable Monitoring.
BS Monitoring
Business Service Monitoring
2.) Now run your test again and to check throttling matrices go to OSB Console dash board and click on "Service Health".

OSB DashBorad Service Health
OSB Dash Board Service Health
3.) Click on your business service and you can see throttling matrices.

Throttling Matrices
Throttling Matrices

Reference: Oracle Service Bus Developer's Guide and Operational Guide.


  1. Thanks for the detail. How is this different from placing a queue before OSB proxy service ?

    1. Hi Sridhar,

      you can achieve it by using queue before proxy service but you will to configure everything by your own but here you need to set only three fields and you are done.

      Vivek Garg

  2. Great post Vivek. its very details and informative enough to understand the concept in detail.

  3. Oracle service bus transforms complex architectures into agile integration networks by connecting interactions between services and applications. OSB enrich extreme performance and scalability by applying sophisticated techniques for all dimensions to enhance the growth of organization. It allows continuous logging of messages at runtime and offers full-fledged web based design environment. Visual debugger allows developers to define break points and execution of stack for message processing pipeline enable empirical approach for performance tuning.