Wednesday, June 29, 2011

BizTalk : Issue with Blogical SFTP adapter in load balancing environment

We have used Blogical SFTP adapter in one of our application, it works absolutely fine in dev environment, so we have moved to test environment which is load balancing env with 2 nodes.

Initially we started testing with messages of very less size, everything went well and load balancing env works as expected.

Slowly we have started increasing load(i.e of messages), then starts genaration of duplicates messages in the output.

We analysed that is problem, and what we got to know is SFTP adapter works in load balancing environment as long as message gets processed with in <10 minutes of time.

If message takes >10 min of time, second nod will pick up the processing, hence there will be duplicates in the  output.

On futher anlysis of BLogical SFTP code, code that is causing prob is below:
if( (select count(*)
from [dbo].[SftpWorkingProcess]
where [URI] = '{0}'
and [FileName] ='{2}'
and datediff(minute, [Timestamp], getdate()) <10) = 0)
begin
INSERT INTO [dbo].[SftpWorkingProcess]
           ([URI]
           ,[Node]
           ,[FileName])
     VALUES
           ('{0}','{1}','{2}')

select 1 as WorkInProcess
end
else
select 0 as WorkInProcess


Conclusion:
We created seperate host instances for SFTP adapter, made them work under active-passive mode, so only one node will process the messages.
If Active host instance is down for some reason, manually need to turn other one ON and STOP the other.

If you need Blogical SFTP adapter to work in load balancign env, then you have to tweak the Blogical SFTP code to increase time from 10 minutes or make some design changes on how itworks

No comments:

Post a Comment