jMeter Graphs

Default Listeners for Vaimo Load Tests

By default the following out-of-box JMeter listeners are used for each load test:

Listeners powered by plugins

It’s possible to create different type of graphs using plugins that are available for jMeter (latest version of JMeterPlugins-Extras needs to be installed first).

Check the information below for plugins details:

  • Default Listeners for Vaimo Load Tests
  • Listeners powered by plugins
    • Each transaction response time (As a Histogram diagram)
    • Average transaction duration
    • Median transaction duration
    • 95% transaction duration
    • Min transaction time
    • Max transaction time
    • Threads (indicating concurrency) running at any point during the test (presented as a line graph)

Each transaction response time (As a Histogram diagram)

Add: Listener > Response Times Distribution to your overall plan

By the end of the test you will have response time of all transactions (grouped by name) as histogram diagram:

From the ‘Rows‘ tab you can choose which transaction to be displayed individually.

Category Page: 

Cart Page:

Product Page:

Average transaction duration

 Add: Listener > Aggregate Graph to your overall plan

By the end of the test you can configure the graph to show the average response time of all transactions (grouped by name) as a bar diagram, by checking ‘Columns to Display: Average’:

Click on the ‘Graph‘ tab and you can see the graph

Median transaction duration

 Add: Listener > Aggregate Graph to your overall plan

By the end of the test you can configure the graph to show the median response time of all transactions (grouped by name) as a bar diagram, by checking ‘Columns to Display: Median’:

Click on the ‘Graph‘ tab and you can see the graph

95% transaction duration

 Add: Listener > Aggregate Graph to your overall plan

By the end of the test you can configure the graph to show the 95% response time of all transactions (grouped by name) as a bar diagram, by checking ‘Columns to Display: 95%’:

Click on the ‘Graph‘ tab and you can see the graph

Min transaction time

 Add: Listener > Aggregate Graph to your overall plan

By the end of the test you can configure the graph to show the minimum response time of all transactions (grouped by name) as a bar diagram, by checking ‘Columns to Display: Min’:

Click on the ‘Graph‘ tab and you can see the graph

Max transaction time

 Add: Listener > Aggregate Graph to your overall plan

By the end of the test you can configure the graph to show the Maximum response time of all transactions (grouped by name) as a bar diagram, by checking ‘Columns to Display: Max’:

Click on the ‘Graph‘ tab and you can see the graph

Threads (indicating concurrency) running at any point during the test (presented as a line graph)

 Add: Listener > jp@gc – Active Threads Over Time to your overall plan

You can configure the graph to show all threads aggregated together (or displayed grouped by transaction name) plotted over execution time of the test plan:

How to push data back to Google Analytics

Since jMeter is not a real ‘Browser’ it does not execute any Javascript after receiving the response from web server. Google Analytics session tracking and number of visitors on the site is dependent on Javascript execution to send required data asynchronously back to Google, therefore when we use jMeter we are not able to see any data in Google Analytics regarding our load test (we are interested in number of visitors on the site). To overcome this problem we need to extract the required parameters from the page response and also fake some metrics then make a separate request to Google Analytics server and push the data.

Step-by-step guide

    1. GA tracks visitors bases on a unique user identifier that can be anything as long as it’s unique and each user has one. In jMeter each thread is viewed as a unique visitor, therefore if we have thread numbers #1 to thread number #20 putting load on the site with different scenarios then we can use the thread number as an identifier and push it to GA. To do this we need to do some simple coding in Java which is used by ‘BeanShell Preprocessor’ components in jMeter. My simple code to generate a uniqueId for thread is like this: 
       
  • import java.text.*;
    import java.io.*;
    import java.util.*;  
    try {
    int threadNo = ctx.getThreadNum()+1;
    int threadGroupBase = 123456789;
    int uniqueId = threadNo + threadGroupBase;
    vars.put(“uniqueId”, Integer.toString(uniqueId));
    }
    catch (Exception ex) {
    IsSuccess = false;
    log.error(ex.getMessage());
    System.err.println(ex.getMessage());
    }
    catch (Throwable thex) {
    System.err.println(thex.getMessage());
    }


  • As you can see it’s quite simple, where  ctx.getThreadNum() asks jMeter engine to gives us the current thread number and the rest is just adding it to a base value (see comment on base value below) and putting it inside a variable named ‘uniqueId’ which will be accessible during thread’s lifetime only to this thread.
    Note that base value should unique across thread groups (random value) but equal for all the requests within a particular thread group.

    1. Apart from that we need to have the page title to send across to GA which can be fetched from source using this RegEx extractor::
    2. At this step we have extracted the variables from the page and we can push them to GA. The request should be a GET request to www.google-analytics.com/collect?cid=${uniqueId} where ‘uniqueId’ is already generated in step 1 and the rest of parameters are:
  • Parameter Name
  • Value
  • Description
  • t
  • pageview
  • To indicate that this is a page view transaction
  • dt
  • ${documentTitle}
  • Page title which is already extracted with RegEx.
  • dl
  • ${BaseUrl}/${csvUrl}
  • Visited Page Url.
  • tid
  • UA-#######-#
  • Hardcoded to whatever value the Tracking ID / Property ID is, can be found in the Google Analytics account.
  • gtm
  • GTM-ABCDEF#
  • GTM Container ID. Hardcoded to whatever value the Google Tag Manager Id is.
  • v
  • 1
  • BE time including network, DNS and content download, since it’s not possible/important to calculate the exact value this can be hardcoded to anything.
  1. We are nearly done now, and just need to make sure we have RegEx extractor PostProcessors inside every request sampler and also a request sampler which is making the get request to GA right after it:
  2.  
  3.  

Useful Resources

Track Non-JavaScript Visits In Google Analytics

http://www.simoahava.com/analytics/track-non-javascript-visits-google-analytics/