How to create asynchronous web pages in ASP.Net

Take advantage of asynchronous web pages in ASP.Net to improve the responsiveness and scalability of your applications

Become An Insider

Sign up now and get FREE access to hundreds of Insider articles, guides, reviews, interviews, blogs, and other premium content. Learn more.

Asynchronous programming allows you to execute tasks without holding up the execution flow or responsiveness of your application. By taking advantage of asynchronous methods to perform resource-intensive operations, you can increase the throughput of your application while at the same time ensuring that the user interface remains responsive.

Did you know you can leverage asynchronous webpages and asynchronous programming in ASP.Net to improve your application’s performance? In this article we’ll look at how we can build asynchronous webpages in ASP.Net. 

Asynchronous programming in ASP.Net

First we might ask why we need asynchrony in .Net. The .Net runtime maintains a pool of threads to service incoming requests. Each thread on the thread pool consumes 1MB of stack space. That may not sound like much, but if you have hundreds or thousands of threads serving high-latency requests, memory consumption could rise significantly.

Added to this, the thread pool has both a limited number of threads and a limited thread injection rate. So in applications with high concurrency, you can run out of threads—a problem known as thread starvation. When all of the threads available in the thread pool are busy, requests will be queued up by the web server. The web server may even reject requests if the request queue is already full.

To continue reading this article register now