Evaluating Play for Composing Web APIs
Yevgeniy Brikman, Principal Software Engineer at Linked In, published a summary of his evaluation of the Play framework, a Java Web Framework.
The thing that really caught my eye was Play's support for asynchronous programming, which would be immensely useful for fetching data from our many backend services in parallel and supporting comet-style interactions.
Play is intended to work with very short requests which can have an arbitrary response time. Play temporarily “suspends” the HTTP requests which remain connected. This requires minimal resources while the process waits, in particular, Play is capable of working of a mini-thread pool (typically the number of processors on your machine plus one). This is what is very different from the “one thread per request” which has been prevalent until now.
Depending on the load profile of the server, the evented approach may allow a far greater degree of concurrency than the threaded model; for persistent connections as in comet, the evented model is the only way to go.
Play offers several models to handle requests asynchronously. One can define “Promise” values (which can be composed to into a “waitall” statement), in that case, the execution suspends until all the requests have returned which comes handy when you need to fetch data from multiple Web APIs for instance. Play also supports a callback model using Java anonymous inner classes. Play also allows to define a fixed time after which the request is handled.
the community seems very active, hot reload works as advertised, it's reasonably DRY, and the support for async I/O is as good as I've seen in the JVM world. There are a few gotchas and the documentation/JavaDoc needs some improvement, but we will be evaluating Play further to see if it fits in the LinkedIn ecosystem.
With the rise of (mobile) composite applications and Web APIs, it seems that a thin composition middle-tier which acts an intermediary between (mobile) clients and Web APIs is emerging. Could frameworks like Play or Node.js will become critical to mobile solution architectures? What’s your take on it?
Olav Maassen, Liz Keogh & Chris Matts Mar 08, 2014