Book Image

Visual Studio 2015 Cookbook - Second Edition

By : Jeff Martin
Book Image

Visual Studio 2015 Cookbook - Second Edition

By: Jeff Martin

Overview of this book

Visual Studio 2015 is the premier tool for developers targeting the Microsoft platform. Learning how to effectively use this technology can enhance your productivity while simplifying your most common tasks, allowing you more time to focus on your project. Visual Studio 2015 is packed with improvements that increase productivity, and this book walks you through each one in succession to help you smooth your workflow and get more accomplished. From customization and the interface to code snippets and debugging, the Visual Studio upgrade expands your options — and this book is your fast-track guide to getting on board quickly. Visual Studio 2015 Cookbook will introduce you to all the new areas of Visual Studio and how they can quickly be put to use to improve your everyday development tasks. With this book, you will learn not only what VS2015 offers, but what it takes to put it to work for your projects.
Table of Contents (17 chapters)
Visual Studio 2015 Cookbook Second Edition
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

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 to take that synchronous code, stick an a at the front, and take advantage of your production system's hardware more efficiently. Keep in mind that before you make all of your code asynchronous, you should understand where it blocks, and where it...