In 2015, the Play Framework has gained popularity as one of the most used frameworks in Scala projects on Github. It is no surprise that developers (Scala and Java alike) search for APM tools that provide insights of performance patterns and bottlenecks that occur in their Play web applications.
In this article, we are going to look at how TraceView addresses various performance concerns in a Play based web application and how it provides clean as well as detailed analysis that allows users to quickly pinpoint production performance problems.
Play Asynchronous Actions and Library Usage
“Internally, Play Framework is asynchronous from the bottom up. Play handles every request in an asynchronous, non-blocking way…Because of the way Play works, action code must be as fast as possible, i.e., non-blocking” – Play Framework
It is common to develop a Play Controller’s action to work in an asynchronous manner. In fact, many Play libraries such as the Play Controller and Play WS provide APIs that return asynchronous results (Future/Promise etc). It is challenging to understand and monitor application performance when there are many activities happening simultaneously. Fortunately, TraceView has the ability to keep track of asynchronous operations and show details of each of them at a per-request level.
Trace Details Page
The screenshot above demonstrates that within a request to a Play application 3 HTTP calls were made simultaneously to the Google maps API via the Play WS library. TraceView is able to identify the timeline and duration of each of the 3 calls (the blue bars) with details such as the target URL and response HTTP status code.
The Details: Play Controllers and Play Template Rendering (Twirl)
Performance statistics (database queries, latency distribution, etc.) on Play Controllers are at the fingertips in both aggregation and per-request formats. TraceView recognizes controller flows of Play (Scala/Java) applications and records the controller classes as well as any methods involved. With this data provided, users are able to easily analyze controller constructs that underperform.
Controller Filter on the TraceView App Server Page
The Play instrumentation does not just stop at the controller level. TraceView gives granular information on Play Template Rendering (Twirl) as well as indicates each of the template items that are rendered within a request.
Trace Details Page for Play Template usage
The Trace Details page above illustrates a common example of Play Template usage where a main dashboard template renders multiple child templates which are all captured by TraceView on per request level.
Automatically Instrument Usages on Other Scala/Java Module
TraceView has wide and expanding coverage on Scala and Java driver clients and frameworks – JDBC, NoSQL (MongoDB, hbase, cassandra), caching frameworks and many more. Any operations on those modules within the Play application will be captured automatically and integrated into the same performance data. This enables complete and centralized diagnostics on any Play application with a single APM solution.
An example of database access within a Play portal page
Come try our Play instrumentation today in just few easy steps! (https://docs.appneta.com/java)