English 中文(简体)
Play 2.0框架(scala)的非同步结果
原标题:Asynchronous results in Play 2.0 Framework (scala)

阅读文件

http://www.playframework.org/document/2.0/ScalaAsync

"因为Play 2. 0的工作方式, 行动代码必须尽可能快(如,不阻塞)"

接着,它又展示了如何写出一个非同步的结果。 有人能详细解释为什么“行动守则必须尽快”吗? 改变为非同步的结果如何影响下层处理请求的方式? 除了抽象外,好处是什么?

最佳回答

使用 Async 来拨打电话, 电话可能长, 或本质上快( 电话给Twitter、 db、...等其他远程pi), 只有客户会等待, 而不是服务器( Play 2. 0 工作方式) 。

这不会影响如何处理它自己提出的要求,然而,整个行动将付诸执行,结果将承诺利用Akka的行动者取得进一步的结果。

最后一点是关键,Akka将尽可能重新利用现有的线条,而不是让他们睡着。

谈到我在使用ASync时如何使用Neo4J REST API来处理持久性物体,因为数据库的使用取决于网络、带宽、查询性能.如果有HA解决方案,大多数请求都等待,这可能会很麻烦。在云中,这将导致您添加过程/内容,并最终花费您很多费用;-)

问题回答

暂无回答




相关问题
Asynchronous data loading in Entity-Framework?

Did anyone hear about asynchronous executing of an EF query? I want my items control to be filled right when the form loads and the user should be able to view the list while the rest of the items ...

Does PHP support asynchronous programming?

I m new to PHP. I am familiar with ASP.NET which support asynchronous programming. That is, if one request needs to do some I/O job. It is suggested to program the web page with BeginProcess/...

How to cancel an asynchronous call?

How to cancel an asynchronous call? The .NET APM doesn t seem to support this operation. I have the following loop in my code which spawns multiple threads on the ThreadPool. When I click a button on ...

What can cause select to block in Python?

Here s a snippet of code I m using in a loop: while True: print loop rlist, wlist, xlist = select.select(readers, [], [], TIMEOUT) print selected # do stuff At a certain point, ...

热门标签