Using Multiple Executors?

So it doesn’t specifically state anywhere that you CAN’T (at least that i’ve found). But im wondering if I can use multiple executors.

In my scenario I need to:
1 . Run thousands of requests (10k+) against an endpoint with 10,000 unique ID’s (IE: /users/update/{n})
2. Each VU CANNOT hit the endpoint more than once total (among all VU’s).
3. I also need to control the rate at which the endpoint is hit (IE: 15 times a min or whatever)

so 1 and 2 I accomplished with the shared-iterations executor (Also pardon if im new to a lot of the executor/scenario stuff, I’ve just started on that). Using an option like this:

export const options = {
  scenarios: {
    'shared-csv-iterations': {
      executor: 'shared-iterations',
      vus: 20,
      iterations: csvData.length,
      maxDuration: '1h',
    },
  },
};

Im reading in 1000’s of unique guids in a CSV file just for context, so the iterations should equal the total number of guid’s.

However can I also perhaps control the rate of the requests as well? I know RPS is discouraged since it can be difficult to calculate, but I didn’t know if I could combine executors (Such as using the constant-arrival-rate executor as well?)

Otherwise I guess it’s just a matter of doing some calculations and sleeping an appropriate amount of time between requests?

Hi @mercfh,

So it doesn’t specifically state anywhere that you CAN’T (at least that i’ve found). But im wondering if I can use multiple executors.

Do you mean using 2 executors for the same scenario? How exactly is that going to work?

If you mean having 2 scenarios with 2 differetn executors - that works fine. But I don’t think this is what you mean by that.

Im reading in 1000’s of unique guids in a CSV file just for context, so the iterations should equal the total number of guid’s.

Such as using the constant-arrival-rate executor as well?)

you can just use the constant-arrival-rate and do some (easy) math.

If you have a constant arrival rate starting 10 iterations a second and running for 7 second you will do 70 iterations(or at least start them).

if you want to do 1000 iterations and want to do 15 a minute that means that you have to run for 1000/15 minutes. If we move to seconds we will be starting iteration each 4 second (60seconds / 15 iterations). SO to start 1000 iteration we will need 4000 seconds.

export const options = {
  scenarios: {
    'shared-csv-iterations': {
      executor: 'constant-arrival-rate',
      preallocatedVUs: 20,
      rate: 1,
      duration: '4000s',
      timeUnit: "4s"
    },
  },
};

You might also need to up gracefulStop.

Hope this helps you!

1 Like