0

Does anyone know if AspNetWebSocket (introduced in .NET Framework 4.5) utilizes IOCP for handling requests instead of one thread per Connection?

Oliver Weichhold
  • 10,259
  • 5
  • 45
  • 87
  • Is not AspNetWebSocket on client side? So there is no IOCP involved, just regular tasks. I suppose your question is about the server side.... – Arnaud Bouchez Aug 18 '14 at 06:14

1 Answers1

1

There's a relatively easy way for you to work this out for yourself.

  • Create a simple program.
  • Watch it with a task monitor and look at the number of threads.
  • Create lots of web socket connections to it.
  • See if the thread count increases whilst the connections are alive.
  • Compare the number of connections to the number of threads.

But, what does it matter? As long as the API meets your performance and scalability requirements which you will only discover from performance testing your application.

Note that I would be VERY surprised if the implementation does NOT use IOCP but there's really little point in asking IMHO.

Len Holgate
  • 21,282
  • 4
  • 45
  • 92
  • 1
    Is it an answer? There is just a path to check, without any proof. – Arnaud Bouchez Aug 15 '14 at 11:40
  • The answer is "Why does it matter". IMHO. – Len Holgate Aug 16 '14 at 10:31
  • Are you a Rabbi or a Jesuit? Answering a question by another question? Be aware that it may trigger a stack overflow in stackoverflow... ;) To answer your question, IMHO *it matters very much*, because: 1. there was some identified performance issues when the websocket support was introduced in http.sys (for Windows 8 and 2012) 2. we do not have any proof or feedback that websockets (in general) scale well (even in the node.js IOCP world) 3. It may cost your company a lot of money if your application, with initial low requirements ("time to market" reign!), fails to scale later on... – Arnaud Bouchez Aug 16 '14 at 11:58
  • In that case what matters is "does it scale when used in the way that I intend to use it in my program" and not "does it use IOCP"... May I refer you to my previous comment... – Len Holgate Aug 17 '14 at 23:10
  • If the .Net WebSocket server implementation does not use IOCP, you will have one thread per connection, and your server will eventually not scale, for sure. IOCP is a synonym to scaling, in such context. This is why it matters. From my point of view, I would NOT be suprised if the implementation does NOT use IOCP: in HTTP mode, it uses the http.sys kernel mode server, in RESTful mode, but switch to duplex communication in WebSocket mode. In this mode, you don't rely on http.sys and its IOCP pattern any more, but rather use your own thread for communication. I'm not sure you may use Tasks here. – Arnaud Bouchez Aug 18 '14 at 06:16
  • We're talking in circles. I disagree with you, as you may have gathered. See earlier comments and my original answer. – Len Holgate Aug 18 '14 at 09:31
  • I did warn you that answering with a question would raise a stack overflow on stackoverflow. :) – Arnaud Bouchez Aug 18 '14 at 20:59