I know that async library makes asynchronus implementations really easy when you deal with UI. But I can not see any server side usages of it where it can improve performance. In which server side scenarios await can be used to improve performance?
I know that async library makes asynchronus implementations really easy when you deal with
Share
Asyncis particularly useful in network scenarios, since communication between servers is rarely without latency. Making a request to another webserver (another tier, a third party REST service) or even querying the database are usually done with blocking calls that stop the current thread from doing any work until the remote call has completed. By being able toawaitthe remote call instead, your current thread is freed up to handle other requests, reducing memory pressure (IIS uses 256KB of stack space per thread) and increasing potentials loads (more parallel tasks can run before you run out of threads).Most of the basic plumbing of ASP.NET uses
IHttpHandlerrather thanIHttpAsyncHandler, which means it presumes blocking behavior, but it’s possible to use async in ASP.NET.