Confusion about the ramping-arrival-rate executor

I am following the k6 tutorial on spike testing which uses the ramping-arrival-rate executor to increase the request rate instantaneously.
Here is the test definition

import http from 'k6/http';
import { sleep } from 'k6';

export const options = {
  scenarios: {
    contacts: {
      executor: 'ramping-arrival-rate',
      preAllocatedVUs: 50,
      timeUnit: '1s',
      startRate: 50,
      stages: [
        { target: 200, duration: '30s' }, 
        { target: 500, duration: '0' }, 
        { target: 500, duration: '10s' }, 
      ],
    },
  },
};

export default function () {
  http.get('https://test.k6.io');
  sleep(1);
}

My expectation is that the request rate ramps up from 50 to 200 req/s over 30s and then jumps to 500 req/s where it stays for 10 seconds.

To validate it I upload the metrics to datadog and visualize it on the k6 dashboard that comes out of the box on datadog. I take the k6 output json, filter on the objects where metric = http_reqs, then bin the timestamp of those objects in 1 second intervals. The resulting counts per 1 second interval are then uploaded as a datadog datapoints (via http api).

Now, the confusing part is the requests rate chart looks like it’s sending consistently about 50 requests per second. Does this look right to you? I would have expected an increase from 50 to 200 over 10s and then to 500 requests per second as set out in my test script.

Thanks

Hi @masy

According to the documentation here: Ramping arrival rate | Grafana k6 documentation the maxVUs is the same as the preAllocatedVUs, so you have 50 VUs. You want 200 and then 500 iterations to be split over this 50 VUs, but every iteration lasts at least 1 second because of the sleep, so you can’t get higher rate than 50req/sec. Try to remove the sleep, or set the maxVUs to a higher number.

I hope this helps

1 Like