My default function is just an http post request.
I would like to test if my app is able to deal with the following scenario:
- 5 requests, per second, for 2 seconds
- 15 requests, per second, for 10 seconds
- 20 requests, per second, for 5 seconds
I'm not sure whether to use ramping-arrival-rate, or ramping-vus
Here's an example of what I used for the first option.
export const options = {
scenarios: {
contacts: {
executor: 'ramping-arrival-rate',
timeUnit: '1s',
preAllocatedVUs: 10,
maxVUs: 200,
stages: [
{ target: 5, duration: '2s' },
{ target: 15, duration: '10s' },
{ target: 20, duration: '5s' },
{ target: 0, duration: '10s' },
],
},
},
thresholds: {
http_req_duration: ['p(95)<60000'], //units in miliseconds 60000ms = 1m
http_req_failed: ['rate<0.01'], // http errors should be less than 1%
checks: ["rate>0.99"]
},
};
The strange thing is that I'm not exactly sure if I'm doing something wrong, in light of the results I get:
http_reqs......................: 4 0.070166/s
iteration_duration.............: avg=41.13s min=24.94s med=42.3s max=54.98s p(90)=53.5s p(95)=54.24s
iterations.....................: 4 0.070166/s
vus............................: 126 min=10 max=126
vus_max........................: 126 min=10 max=126
Why did I only have 4 http requests? I was expecting to have 5 * 2 + 15 * 10 + 20 * 5 = 260