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

Controlling RPS with Number of iteration for each VU #2305

Closed
AymanSalamn opened this issue Dec 19, 2021 · 7 comments
Closed

Controlling RPS with Number of iteration for each VU #2305

AymanSalamn opened this issue Dec 19, 2021 · 7 comments
Labels

Comments

@AymanSalamn
Copy link

Feature Description

Hi All, I am new to k6 but I have a good understanding of performance testing and its tools,
After using K6 for a weak and after using all useful scenarios to K6 I was able to achieve every test I want except one test.
Currently, we can run more scenarios in the same test, by using:

  1. (per-vu-iterations) executor we can define each VE how many iterations will be executed.
  2. (constant-arrival-rate) executor we can define RPS during the test.

But so far and after a lot of searches here and in K6 documentation, I can't find how to be able to control the iteration per VE and how we can define a constant RPS during the test.

My test needs that each VE runs for one iteration only and defines a constant RPS or Arrival RPS for these VE.
For example, each second 2 users run for one iteration only.

This case can be easily implemented in Jmeter by using a predefined value for the number of iteration per VE and using a constant-throughput-timer.

is there any way or solution to implement the above test case?
Thanks.

Suggested Solution (optional)

No response

Already existing or connected issues / PRs (optional)

No response

@na--
Copy link
Member

na-- commented Dec 20, 2021

I'm sorry, but I'm not very familiar with JMeter and I don't understand exactly what you want to achieve. For example, what is a "VE"?

Or, better yet, can you explain exactly what you want to achieve, but without using any JMeter terminology?

@na-- na-- added awaiting user waiting for user to respond question and removed feature labels Dec 20, 2021
@AymanSalamn
Copy link
Author

AymanSalamn commented Dec 20, 2021

Hello @na-- ,
At first, VE means the virtual user
My test has the following information:
I have 2000 users each user has its unique email and password.
My workflows:

  1. Each user Login.
  2. Make one request only.
  3. Exist

-- Each user must run the workflow for one time (one-iteration)

Also, I want to control RPS during this process, as an example:
Each one-second 3 users start to execute the above workflow.
in another word, I want to be able to define Ramp-up-period for these users.

@na--
Copy link
Member

na-- commented Dec 20, 2021

I thought VU is the abbreviation for virtual users, not VE, that's why I was confused... And, to be fair, I am still confused 😅 I don't think you want a set of 2000 virtual users executing the test in parallel, but rather want a much smaller set of users that use a set of 2000 unique user credentials only once?

If I understand that part correctly, it should be possible to implement using the k6/execution API that was recently introduced in k6 v0.34.0, specifically the scenario.iterationInTest property: https://k6.io/docs/javascript-api/k6-execution/

Each one-second 3 users start to execute the above workflow.
in another word, I want to be able to define Ramp-up-period for these users.

I don't understand this part. Say that you have this list of credentials:

user1:password1
user2:password2
user3:password3
...
user1999:password1999
user2000:password2000

What do you want to happen in your test, as time goes by? At the start of the test, you want to make 3 requests, with user1, user2 and user3? Then, at time=1s, you want to make requests with user4, user5, user6? Or something else? And do you want these requests to wait for the previous ones to have finished, or do you want to make requests regardless of the state of the previously made ones? And what should happen when you run out of credentials?

@AymanSalamn
Copy link
Author

AymanSalamn commented Dec 21, 2021

@na-- thank you I finally figured out how to combine both throughput(ramping-arrival-rate) and scenario.iterationInTest together, but now how can I stop the test after I ran out of the credential?

    scenarios: {
        contacts: {
            executor: 'ramping-arrival-rate',
            startRate: 1,
            timeUnit: '1s',
            preAllocatedVUs: 5,
            maxVUs: 100,
            stages: [
                { target: 5, duration: '20s' },
                { target: 5, duration: '3m' },
                { target: 10, duration: '20s' },
                { target: 10, duration: '3m' },
                { target: 3, duration: '20s' },
                { target: 3, duration: '3m' }
            ],
        },
    }
  export default function () {
      const user = data[scenario.iterationInTest];
      const access_token = Login(user)
      http.get("User Actions URL")
  }
  export function Login(user) {
          console.log(user.username)
          console.log(user.password)
  }

This implementation work fine for my achieve, but when the credentials ran out I get Errors, how can I stop the test after I ran out of the credential?

@na--
Copy link
Member

na-- commented Dec 21, 2021

We just recently merged #2093, which adds test.abort() to k6/execution. It will be released in k6 v0.36.0 in mid-January, but if you can't wait until then, you can build the k6 master from source or use the loadimpact/k6:master docker image.

I also added a new issue to add maxIterations to arrival-rate executors: #2308

@AymanSalamn
Copy link
Author

thank you @na-- for help.

@na-- na-- removed the awaiting user waiting for user to respond label Dec 21, 2021
@na--
Copy link
Member

na-- commented Dec 21, 2021

Thank you for explaining your use case, it's a very valid one that we should support better! I'll close this issue in favor of #2308

@na-- na-- closed this as completed Dec 21, 2021
@AymanSalamn AymanSalamn changed the title Controlling RPS with Number of iteration for each VE Controlling RPS with Number of iteration for each VU Dec 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants