Search code examples
testingload-testingk6

Changing number VUs doesn't affect number of actual number of http requests sent in k6 load test


So, I started from 1 VU, and ended with 199, after that value of VUs number of checks doesn't grow up anymore.

So, I tried this

import http from "k6/http";
import { check } from "k6";

export const options = {
  scenarios: { default: {
  executor: 'constant-arrival-rate',
  duration: '30s',
  rate: 5000, timeUnit: '1s',
  preAllocatedVUs: 900
  } }
};

export default function() {
  const res = http.get("http://ipv4:6399/game_heartbeat");
  check(res, { "status was 200": r => r.status == 200 })
};

got

WARN[0002] Insufficient VUs, reached 900 active VUs and cannot initialize more executor=constant-arrival-rate scenario=default

running (0m30.0s), 000/900 VUs, 128808 complete and 0 interrupted iterations default ✓ [======================================] 000/900 VUs 30s 5000 iters/s

Tried

import http from "k6/http";
import { check } from "k6";

export const options = {
  vus: 199,
  duration: "30s"
};

export default function() {
  const res = http.get("http://ipv4:6399/game_heartbeat");
  check(res, { "status was 200": r => r.status == 200 })
};

and got

running (0m30.0s), 000/199 VUs, 163220 complete and 0 interrupted iterations default ↓ [======================================] 199 VUs 30s

 ✓ status was 200

 checks.........................: 100.00% ✓ 163220      ✗ 0

if I change VUs from 199 to 299, 399, 699 - it doesn't change number of checks. It still would be somewhere around 165k for 30s run

My version is k6 v0.36.0 (2022-01-24T09:50:03+0000/ff3f8df, go1.17.6, linux/amd64)

I am running the script without any additional params, just like k6 run script.js

How I could increase 'pressure' from k6 on a testing service?


Solution

  • The options are in:

    1. The testing service cannot handle more requests that you're sending, i.e. you reached the bottleneck, in that case you should start looking for the reason and for the ways of improving the service performance
    2. k6 is not capable of sending more requests because it lacks resources like CPU, RAM, network IO, etc. In that case you can either consider moving your load generator to a more powerful machine or consider switching to a load testing tool like JMeter or Locust which support distributed execution mode.