Hey there! I’m trying to create a scenario whereby four endpoints are queried x times per second for an entire hour, in order to simulate and assess realistic load patterns.
I know that I can use the ‘constant-arrival-rate’ executor to generate the correct number of requests, but I also want to avoid server-side cacheing, so need also to use ‘shared-iterations’. To avoid the cacheing, I can simply use sequential numbering to ‘skip’ an endpoint, but I don’t know if this is possible… Alternatively I could use a CSV file with actual things to search for.
Demo idealised script (with one request instead of four, but they’d all use the same index on each iteration):
import http from "k6/http";
import { group, check, sleep } from "k6";
// Sleep duration between successive requests.
const SLEEP_DURATION = 0.1;
BASE_URL = "API.com"
export default function() {
group("GET something", () => {
let url = BASE_URL + `/search?limit=1&skip=` + INDEX;
let request = http.get(url);
check(request, {"Status OK": (r) => r.status === 200});
sleep(SLEEP_DURATION);
});
}
Current scenario config:
{
"scenarios": {
"constant_request_rate": {
"executor": "constant-arrival-rate",
"rate": 10,
"timeUnit": "1s",
"duration": "60m",
"preAllocatedVUs": 10,
"maxVUs": 30
}
}
}
Any help would be greatly appreciated!