Last post Aug 19, 2005 11:42 PM by Lemmsjid
Aug 19, 2005 06:13 PM|bnathanson|LINK
I really need any advice anyone can give me; I'm at my wits end. I have an application that consumes a large number of web services in each transaction -- mainly because we're using a web services enabler to integrate with a legacy mainframe system. This
has worked really well using WinHTTP, but I'm now trying to get onto managed .Net code using System.Net and the performance has degraded severely. It still works, but it's not nearly as fast, which is a problem when you make as many web services calls as
we are making. Anybody have any suggestions on what I might be doing wrong:
Here's the System.Net code that I'm using to consume the services...
Dim oURI As New System.Uri(msURL)
Dim oRequest As HttpWebRequest
oRequest = CType(WebRequest.CreateDefault(oURI), HttpWebRequest)
oRequest.Method = "POST"
oRequest.ContentType = "text/html"
oRequest.KeepAlive = True
oRequest.Timeout() = miConnectorTimeout
oRequest.Credentials = New NetworkCredential(msUserID, msPassword)
Dim oResponse As HttpWebResponse
oRequest.ContentLength = sHeader.Length
Dim oStream As New StreamWriter(oRequest.GetRequestStream, Encoding.ASCII)
oResponse = CType(oRequest.GetResponse, HttpWebResponse)
If oResponse.StatusCode = 200 Then
Dim oReader As New StreamReader(oResponse.GetResponseStream)
ElseIf oResponse.StatusCode = 401 Then
And here's the equivalent WinHTTP code that performs nearly twice as fast:
Dim oXMLServer As New WinHttpRequest
Const HTTPREQUEST_SETCREDENTIALS_FOR_SERVER = 0
Const HTTPREQUEST_SETCREDENTIALS_FOR_PROXY = 1
oXMLServer.Open("POST", msURL, False)
oXMLServer.SetCredentials(msUserID, msPassword, HTTPREQUEST_SETCREDENTIALS_FOR_SERVER)
If oXMLServer.Status = 200 Then
ElseIf oXMLServer.Status = 401 Then
If anyone has any thoughts at all on how I might be able to switch to managed code without sacrificing the performance, please help!!!
Aug 19, 2005 11:42 PM|Lemmsjid|LINK
Check your "maxconnection" setting in machine.config. This setting determines how many simultaneous connections a web application can open to a particular host. This defaults to 2 and can quickly become a bottleneck, especially when making large numbers
of web service calls. Raise it to something much higher (I believe the ideal is 12 per processor).