I am using K6 to performance/load test my API and test its concurrency handling.
I have set up a config of 10 concurrent users for 10 seconds, but I would like to track the actual unique requests coming into the API.
I initially thought about adding an ID header (I log out the header in the API for debugging) like and doing an iteration such as:
export default function() {
const params = {...PARAMS};
for (let i = 1; i < 10000; i++) {
params.headers['some-id'] = `id-${i}`;
http.get(ENDPOINT, PARAMS);
sleep(SLEEP);
}
}
However this didn’t yield the output I was initially expecting, with there being 10 instances of id-1
, 10 instance of id-2
and so on…
After seeing the output I understand that this is due to there essentially being 10 users sending the first request with ID-1 etc.
Is there a way in which I can achieve concurrent users with different header params being sent in?