异步任务< ActionResult> vs ActionResult [英] Async Task<ActionResult> vs ActionResult

查看:704
本文介绍了异步任务< ActionResult> vs ActionResult的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我是MVC(nooob)的新手,并且遵循MS Tutorial,它刚刚引入了async Task< actionresult>并显示了好处。这是否意味着您应该始终使用异步任务而不是正常的ActionResult(这就是它开始教程的方式)。



如果异步任务< actionresult>加快性能等,不应该总是使用它们吗?



我问过我的同事们,他们从来没有见过这样做过,所以我想id问代码项目值得信赖的人。



我假设我将来还需要使用Ajax请求,因为ActionResults仅用于加载每个单个页面,页面中的操作将使用Ajax请求运行。?

Hi,
i'm new to MVC (nooob), and following MS Tutorial, and its just introduced async Task<actionresult> and shows the benefits. Does it mean that you should use async Task all the time rather than the normal ActionResult, (which is how it started the tutorial).

If async tasks<actionresult> speed up the performance etc, shouldn't these always be used?

I asked my fellow programmers and they've never seen it done this way so i thought id ask the trusty minds of Code Project.

and i'm assuming i'd still need to use Ajax requests in the future, as the ActionResults are only using for loading each individual page, the actions within the page will be ran using Ajax requests.?

推荐答案

响应是Async的主要优势。 Ajax async与客户端(浏览器)相关,异步Action Result与服务器相关。

为什么异步?



随着今天的应用程序越来越多地连接,也可能是长期运行的任务或阻塞操作,例如网络I / O或数据库操作。因此,通过在后台启动它们并返回它们来隐藏这些操作的延迟非常重要。尽可能快地到用户界面。这里异步进入图片,响应性



为了加快性能,你应该继续并行编程



为什么要进行并行编程?

随着今天的数据集越来越大,计算越来越复杂。因此,在这种情况下,通过将工作负载分成块然后同时执行这些块来减少这些CPU绑定操作的执行时间非常重要。我们可以将其称为并行。显然它会为我们的应用程序提供高性能。



希望这有助于
Responsiveness is the main advantage of Async. Ajax async is related with the client(browser) and async Action Result is related with the server.
Why Asynchronous?

With today’s application’s growing more and more connected and also potentially long running tasks or blocking operations such as Network I/O or Database Operations.So it’s very important to hide the latency of these operations by starting them in background and returning back to the user interface quickly as possible. Here Asynchronous come in to the picture, Responsiveness

For speed up the performance you should continue with Parallel Programming

Why Parallel programming?
With today’s data sets growing larger and computations growing more complex. So it’s very important to reduce the execution time of these CPU-bound operations, in this case, by dividing the workload into chunks and then executing those chunks simultaneously. We can call this as "Parallel" .Obviously it will give high performance to our application.

Hope this helps


这篇关于异步任务&lt; ActionResult&gt; vs ActionResult的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆