Last post Jun 09, 2017 02:47 PM by bruce (sqlwork.com)
Jun 09, 2017 07:08 AM|kaarthikeyan|LINK
Could any one precise me the difference between .net framework mvc and .net core mvc in code level
whats purpose that all methods in .net core are async?
Jun 09, 2017 10:03 AM|Dmitry Sikorsky|LINK
If you have some controller action that is, for example, sending email, your controller will wait for the mail server response if the action is synchronous. But if the action is async, your controller and application will be able to process other requests
while waiting for the mail server response. Or db server response, or file downloading etc. So any long-running process.
Jun 09, 2017 10:27 AM|kaarthikeyan|LINK
Jun 09, 2017 02:47 PM|bruce (sqlwork.com)|LINK
the reason for all the async methods in asp.net core is the new request pipeline.
the old asp.net pipeline used thread pools. there was a request (input) thread, a request thread, and a response thread (output). generally the pool size was fairly large and thread could be dedicated to each request. this allowed high concurrency, but had
a large overhead with thread management.
the new asp.net pipeline is based on using async i/o to get concurrency (its the same pipeline node.js uses). while a thread is doing one request async, it can do another requests processing. the new new pipeline is only 1 thread per cpu (a step up from
the node.js pipeline that only uses 1 thread for all requests).
this means to get concurrency in the new pipeline, the code must use async when making i/o requests (disk, network, or database) or the pipeline will be blocked. so if you have compute bound requests or blocking sync request, you should use a worker thread
to free up the thread.
this may seem more complex, but for the first time asp.net pipeline is faster than node.js.