1

I am implementing a comet using AsyncHttpHandlers in my current asp.net application. According to my implementation client initially sends Notification Hook request to server (with its user id) on AsyncHttpHandler, and on server side I maintain a Global (Application level) dictionary of userid(key) and IAynsResult (value). So when ever a request is received to send notification to a user I just pick the matching IAsyncResult from the Global Dictionary and send response to the client user.

My concern is, is maintaing a Dictionary of Userid and IAsyncResult at Application level a good design? I feel it will put a lot of load on the server, at the time of high traffic. Is there any other way I can achieve the comet. or what will be the good design to achieve comet for high traffic scenarios.

Sumit
  • 2,932
  • 6
  • 32
  • 54

1 Answers1

1

That depends on the number of requests to the server, IAsyncResult request utilizes the process's ThreadPool which automatically manages the number of worker threads. These threads are assigned a task, run them to completion, then are returned to the ThreadPool for reuse.

The ThreadPool is used by other aspects of .NET, and provides a limited number of threads. If you overuse it, there is the possibility your tasks will be blocked waiting for others to complete!

So basically, running a comet server on an ASP.net needs either a strong hardware, or application distribution over several servers.

I would recommend HTML5 WebSocket, which is the W3C API for implementing sockets in HTML and is easier to setup on an ASP.net server:

SignalR for .net 4

ASP.net WebSocket API for .net 4.5

Kamyar Nazeri
  • 25,786
  • 15
  • 50
  • 87
  • is it possible to create a video chat server using HTML5 Websockets ?? – Sumit Apr 06 '12 at 08:16
  • No, it's not! The streaming part is OK,however you can not render video streamed in such a way: http://groups.google.com/a/chromium.org/group/chromium-html5/browse_thread/thread/bec3ac48af5766b1?pli=1 – Kamyar Nazeri Apr 06 '12 at 08:50
  • thanks for the reply, i only want to implement streaming part using websockets. – Sumit Apr 06 '12 at 10:50