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.