Why use async controllers, when IIS already handles the request concurrency?

后端 未结 3 1671
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-11 14:12

I wonder why I should bother using async Task on controllers, when IIS already handles the concurrency for me?

http://msdn.microsoft.com/en-us/library/dd560842.aspx

3条回答
  •  自闭症患者
    2021-01-11 14:51

    When processing the request, you are likely to access resources that may take a significant amount of time (eg. round trip to a database is likely to be tens of milliseconds, often slower).

    If you use synchronous operations to get these resources then the processing thread is blocked until that IO completes.

    Using asynchronous operations allows that same IIS thread to be used for something more useful while the IO completes. In higher load web sites this can be a significant scalability difference.

提交回复
热议问题