Post

Introducing k6 for Load Testing APIs

We recently moved away from JMeter and Gatling for API load testing and tried out k6.

Highlights:

  • Scripted in JavaScript, very developer-friendly
  • Integrated easily with CI
  • Built-in support for thresholds and checks

A sample test:

1
2
3
4
5
6
7
8
9
import http from 'k6/http';
import { check, sleep } from 'k6';

export default function () {
  let res = http.get('https://my-api.com/health');
  check(res, { 'status was 200': (r) => r.status === 200 });
  sleep(1);
}

Highly recommend it for modern DevOps teams.

This post is licensed under CC BY 4.0 by the author.