Monday, June 13, 2011

jca.retry.backoff in SOA Suite 11g

Some new properties have been added in JCA adapters Endpoint properties one of them is jca.retry.backoff.

You can see the defintion of the following properties from here

http://download.oracle.com/docs/cd/E17904_01/integration.1111/e10226/bc_config.htm#SOAAG37202

To understand its use case i have create a simple process to check how does it work,My simple process start with pollin on a database table and after transformation it tries to write a file to a location.

In my case i have revoked the write permission in my file location so as to force my adapter to retry.

So my process looks something like this.



Now initially i have defined these two parameters in my composite.xml for the file adapter reference

<property name="jca.retry.count" type="xs:int" many="false" override="may">3</property>
<property name="jca.retry.interval" type="xs:int" many="false"
override="may">1</property>

Which means rety after a interval of 1 seconds for three time,Now i will check this process and see how my output comes

Now check for the retry time interval.

One instance is created and it retries 3 times on a regular interval of 1 second.
so in all we have 4 adapter invocation so these properties are very much working as expected.



Now i will add the following properties to my jca adapter reference

<property name="jca.retry.count" type="xs:int" many="false" override="may">3</property>
<property name="jca.retry.interval" type="xs:int" many="false"
override="may">1</property>
<property name="jca.retry.backoff" type="xs:int" many="false"
override="may">2</property>
<property name="jca.retry.maxInterval" type="xs:string" many="false"
override="may">120</property>

This will help us to understand how this jca.retry.backoff works.

Now as you can see the output you will find a difference in timing for retry

The first retry start at an interval of 1 second

The second retry start at an interval of 2 second and

The third retry start at an interval of 4 second.

So i believe we are getting some trend here but it is still not clear.

Is this jca.retry.backoff adding cumulatively a delay of 2 second or is it something else




We will just try one more scenario to come to an conclusion as what exactly this proeprty do in combination with jca.retry.maxInterval

Now i will use the following property in my outbound file adapter

<property name="jca.retry.count" type="xs:int" many="false" override="may">3</property>
<property name="jca.retry.interval" type="xs:int" many="false"
override="may">1</property>
<property name="jca.retry.backoff" type="xs:int" many="false"
override="may">3</property>
<property name="jca.retry.maxInterval" type="xs:string" many="false"
override="may">120</property>

The only difference in that rety backoff is 3 this time now we will invoke the process with the following settings to see how does it work.

Now this time the results are

The first retry happens after 1 second(after default)

The second retry happens after 3seconds(after first) and

The third rety happens after 9 second (after second)

So from the previous and this result we can make a relation that the time delay between the call is increasing by Geometric progression of the jca rety backoff factor

i.e initially it was 1 2 4 and now it is 1 3 and 9





So we have got some idea about this property but still i am not clear with the jca.retry.maxInterval property ,as how it was used so we will make some change in this property and see how it works in combination with backoff property.

So now i am using following porperty in my configuration

<property name="jca.retry.count" type="xs:int" many="false" override="may">3</property>
<property name="jca.retry.interval" type="xs:int" many="false"
override="may">1</property>
<property name="jca.retry.backoff" type="xs:int" many="false"
override="may">3</property>
<property name="jca.retry.maxInterval" type="xs:string" many="false"
override="may">60</property>

Now i will see how does it work to get a complete idea.

i invoked the service and the result was almost same as my previous result.

The first rety happens after 1 second

The second retry happens after 3 seconds and

The third retry happens after 9 seconds

so as per my testing this property jca.retry.maxInterval is a waste

but any how we have got the idea on this property jca.retry.backoff

That it increase the delay among retry in a Geometric progression.



If you have defined your fault handling also for a retry then the jca fault handling with run within each fault handling retry.

The same is explained properly in the following document

http://download.oracle.com/docs/cd/E17904_01/integration.1111/e10224/bp_faults.htm#SOASE9928

Example 11-17 Retry Parameters

4 comments:

Anonymous said...

Very good explanation and you are right in saying jca.retry.maxInterval is a waste property ;)

Anonymous said...

thanks very much its a good article helped me understand backoff sathish

AKSHIT KHADE said...

Thanks for the explanation.. "jca.retry.maxInterval" property is not waste :-) . It works with "jca.retry.backoff" property. As you explained backoff increases the delay among retry interval in a Geometric progression. So the maxInterval controls the max value of retry interval (if backoff > 1). Means if you wish to make sure that retry interval should not increase to huge value when you are using backoff property then maxInterval property is the thing which will help you do this. Let me explain with below example. Correct me if I am wrong :-)
Ex:
jca.retry.count=7
jca.retry.interval=1
jca.retry.backoff=2
jca.retry.maxInterval=30

The first retry will start at an interval of 1 second
The second retry will start at an interval of 2 second and
The third retry will start at an interval of 4 second.
The fourth retry will start at an interval of 8 second.
The fifth retry will start at an interval of 16 second.
The sixth retry should start at an interval of 32 second. But it will not since we have defined max retry interval can be 30 and it can not exceed above 30.

Hope it makes sense. You can also read the info about these properties on below oracle link
https://docs.oracle.com/cd/E15523_01/integration.1111/e10231/life_cycle.htm#TKADP199

Regards,
Akshit Khade

Anonymous said...

WHy not just read the doc to understand what backoff does?