Sunday, 29 September 2013

Should my Play services always be asynchronous calls with promises?

Should my Play services always be asynchronous calls with promises?

I just read that it is recommended to use asynchronous method calls on the
server via promises when executing long running requests. The
documentation says this is because the Play server will block on the
request and not be able to handle concurrent requests.
Does this mean all of my web requests should be asynchronous?
I'm just thinking that if I want to to increase my web pages rendering
times that I would make a series of ajax calls to fetch needed page
regions concurrently. Since I would potentially make multiple ajax calls,
my Play controller methods need to be asynchronous.
Am I understanding this correctly? The syntax is quite verbose so I want
to make certain I don't take this concept overboard. It would seem strange
to me that I have to do this given other web severs such as Glassfish or
IIS automatically handle pooling.

No comments:

Post a Comment