Making your code asynchronous

Let's begin by examining a scenario where you have an application that might be lacking in the performance department. While users feel it is very unresponsive, yet when the performance counters on the host machine are examined, it doesn't seem to be doing all that much. The odds are high that your existing code is performing a slow operation and blocking the execution thread while it waits for this operation to complete, which prevents other code from executing.

It gets even worse in web applications that come under heavy load. Soon, every request thread that gets blocked becomes a point where other requests can get queued, and before long, your application server starts throwing 503 Service Unavailable errors.

Time ...

Get Visual Studio 2015 Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.