Hi @ibrahiem.94
I ran a similar example, with lower targets:
import http from 'k6/http';
import { sleep } from 'k6';
import { scenario, vu } from 'k6/execution';
import { randomIntBetween } from 'https://jslib.k6.io/k6-utils/1.2.0/index.js';
export const options = {
scenarios: {
default: {
executor: 'ramping-arrival-rate',
preAllocatedVUs: 10,
startRate: 1,
timeUnit: '1s',
stages: [
{ target: 50, duration: '1h' },
],
},
}
};
export default function () {
console.log("executing VU: ", vu.idInTest, "iteration: ", scenario.iterationInTest, "time: ", Date.now());
http.get('https://test.k6.io');
console.log("done VU: ", vu.idInTest, "iteration: ", scenario.iterationInTest, "time: ", Date.now());
sleep(randomIntBetween(0, 1));
}
And I don’t see the requests being issued at the same second.
No seeing the full script is difficult to say.
My initial thoughts would be that in your ramping arrival rate scenario, the configuration seems to be of 5000
requests per second (timeUnit
is 1s
) for the duration
for 1 hour (duration
). Be aware that timeUnit
does not change in an scenario. With a start rate of 1 request per second, it will attempt to ramp up very quickly to the 5000 target, and you will see many of requests sent at the same time, to reach that target (which will be maintained for 1h):
startRate: 1,
timeUnit: '1s',
stages: [
{ target: 5000, duration: '1h' },
If you want to slowly ramp up, you could do something like the following (adjusting the target and durations to your case):
stages: [
{ target: 1, duration: '1s' },
{ target: 2, duration: '1s' },
{ target: 3, duration: '1s' },
{ target: 4, duration: '1s' },
...
],
And with a (random) sleep as in my example above between requests, they should not happen at the same time.
If the rate was lower (you mentioned you wanted 5 requests per second), they would probably not happen at the same time anyway, as the response time of your endpoint will probably differ. k6 will just issue the requests to make sure you reach the target (if it’s doable - that depends both on your load generator resources and most probably on the server side).
Kindly share your script and the output so we can help you check the behavior in your concrete case.
Cheers!