Skip to content
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

K6 scale not works with stage #1028

Closed
zefelise opened this issue May 22, 2019 · 5 comments · Fixed by #1007
Closed

K6 scale not works with stage #1028

zefelise opened this issue May 22, 2019 · 5 comments · Fixed by #1007
Assignees
Labels
Milestone

Comments

@zefelise
Copy link

zefelise commented May 22, 2019

If I run the script with stage option defined, like:

export let options = {
    stages: [
        { duration: "3m", target: 10 },
        { duration: "10m", target: 35 },
    ]
};

I can not change the vus during the execution with k6 scale cmd.
Every time I change the vus with k6 scale the actual vus will be changed back the one defined in the stage targets soon.
Is this by design or an issue? It's useful that I can trigger a script with pre-defined stages while sometimes try to change the vus in ad-hoc.

@mstoykov
Copy link
Contributor

Hi @zefelise,
I don't think this is well explained on the wiki (at all actually) or in the blog that is linked there, but if you have stages they will continue to work whether or not you use k6 scale actually whatever you have set will work regardless of the k6 scale.
The "correct" way to use this is to no have stages and to have a duration that is bigger than what you will need .. for example 24h. You should probably use --paused as well.

I also should mention that #1007 will change this in a way such that k6 will require you to say that you want to set your vus manually through the API. This (for the moment) will also not let you have stages and other ways to run vus.

@zefelise
Copy link
Author

Hi @mstoykov ,
Thanks for the explanation. We have some pre-defined stage settings in the scripts. As your suggestion, maybe I need to run the scripts with --duration with k6 run to override the stage settings so that I can scale the vus later, right?

@mstoykov
Copy link
Contributor

The "correct" way to use the rest API to scale up and down is to run k6 as

k6 run --paused --no-setup --no-teardown --duration 48h --iterations -1 --vus 0 --max 1 --stage "" script.js

After this you should use the API to call the setup function and set the data it returns you through the API, through the API to be the setup data for the tests. And after that you can run scale up and unpause the script. At the end you should scaledown and run teardown, if you have teardown and setup of course :).

All of this is done so that you can actually control what happening instead of k6 to start executing the stages that are defined in the script or running with it defaults(1vu 1 iterations) when you unpause the script. The setup/teardown thing is mostly because of teardown.

As you see the whole experience is not ideal and definitely contra intuitive in a lot of places which is why it is somewhat redesigned in #1007 and will hopefully be at least less confusing ;)

@zefelise
Copy link
Author

Thanks @mstoykov . This makes sense.

@mstoykov
Copy link
Contributor

I am going to leave this open and close with #1007

@na-- na-- mentioned this issue May 29, 2019
39 tasks
@na-- na-- self-assigned this Aug 27, 2019
@na-- na-- added this to the v1.0.0 milestone Aug 27, 2019
@na-- na-- modified the milestones: v1.0.0, v0.27.0 May 21, 2020
@na-- na-- closed this as completed in #1007 Jul 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants