Async Pages in ASP.NET 2.0

One of the cool new advanced features in ASP.NET 2.0 is support for pages that execute otherwise blocking operations asynchronously.  This allows ASP.NET to re-use the worker thread while waiting for a completion (for example: calling a remote web-service and waiting for the response) and allows the server to execute much more efficiently.

Jeff Prosise now has a great article on MSDN that describes how it works and how you can take advantage of it:  http://msdn.microsoft.com/msdnmag/issues/05/10/WickedCode/default.aspx

 

2 Comments

  • Yes, the requests of remote web services or remote databases are I/O bounded and we can get 503 "Server Unavailable" errors if a lot of opened requests not have their finish yet. And seems the IAsyncResult to help in this situation, the timeout to do it executable in any case. But what will happen if the server will overloaded by opened threads before we catch the timeout by our application?

    Sincerely, LukCAD

  • Hi Luk,



    The nice thing about this feature is that you actually *aren't* creating new threads when calling the web-service requests. Instead, the current thread doesn't block and is able to be re-used to process a different request. ASP.NET can then use the I/O completion feature of Windows to receive a notification when the data returns, and re-schedule the next available thread to process it. This ends up being very efficient, and can scale to tons of concurrent web-service requests.



    Hope this helps,



    Scott

Comments have been disabled for this content.