2

I am using an IHttpAsyncHandler to serve a comet / long-polling request. The handler holds the connection open and saves the MyAsyncResult object in a static ConcurrentSet<MyAsyncResult>.

When a separate request is made (the request that causes the comet to response), the program finds the MyAsyncResult object in the list and completes the request.

My problem is, when I change my application to run in a Webgarden, this static variable isn't going to be shared across all the worker processes, so this implementation isn't going to work..

Now, I have no way of storing the MyAsyncResult object in an SQL database, or any kind of object that could be useful (like the IHttpHandler itself, or a delegate pointing to the EndProcessRequest method, etc). I could store certain IDs and strings in an SQL database and continuously check for new values, but this seems expensive and kind of defeats the object of using long-polling in the first place.

Is there any way I can share my static ConcurrentSet across a webgarden? Or any other way I can get the IHttpAsyncHandler that is sat there waiting for the signal to send it's response?

Edit:

If there is no way I can share variables across processes, is there a way I can broadcast to all other worker processes? All I'd need here is a single signal with two integer parameters.

Connell
  • 13,925
  • 11
  • 59
  • 92

0 Answers0