/poc-artillery.io

A Proof of Concept for using Artillery for backend performance testing, publishing metrics to InfluxDB 2.0 through Telegraf, and displaying them using Grafana.

Primary LanguageC#GNU General Public License v3.0GPL-3.0

Proof of Concept - Artillery

Introduction

A Proof of Concept for using Artillery for backend performance testing, publishing metrics to InfluxDB 2.0 through Telegraf, and displaying them using Grafana.

Grafana dashboard

Prerequisite

Run and setup testing infrastructure

  1. Run Docker Compose: docker-compose up -d

  2. Go to your Grafana and log in

    • username: admin
    • password: admin
  3. Connect Grafana to Influx DB

    • Go to Add data source, select InfluxDB and configure the following

      Query Language: Flux # InfluxDB 2.0
      HTTP:
        URL: http://influxdb2:8086 # InfluxDB address inside Docker
      Auth:
        Basic auth: false # Turn off Basic Auth
      InfluxDB Details:
        Organization: poc-organization
        Token: my-super-secret-auth-token # You should issue a new Read-Only access token for Grafana in your InfluxDB
        Default Bucket: poc-artillery.io
  4. Create a new Grafana Dashboard (you can find the finished dashboard here)

    • Go to Dashboards and click New Dashboard
    • Click Add an empty panel
      • Responses

        • Panel (Settings)

          • Panel title: Responses
        • Query

          from(bucket: "poc-artillery.io")
            |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
            |> filter(fn: (r) =>
                  r["_measurement"] == "artillery_response_1xx" or
                  r["_measurement"] == "artillery_response_2xx" or
                  r["_measurement"] == "artillery_response_3xx" or
                  r["_measurement"] == "artillery_response_4xx" or
                  r["_measurement"] == "artillery_response_5xx")
            |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)
            |> yield(name: "mean")
          
        • Overrides (Fields with name matching regex)

          • 1xx Responses
            • RegEx: artillery_response_1xx.+
            • Display name: 1xx
          • 2xx Responses
            • RegEx: artillery_response_2xx.+
            • Display name: 2xx
          • 3xx Responses
            • RegEx: artillery_response_3xx.+
            • Display name: 3xx
          • 4xx Responses
            • RegEx: artillery_response_4xx.+
            • Display name: 4xx
          • 5xx Responses
            • RegEx: artillery_response_5xx.+
            • Display name: 5xx
      • Latency

        • Panel (Settings)

          • Panel title: Latency
        • Field (Standard options)

          • Unit: milliseconds (ms) (under Time)
        • Query

          from(bucket: "poc-artillery.io")
            |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
            |> filter(fn: (r) =>
                  r["_measurement"] == "artillery_latency_max" or
                  r["_measurement"] == "artillery_latency_median" or
                  r["_measurement"] == "artillery_latency_min" or
                  r["_measurement"] == "artillery_latency_p95" or
                  r["_measurement"] == "artillery_latency_p99")
            |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)
            |> yield(name: "mean")
          
        • Overrides (Fields with name matching regex)

          • Maximum latency
            • RegEx: artillery_latency_max.+
            • Display name: Maximum
          • Median latency
            • RegEx: artillery_latency_median.+
            • Display name: Median
          • Minimum latency
            • RegEx: artillery_latency_min.+
            • Display name: Minimum
          • 95th percentile latency
            • RegEx: artillery_latency_p95.+
            • Display name: 95th percentile latency
          • 99th percentile latency
            • RegEx: artillery_latency_p99.+
            • Display name: 99th percentile latency
      • Traffic

        • Panel (Settings)

          • Panel title: Traffic
        • Field (Standard options)

          • Unit: requests/sec (rps) (under Throughput)
        • Query

          from(bucket: "poc-artillery.io")
            |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
            |> filter(fn: (r) => r["_measurement"] == "artillery_rps_mean")
            |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)
            |> yield(name: "mean")
          
        • Overrides (Fields with name matching regex)

          • Maximum latency
            • RegEx: value.+
            • Display name: Number of requests

Run Tests

  1. Install dependencies: npm install
  2. Run tests: npm run weather-forecast

Authors