Self-Hosted WCF Basic HTTP Binding does not support more than 1000 concurrent requests

I myself hosted the WCF service on BasicHttpBinding consumed by ASMX Client . I simulate the simultaneous loading of users of 1200 users . The service method takes a string parameter and returns a string. Data exchange is less than 10 KB. The request processing time is fixed after 2 seconds using the Thread.Sleep (2000) instruction. Nothing extra. I deleted all DB Hits / business logic.

The same piece of code works fine for 1000 concurrent users. I get the following error when I increase the number to 1200 users.

 System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a receive. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags) at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) --- End of inner exception stack trace --- at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) at System.Net.PooledStream.Read(Byte[] buffer, Int32 offset, Int32 size) at System.Net.Connection.SyncRead(HttpWebRequest request, Boolean userRetrievedStream, Boolean probeRead) --- End of inner exception stack trace --- at System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequest request) at System.Web.Services.Protocols.HttpWebClientProtocol.GetWebResponse(WebRequest request) at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) at WCF.Throttling.Client.Service.Function2(String param) 

This exception is often reported as a DataContract mismatch and large data exchange. But never when performing a load test. I looked through enough and tried most of the options, which include,

  • Server-side tracing and message logging is enabled. But there were no mistakes.
  • To overcome the port leak, MaxUserPort is set to 65535, and TcpTimedWaitDelay is set to 30 seconds.
  • MaxConcurrent calls have a value of 600 and a value of MaxConcurrentInstances is 1200.
  • Open, Close, Send and Receive timeouts are set to 10 minutes.
  • The HTTPWebRequest KeepAlive is set to false.

I have not been able to solve the problem in the last two days.

Any help would be appreciated.

Thanks.

+4
source share
2 answers

If there are no errors in the WCF logs on the service side, I suspect that you are pushing some limit at the HTTP.SYS driver level, which leads to requests being turned off before the service application sees them. I think the default limit in the request queue for a particular application might be 1000.

I am not an expert on HTTP.SYS, but you can get some idea by doing:

 netsh http show servicestate 
0
source

I saw similar problems on different servers, depending on their processors and RAM. You did not specify the type of server, how it was updated (XP Pro or Server 2003 upgraded to Server 2008), etc. The way I solved the problem is to check x: \ Windows \ Microsoft.NET \ Framework [version] \ Config \ machine.config. Obviously, selecting an “unlimited” connection through IIS does not mean a “unlimited” connection. The number of connections I came across failed after 11 requests in the same millisecond.

The problem is related to the number of connections coming from one source. The performance testing tool was located on the same PC that has the same IP address. The machine.config file contains a limit on the number of connections from a single source.

0
source

Source: https://habr.com/ru/post/1333190/


All Articles