ASP.NET -> Ajax And Comet - Braindump
-
Hey, Im trying to implement long-lived ajax connections (aka the comet pattern) in a WCF service I have written. The issue is the obvious gobbling up of ASP.NET threads - which would literally limit 1 per connection. So, ideas started flying around - and the idea of an Async HTTP handler came to light, with the ability to send the processing of the wait loop in the connection to a different thread thus returning the ASP.NET thread back to the pool to process other page requests. THe bottle neck now still lives on whatever I employ to handle the waitloop (probably a custom TCP service, keeping a socket open) So, I thought some more and wondered if it would be possible to have a Async Handler, that handed off execution to a service say 100 threads in which are typically looping around and these can be used to handle the wait loop for the long lived connection. Now if more than 100 connections exist, I thought about putting more than 1 connection on the same thread, which I think would require a custom TCP server. e.g Client -> ASP.NET ASync Handler -> Open Connection To Server Async -> Send Request -> Async Wait For Response -> Async On the service I would use a non blocking socket calls (e.g the IO Completion ports, beginreceive etc..) to accept the connections and send and receive data, and it would put the connection handling the request in some sort of queue that can be handled by one of the 100 threads in the service. If more than 100 connections come in, it would start to reuse the while loops (e.g iterate, test messages for connection 1, iterate, test messages for connection 2... iterate, test messages for connection 3... ) Obviously those 100 threads would be configurable, and I may only need 10, or twenty ... I am assuming that using sockets I am not consuming a thread until a Begin operation, e.g inbetween they waiting to be resused, which would essentially make the system scalable? And because Im not handling the wait loop in the End operation of the socket call, im not keeping the socket thread open, im handing it of to one of the 100 (or 10, 20) threads in the service which can queue automatically... Any thoughts? I hope i Have explained myself correctly... THanks, James
James Simpson Web Developer imebgo@hotmail.com P S - This is what part of the alphabet would look like if Q and R were eliminated
Mitch Hedberg -
Hey, Im trying to implement long-lived ajax connections (aka the comet pattern) in a WCF service I have written. The issue is the obvious gobbling up of ASP.NET threads - which would literally limit 1 per connection. So, ideas started flying around - and the idea of an Async HTTP handler came to light, with the ability to send the processing of the wait loop in the connection to a different thread thus returning the ASP.NET thread back to the pool to process other page requests. THe bottle neck now still lives on whatever I employ to handle the waitloop (probably a custom TCP service, keeping a socket open) So, I thought some more and wondered if it would be possible to have a Async Handler, that handed off execution to a service say 100 threads in which are typically looping around and these can be used to handle the wait loop for the long lived connection. Now if more than 100 connections exist, I thought about putting more than 1 connection on the same thread, which I think would require a custom TCP server. e.g Client -> ASP.NET ASync Handler -> Open Connection To Server Async -> Send Request -> Async Wait For Response -> Async On the service I would use a non blocking socket calls (e.g the IO Completion ports, beginreceive etc..) to accept the connections and send and receive data, and it would put the connection handling the request in some sort of queue that can be handled by one of the 100 threads in the service. If more than 100 connections come in, it would start to reuse the while loops (e.g iterate, test messages for connection 1, iterate, test messages for connection 2... iterate, test messages for connection 3... ) Obviously those 100 threads would be configurable, and I may only need 10, or twenty ... I am assuming that using sockets I am not consuming a thread until a Begin operation, e.g inbetween they waiting to be resused, which would essentially make the system scalable? And because Im not handling the wait loop in the End operation of the socket call, im not keeping the socket thread open, im handing it of to one of the 100 (or 10, 20) threads in the service which can queue automatically... Any thoughts? I hope i Have explained myself correctly... THanks, James
James Simpson Web Developer imebgo@hotmail.com P S - This is what part of the alphabet would look like if Q and R were eliminated
Mitch Hedberg -
I read that article, and the comments indicate its using Flash Component for data transfer, which would explain how we can have a socken in the browser. Im looking for a method that does not use anything on the client, apart from the usual Javascript available.. Its a different approach - so Im going to download the article code tonight and see how helpful it is. Thanks, James
James Simpson Web Developer imebgo@hotmail.com P S - This is what part of the alphabet would look like if Q and R were eliminated
Mitch Hedberg