Let's go through a few situations where asynchronous programming can be handy to improve the responsiveness of the application and the performance of both the application and the server. Some situations are as follows:
- Logging and auditing: Logging and auditing are cross-cutting concerns for applications. If you happen to write your own code for logging and auditing, then calls to the server become slow as they need to write back the logs as well. We can make logging and auditing asynchronous and we should make the implementation stateless wherever possible. This will make sure that callbacks can be returned in a static context so that calls can continue to execute while the response returns to the browser.
- Service calls: Web service calls and database calls can be made asynchronous because, once we make a call to the service...