• About Us
  • Blog
  • Basket
  • Account
  • Sign In
  •  

Java API

Performance Monitoring

In this era of high speed broadband and the abundance of libraries that simplify Web development, it is very easy to make the mistake of not taking bandwidth into account. Despite the spread of 4G networks and even the plans for 5G networks, the reality is such, that most mobile operators are struggling to consistently deliver a reliable 3G service in all areas.

Customers using our Enterprise data file could benefit from the performance monitoring JavaScript snippet, built into the data file, which allows the detection of slow connections. Detecting a slow connection allows you to send a response with only the most essential HTML page elements included so that no customer is left behind, regardless of the quality of their internet connection.

Using Performance Monitoring

First, the FODBW has to be constructed on the page:

<html>
  <head>
    <title>Test Page</title>
    <script src="/51D/core.js" type="text/javascript" ></script>
    <script>new FODBW();</script>
    ...

This creates a cookie with a timestamp that the server can  use to measure how quickly responses are received. The API creates 5 request attributes that can be accessed from the request object in a Servlet with the getAttribute method as follows:

protected void processRequest(HttpServletRequest request, 
                              HttpServletResponse response)
                              throws ServletException, IOException {
        ...
        Long value = (Long)request.getAttribute("51D_LastResponseTime");
        ...
}

Note that if the FODBW hasn't been run and not enough bandwidth data has been collected, the getAttribute method will return null.

Bandwidth Attributes

When used with the Enterprise version of the data set the API will return information about the performance of the connection and response times via the Context. The values change for every page request and will only start to appear after the 2nd request to the web server. The following properties are available:

AttributeTypeDescription
51D_LastResponseTime long The time taken for the web page to start rendering after the user initiated the request in milliseconds. May return -1 if there is not enough data to calculate this.
51D_LastCompletionTime long The time taken for the web page to complete rendering after the user initiated the request in milliseconds.
51D_AverageResponseTime long The average time taken for the page to start rendering, in milliseconds, after the user initiated the request during the previous 5 minutes.
51D_AverageCompletionTime long The average time taken for the page to complete rendering, in milliseconds, after the user initiated the request during the previous 5 minutes.
51D_AverageBandwidth int The effective average bandwidth of the connection as measured by the amount of HTML data sent and received, measure in bytes/seconds. The value will vary from a network level inspection as it does not include the TCP or HTTP overhead. It should be used as a guide to the available effective bandwidth. The time values are of more practical use to developers.

The values returned provide a good indicator of performance. Their accuracy gets better over time and when used on larger pages. Small pages will have a much higher margin of error.