Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Limiting performance factors of WebSocket in ASP.NET 4.5?

Tags:

MSDN documentation doesn't seem to have good coverage on ASP.net 4.5 support of HTML5 WebSockets protocol!

This is what I'm looking for:

  • How many live connections can a server/application/cpu support?
  • Is there any maximum number of incoming connections that could be set/get?
  • What is the optimum number of sockets per application regardless of data transfer over the socket?

Update:

Requests from flash RTMP sockets (an alternative to websocket) could be well configured on Adobe Media Server application server. Isn't any sort of configurations for number of requests, ideal time, size of chunks, ... for ASP.net inside application or IIS 8 configuration?

like image 582
Kamyar Nazeri Avatar asked Apr 02 '12 19:04

Kamyar Nazeri


People also ask

What can block WebSocket connection?

A blocked connection can be caused by: AdBlocker / Cookie blocker browser extensions. Antivirus and Firewall software. Proxy and VPN connections.

Would WebSockets be able to handle 1000000 concurrent connections?

With at least 30 GiB RAM you can handle 1 million concurrent sockets.

Are WebSockets CPU intensive?

There are several challenges you have to overcome because the WebSockets protocol is more CPU demanding on the client's side than on the server's side. At the same time you need a lot of RAM to store information about open connections if you have millions of them.

How many WebSockets can a client handle?

By default, a single server can handle 65,536 socket connections just because it's the max number of TCP ports available.


1 Answers

To whomever may be interested:

  • Over 100k WebSocket connections can be made to a single server running ASP.NET 4.5
  • WebSocket connections are initiated by a HTTP handshake, hence some of the IIS throttles that apply to HTTP requests will also apply to WebSockets. appConcurrentRequestLimit in the IIS Configuration can be used to set the maximum concurrent requests per application:

    <serverRuntime appConcurrentRequestLimit="250000" /> 
  • Maximum concurrent connections to an ASP.net 4 Web Application can be set with ApplicationPool's maxConcurrentRequestsPerCPU property:

    <system.web>     <applicationPool maxConcurrentRequestsPerCPU="20000" /> </system.web> 
  • When the total amount of connections exceed the maxConcurrentRequestsPerCPU setting, ASP.NET will start throttling requests using a queue. To control the size of the queue, you can tweak the machine.config requestQueueLimit:

    <processModel autoConfig="false" requestQueueLimit="250000" /> 
  • The following performance counters should be considered while conducting concurrency testing and adjusting the optimum settings detailed above:

    • NET CLR Memory #bytes in all Heaps
    • ASP.NET\Requests Current - Queued - Rejected
    • Processor Information\Processor Time
    • TCP/IP Connections Established
    • Web Service\Current Connections - Maximum Connections
    • .NET CLR LocksAndThreads\ # of current logical Threads - # of current physical Threads
like image 188
Kamyar Nazeri Avatar answered Oct 16 '22 07:10

Kamyar Nazeri