I want to mimic the scenario where on every 6th second I want to execute 4 parallel calls, likewise I want keep executing this for 10 min.
How to achieve this in K6 and which executor ?
Hi @rajtarafake ![]()
Apologies for the late reply, this went under my radar.
k6 does not offer the ability to execute an iteration at precise intervals yet. However, if you’re okay with “roughly 6 seconds”, I would advise defining a scenario using the constant-vus executor, and using the sleep function to pause the execution of the iteration for 6 seconds at its end.
Something along the lines of (not tested myself):
import { sleep } from 'k6';
export const options = {
scenarios: {
periodical: {
executor: 'constant-vus',
// 4 virtual users will be constantly executing iterations in parallel
vus: 4,
// For 10 minutes
duration: '10m'
}
}
}
export default function() {
// do a call
// wait six seconds before executing the next iteration
sleep(6);
}
Let me know if that was helpful ![]()