HttpWebRequest taking lot longer compared to ServerXMLHTTP

A

anshu

Hi,

I've to migrate an existing code in asp to asp.Net. The asp code uses
ServerXMLHTTP to call some services. Same thing will be done using
HttpWebRequest in the asp.Net code. The problem is keeping everything
same HttpWebRequest takes around 100-200ms more than ServerXMLHTTP to
call the service.

The bottleneck was HttpWebRequest.GetResponse, which was taking most
of time. Once I set the ContentLength for HttpWebRequest object it
seems bottleneck shifts to HttpRequest.GetRequestStream(). I think its
taking time writing the content to the stream or initializing the
stream.

What ever it is doing 100-200ms extra time per call is too much. Does
some one know a better way to do this?

Regards
Sudhanshu
 
F

Feroze [msft]

Some of the reasons for this delay could be:

1) the backend server is challenging the request for credentials. If the
server is requesting Windows Integrated Authentication, the request will be
authenticated each time, and that will contribute to the delay. This can be
mitigated by using UnsafeAuthenticatedConnectionSharing or using a different
auth scheme on the backend server.

2) The nagle algorithm on Tcp is causing the delay. This can be switched off
through a config setting.
 
A

anshu

Thanks feroze.

As I didn't have any authentication being done I didn't need to use
UnsafeAuthenticatedConnectionSharing. But the turning off use of nagle
algorithm worked. It is now taking less than 300ms.

Is it possible when netwrok traffic is high not using nagle algo.
causes delay?

Regards
Anshu
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top