Tuesday, December 29, 2015

Since JMeter 2.13 Backend Listener has been available to create real time graph of JMeter Test. Following tutorial explain the entire process in detail. At the end of this tutorial you would be able to create JMeter Live Test Result dashboard similar to following -

This tutorial borrows information from many sources and my own experiments with JMeter live reporting dashboard. I have added source of information wherever applicable

But before we can build such a snazzy JMeter Live Reporting dashboard we need to understand two more components -

influxDB (a time series database)and

Grafana Dashboard

This is a big tutorial, so take deep breath :-) and follow on.Once you complete set up specified in this tutorial then you can watch JMeter Training Video Tutorial to watch this in action.

What is Time Series Database?

A time series is a sequence of data points, typically consisting of successive measurements made over a time interval. Examples of time series are ocean tides, counts of sunspots, and the daily closing value of the Dow Jones Industrial Average.

And we are interested in load test which also generates time series data points.

InfluxDB is a time series, metrics, and analytics database. It’s written in Go and has no external dependencies. That means once you install it there’s nothing else to manage (such as Redis, ZooKeeper, Cassandra, HBase, or anything else). InfluxDB is targeted at use cases for DevOps, metrics, sensor data, and real-time analytics.

Data in InfluxDB is organized by time series, which contain a measured value, like “cpu_load” or “temperature”. Time series have zero to many points, one for each discrete sample of the metric. Points consist of time (a timestamp), a measurement(“cpu_load”), at least one key-value field (the measured value itself, e.g. “value=0.64” or “15min=0.78”), and zero to many key-value tags containing metadata (e.g. “host=server01”, “region=EMEA”, “dc=Frankfurt”). Conceptually you can think of a measurement as an SQL table, with rows where the primary index is always time. tags and fields are effectively columns in the table. tags are indexed, fields are not. The difference is that with InfluxDB you can have millions of measurements, you don’t have to define schemas up front, and null values aren’t stored.

We will use these credentials later when setting up data source in Grafana>

By default, authentication is disabled in the configuration file. Enable authentication by setting the auth-enabled option to true in the [http] section of the configuration file (/etc/opt/influxdb/influxdb.conf) -

Notice that these measurements would be available only after adding BackenListener and running test at least once. Hence add Backend Listener to test plan as -

You can specify following properties in Backend Listener -

And run the test.

In all of the metric i.e. jmeter.all.a.count, jmeter.all.a.max etc word “jmeter” is rootMetricPrefix and is specified in Backend Listener

By default JMeter sends only metrics for all samplers using "all" as sampler Name so it looks like this in influxDB -

To query a measurement in influxDB you can run select query on required measurement as -

And to drop the database (you won’t do this very often ;-)) execute drop query as -

drop database <dbname>

When you need values for specific samples then specify sampler name in Backend listener and run test. (Multiple sample names as comma separated values) -

Grafana:

Grafana is a leading open source application for visualizing large-scale measurement data. It provides a powerful and elegant way to create, share, and explore data and dashboards from your disparate metric databases, either with your team or the world.

Grafana is most commonly used for Internet infrastructure and application analytics, but many use it in other domains including industrial sensors, home automation, weather, and process control.

Grafana features pluggable panels and data sources allowing easy extensibility. There is currently rich support for Graphite, InfluxDB and OpenTSDB.

Grafana supports many storage backend for time series data. Query Language and capabilities of each data source are different. Influxdb is one such supported data source. You can read more on Grafana Data Source here - http://docs.grafana.org/datasources/overview/