Maximize HTTP Connections in BizTalk

August 16, 2011 at 3:04 pm Leave a comment

I’ve just developed a BizTalk application for a customer who has its own in house middleware developed in .Net to communicate with several ERPs across different companies within the enterprise. This technology exposes the middleware components as web services but because incompatibilities between it and the HTTP and SOAP adapters I was forced to quickly implement the connectivity in BizTalk 2009 using a helper class and the System.Net WebRequest/WebResponse classes.

Everything went ok and the information could be sent and received from the customer ERPs. However once I started some stress test in the development environment I found out that regardless how many instances of an orchestration were started BizTalk only sent two requests at the time to the middleware web services. Once any o the requests were processed BizTalk would make another one but never would have more than two concurrently.

image

I disable host throttling completely but the behavior was the same. Once I ruled out any problem due to resource management I started to look for references on how the HTTP protocol administered concurrent connections. As it turn out the RFC 2616 clearly states that “Clients that use persistent connections SHOULD limit the number of simultaneous connections that they maintain to a given server. A single-user client SHOULD NOT maintain more than 2 connections with any server or proxy. A proxy SHOULD use up to 2*N connections to another server or proxy, where N is the number of simultaneously active users. These guidelines are intended to improve HTTP response times and avoid congestion. “

Now it was clear to me that Microsoft was enforcing this consideration practically queuing the HTTP connections coming out of BizTalk so they would not be more than two simultaneous at any given time. But how can I overcome or modify this behavior?

I went back looking for references and I found a Microsoft Commerce Server 2007 article on how to optimize the maximum number of connections from BizTalk to Commerce Server using the HTTP adapter. To do it you simply need to add the following lines to your BTSNtSvc.exe.config file and restart the BizTalk host instance:

    <system.net>
        <connectionManagement>
            <add address = "http://MyCommerceServerComputer" maxconnection = "24" />
            <add address = "*" maxconnection = "2" />
        </connectionManagement>
    </system.net>

Once I did it I was finally able to raise as much connections as I needed to the middleware web services without incurring in any queuing at all.

Increasing the maxconnection attribute results in increased thread pool and processor utilization. With the increase in the maxconnection value, a higher number of I/O threads will be available to make outbound concurrent calls to the Web service. As a result, you process incoming HTTP requests more quickly.

The maxconnection parameter determines how many connections can be made to a specific IP address so you need to use it very carefully and fine tune in order to avoid overwhelming the destination server with some kind of in house DOS attack.

You can find more information on how to fine tune this parameter in Microsoft Patterns & Practices – Improving Web Services Performance

Advertisements

Entry filed under: BizTalk. Tags: , , .

Invoking a DTS Package from BizTalk 2009 x64 Redmond’s 2011 Windows IT Salary Survey

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

Trackback this post  |  Subscribe to the comments via RSS Feed


August 2011
M T W T F S S
« Jul   Sep »
1234567
891011121314
15161718192021
22232425262728
293031  

Categories


%d bloggers like this: