fpsthirty
fpsthirty

Reputation: 185

k6: how to manage rps-limit on each stage of increase the number of VUs

I have a question about basic term for which I did not find a detailed explanation. Input data: framework k6 v0.25.1, http-requests.

Question #1: what is the implementation of VU (virtual user) from a perspective:

1) client-side;

2) server-side;

3) interactions of client-server?

What should you read about subtleties of the VU essence, in particular within k6? For now I found out what each VU occupies one network port on the client- and server-sides.

Load profiles:

1) rps:1; vus:1; duration for N minutes — I see in Grafana that increase in number of requests is really minimal: +~1rps. Everything is fine;

2) rps:1; vus: 1..1000 with acceleration during for N minutes by option target in the stages — I see that load has increased by ~+100rps in peak, although option "rps" according to k6 documentation is "The maximum number of requests to make per second, in total across all VUs" option i.e. instead of ~+100rps I expected to see load in ~1rps, by analogy with experience #1 — i.e. either k6 bug that rps limit incorrectly does not take amount of rps in all VUs threads or hidden legal behavior for VUs required for each VU to exist.

Note: I set an arbitrary timeout at beginning and end of scenario to achieve even load distribution.

Question #2: What could be cause of incredible growth of rps with illegally exceeded of rps limit when vus is increased?

Example:

import http from "k6/http";

export let options = {
    stages: [
        { duration: "1m", target: 1, rps: 1 },
        { duration: "1m", target: 200, rps: 1 },
        { duration: "1m", target: 500, rps: 1 },
        { duration: "1m", target: 1000, rps: 1 },
        { duration: "1m", target: 500, rps: 1 },
        { duration: "1m", target: 200, rps: 1 },
        { duration: "1m", target: 1, rps: 1 },
    ]
};

export default function() {
  http.get("https://httpbin.test.loadimpact.com/get"); 
  console.log("request made by VU " + __VU); 
};

grafana enter image description here

Upvotes: 1

Views: 3611

Answers (1)

cuonglm
cuonglm

Reputation: 2806

Virtual User or VU is k6 specific definition and implementation. VU is the entity that execute your script, make one or more HTTP requests to your server.

If you are testing a web server, you can think VU is the same as real user.

If you are testing API, VU can produce more requests per second (RPS) to server than your real VUs. Example you can define 5 VUs, but each one can produce 10 requests per second. That's why when your VUs increase, you can reach RPS limit very quickly.

You can read more details about VU definition at this link.

Upvotes: 2

Related Questions