I’m looking for some advice on the best way to achieve the following load test
What we are looking to get is some random bursts of traffic to a specific api endpoint whilst maintaining a constant load on the rest of the api. Stages would look something like this, but a lot more of them
stages : [
{target : 0, duration: '345s'},
{target : 13, duration: '2s'},
{target : 0, duration: '499s'},
{target : 7, duration: '2s'},
{target : 0, duration: '291s'},
]
What I have so far is
- a function that generates the array of random stages based on (seeded for repeatability)
- apply that array to the scenario
- run the test
Given that the init context runs runs once per VU is this a sensible approach?
simplified sample of what the relevant init code looks like.
const burstStages = randomStages(burstParameters) // this function returns an array of stages which are used when setting up the scenario below
export const options = {
scenarios: {
BaseLoadScenario: {
executor: "constant-vus",
exec: "baseload",
duration: testDuration,
vus: 70,
},
BurstyScenario: {
executor: "ramping-arrival-rate",
exec: "burst",
preAllocatedVUs: 30,
startRate: 0,
timeUnit: "1s",
stages: burstStages
},
}
}