BizTalk MaxConnections

BizTalk enables users to configure WCF host to limit the maximum connections to a particular address.  Through some painful trial an error I was able to get this setting to do what the documentation so easily described.  To help save others from facing similar issues that i had i decided to help a brother out.

    <system.net>

        <connectionManagement>

              <add address = * maxconnection = 2 />

        </connectionManagement>

    </system.net>

The connectionManagement element in the btsntsvc.config file is designed to specify the number of connections to a given address.  By default BizTalk allows for 2 connections for any given WCF host.    If you are calling http://someiishost/MyService.svc and http://someiishost/MyOtherService.svc BizTalk would only allow 2 simultaneous calls to the someiishost address.  As a result as soon as the request hits the send port, even if a connection is not available,  BizTalk starts a send timeout and if a response is not returned in the allotted Send Time Out it cancels the request and starts a retry. 

 What I originally found was that this setting was particularly useful when trying to increase throughput.  I went from only having 2 services instances running at a time, to 10 (because of WCF service throttling).  I increased the wild card * from 2 to 125.  This worked great, but I ran into major issues when trying to use anything besides a wild card.  The documentation states that the address attribute can be any dns or ip address.  For my environment I found this to be false.  I finally came to the conclusion that the address needed to be prefixed with ‘http://.’  I then found a difference between a computer hosted service, and a service hosted through a header.

 

Computer Hosted Service

For accessing a service on a network that is hosted on a computer I found that the computer name was case sensitive, and could not be fully qualified.  So http://MYCOMPUTERNAME , http://MYCOMPUTERNAME.FullyQualifiied.DomainName.com  did not work.  I even ping’ed COMPUTERNAME, computername, computername.fullyqualified.com all of which resolved to the same address.   So my conclusion was whenever a computer is hosting the service the format is “http://computername” (My blowing I know, wait till you see the next issue).  Example computername setting:

     <system.net>

 <connectionManagement>

<add address = * maxconnection = “125” />

<add address = http://mycomputername&#8221; maxconnection = 2 />

<add address = http://myheader.domain.com&#8221; maxconnection = 4 />

        </connectionManagement>

    </system.net>

Host Header/Load Balanced Service

Ready for your headache?   So I found the solution in our dev environment it was now time to deploy to production.   The main difference between DEV and PROD environment was that the services were hosted behind a load balancer.  As a result we had configured a host header (myheader) for our web site.   I restart the host instances and tested the connectionManagement setting and to my surprise… the throttling setting is not working yet again.  After some more agony I came to find out that the host header had to be fully qualified.   This time the correct address was http://myheader .domain.com .  I do some old school analysis and run ping on myheader and myheader.domain.com get the same IP yet again. 

I still can’t explain why/how the setting was resolving address, but if you are seeing a similar issue, throw all logic aside and try the above.

 

 

Advertisements
Tagged with:
Posted in BizTalk, C#, LinkedIn, Microsoft

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: