views:

682

answers:

2

We have a remoting singleton server running in a separate windows service (let's call her RemotingService). The clients of the RemotingService are ASP.NET instances (many many).

Currently, the clients remoting call RemotingService and blocks while the RemotingService call is serviced. However, the remoting service is getting complicated enough (with more RPC calls and complex algorithms) that the asp.net worker threads are blocked for a significantly long time (4-5 seconds).

According to this msdn article, doing this will not scale well because an asp.net worker thread is blocked for each remoting RPC. It advises switching to async handlers to free up asp.net worker threads.

The purpose of an asynchronous handler is to free up an ASP.NET thread pool thread to service additional requests while the handler is processing the original request.

This seems fine, except the remoting call still takes up a thread from the thread pool. Is this the same thread pool as the asp.net worker threads?

How should I go about turning my remoting singleton server into an async system such that I free up my asp.net worker threads?

I've probably missed out some important information, please let me know if there is anything else you need to know to answer the question.

A: 

The idea behind using the ThreadPool is that through it you can control the amount of synchronous threads, and if those get too many, then the thread pool automatically manages the waiting of newer threads.

The Asp.Net worked thread (AFAIK) doesn't come from the Thread Pool and shouldn't get affected by your call to the remoting service (unless this is a very slow processor, and your remoting function is very CPU intensive - in which case, everything on your computer will be affected).

You could always host the remoting service on a different physical server. In that case, your asp.net worker thread will be totally independent of your remoting call (if the remoting call is called on a separate thread that is).

Vaibhav
As stated in the article linked in the question, the asp.net worker thread does indeed come from the runtimes thread pool.
CVertex
A: 

Take a look at Asynchronous Pages in ASP.NET: http://msdn.microsoft.com/en-us/magazine/cc163725.aspx.

dpp
Thanks, but I'm looking for HttpHandlers specifically.
CVertex