-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add maxIterations
option to arrival-rate executors
#2308
Comments
Does that mean that we will count dropped iterations, due to no VU available to execute them, toward the If yes, I would argue that this can also be done through some kind of js helper which does the math, which isn't really all that much of a PITA IMO ;). I have no idea what the API for that will be for ramping-arrival-rate, but I also find scenarios: {
contacts: {
executor: 'ramping-arrival-rate',
startRate: 50,
timeUnit: '1s',
preAllocatedVUs: 50,
maxVUs: 100,
maxIterations: 250,
stages: [
{ target: 200, duration: '30s' },
{ target: 0, duration: '30s' },
],
},
}, To be confusing. Just looking at it, I can't decide if Do we intend on having scenarios: {
contacts: {
executor: 'ramping-arrival-rate',
startRate: 50,
timeUnit: '1s',
preAllocatedVUs: 50,
maxVUs: 100,
stages: [
{ target: 200, maxIterations: 150 },
{ target: 0, maxIterations: 50 },
],
},
}, And to get the duration out of this? scenarios: {
contacts: {
executor: 'ramping-arrival-rate',
startRate: 50,
timeUnit: '1s',
preAllocatedVUs: 50,
maxVUs: 100,
stages: [
{ duration: "30s", maxIterations: 150 },
{ duration: "30s", maxIterations: 50 },
],
},
}, I feel like the latter one will have problems with All of this to me seems like a good place for some helper JS functions which explore those areas and generate the currently supported config instead of starting with more options being added. p.s. For completeness’ sake, just the first stage of starts |
Good question 🤔 I am not sure which would be better, though I think "no" might be the right answer here. I think we should probably try to keep this in sync with import exec from 'k6/execution';
import { sleep } from 'k6';
export const options = {
scenarios: {
sc1: {
executor: 'constant-arrival-rate',
preAllocatedVUs: 1,
rate: 1,
duration: '30s',
},
},
}
export default function () {
console.log(`[t=${(new Date()) - exec.scenario.startTime}ms] VU{${exec.vu.idInInstance}/${exec.vu.idInTest}} ran scenario iteration ${exec.scenario.iterationInTest} (${exec.vu.iterationInScenario} for VU) in ${exec.scenario.name}`);
sleep(1.9);
} I will output something like this:
And you are right - if we wanted to count dropped iterations, we can probably somewhat easily make a JS helper that calculates the
The point is to be able to easily define a scenario for this use case, which we currently can't do: "Execute exactly the specified number of iterations at the given constant/variable iteration rate" And yes, I think we should still have |
Gonna close this issue as it has no reactions (does it really worth the effort?) and we don't foresee capacity to focus on this. Plus, there's no clear idea about how to progress (see the discussion above, it would require more thinking before starting to write an implementation), and as Mihail mentioned, if somebody definitely wants to give it a try, it's probably achievable in the form of a JS helper that anyone could write. If the latter is the case, and you, future reader, have a more concrete implementation suggestion, ideally proofed, feel free to leave it here or open a new issue with the specific details. Thanks! |
Feature Description
It will be nice if users can specify exactly how many iterations at most a
constant-arrival-rate
orramping-arrival-rate
scenario should make before it stops. Especially when there is a set of data items we can only use once, as is the case of #2305 (comment)For
constant-arrival-rate
that can somewhat be accomplished by some math carefully choosing theduration
, but it's still a PITA. Forramping-arrival-rate
it's technically also possible, but so difficult not to be worth it.Suggested Solution (optional)
Add a new
maxIterations
option. Arrival-rate executors should end whenever they hit their maximum duration OR after they start themaxIterations
iteration globally. This is going to be similar to whatshared-iterations
andper-vu-iterations
already do.This should be fairly straightforward to implement. For example,
ramping-arrival-rate
already has gets the iterations it's supposed to execute over a channel:k6/lib/executor/ramping_arrival_rate.go
Line 460 in 804203b
So it should just be a matter of closing that channel whenever the desired number of iterations was reached, I think...
Already existing or connected issues / PRs (optional)
#1386 explores time bucketing of iterations, another potential improvement for arrival-rate executors
And before we implement either this issue or #1386, we should probably refactor the arrival-rate executors in a similar manner to #2155 🤔
The text was updated successfully, but these errors were encountered: