Asynchronous results in Play 2.0 Framework (scala)
asynchronous, playframework, playframework-2.0, scala
Solution
Actually using ASync for calls that might be long or async by essence (call to other remote api like twitter, db, ...) only the client will wait, and not the server (the way Play 2.0 works)
This won't affect how the request it self will be handled, however the whole action will be executed as the result will be promised for further results, using akka actors.
This last point is the key, akka will reuse as much as possible available threads rather keeping them sleeping.
Talking about how I'm using ASync is while using Neo4J REST API to deal with persistent objects, because such usage of database is dependent on the network, bandwidth, query performance, ... it can be cumbersome to have HA solutions, by having most of request waiting. Which in cloud env. will lead you to add processes/instances and finally cost you much ;-)
Problem
reading the documentation Play claims: http://www.playframework.org/documentation/2.0/ScalaAsync "Because of the way Play 2.0 works, the action code must be as fast as possible (ie. non blocking)." It then goes on to show how to write an asynchronous result. Could somebody expand on why "the action code must be as fast as possible"? How does changing to an asynchronous result effect the way the request is handled on a lower level? What are the benefits, aside from abstraction?