Member-only story

Loadtest web service with k6

Donald Le
2 min readNov 27, 2020

--

Photo by Julian Villella on Unsplash

First install k6 in your system. We will go for Linux (Ubuntu).

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 379CE192D401AB61echo "deb https://dl.bintray.com/loadimpact/deb stable main" | sudo tee -a /etc/apt/sources.listsudo apt-get updatesudo apt-get install k6

Open any IDE for writing test code. We will use WebStorm. To enable code suggestion for k6, install this library with npm:

$ npm init --yes# install the k6 types as dev dependency$ npm install --save-dev @types/k6

For showing visual chart while the test is running, we have some of the methods:

  • Amazon CloudWatch
  • Apache Kafka
  • InfluxDB + Grafana
  • Cloud
  • CSV
  • Data Dog

We will use InfluxDB and Grafana for visualization.

Install InfluxDB with Docker

docker run -p 8086:8086 \
-v $PWD:/var/lib/influxdb \
influxdb

Install Grafana as service in Ubuntu

sudo apt-get install -y adduser libfontconfig1
wget…

--

--

Donald Le
Donald Le

Written by Donald Le

A passionate automation engineer who strongly believes in “A man can do anything he wants if he puts in the work”.

No responses yet