Oracle SOA Suite 12c: throttling control in BPEL to avoid contentionPublished on: Author: Eduardo Barra Cordeiro Category: Oracle
When you work with inbound JCA adapters (for instance JMS, AQ, MQ) in SOA Suite, you need to be able to control the TPS (transactions per second). This will allow you to avoid stuck threads, in case you receive unexpected batch messages in the domain load tuning. In this short post, I will show how to set up the parameters and calculate your TPS.
- Add the minimumDelayBetweenMessages in the code
This is the parameter that will do the magic. It adds a thread sleep as part of the instance execution—that is, on a per polling thread basis. The setting is measured in milliseconds.
- How to do that?
The property will be added in the SCA file (composite.xml) in your project. It is a <Service> properties related with the partner link adapter that connects in your JCA resource.
Note: it is not a binding property.
When you deploy your code in the SOA server, you will be able to check the value in the JCA adapter using EM console. You can also change it on the fly, in case you need to tune the value and test it.
3. How to calculate the TPS
Consider a scenario where you need to control throttling in a domain that consists of:
- 4 managed servers nodes
- 2 threads per adapter (set in InboundThreadCount parameter)
- 500 milliseconds (0.5 second) set in minimumDelayBetweenMessages
To calculate the TPS, use this formula:
(MS nodes * thread count) / (minimumDelay/1000)
In this example you will have (4 * 2) = 8 threads connected in the queue. Each thread will delay 500/1000 = 0.5 second before pushing a new message. You will have max 16 TPS.
According Oracle documentation
Accordingly with Oracle documentation, if the instance execution itself (the time between the two most recent message publications) exceeds the value of minimumDelayBetweenMessages, no delay will be added (hence the name "minimumDelay...").
This means that when you set the minimumDelay, you will also set the maximum TPS. This can be lower in case your thread transaction execution time is higher than the minimumDelay parameter.