Junaid
Junaid

Reputation: 674

Gatling : How to double the number of users after specific interval?

Right now I'm injecting users like this, which will gradually increase the number of users over the period of 30 minutes:

setUp(
       users.inject(rampUsers(300) over ((30) minutes))
   ).protocols(httpConf)

What I want is during the duration of 1st and 10th minute inject the 300 users, during the duration of 11th and 20th minute inject 300 more users which will be 300 + 300 = 600 and during the duration of 21st and 30th minute inject 300 more users which will be 300 + 300 + 300 = 900. In short, I want to double the number of users after every 10 minutes

Upvotes: 0

Views: 1194

Answers (2)

James Warr
James Warr

Reputation: 2604

By the sounds of it, you want 10 minutes where there are 300 users followed by 10 min where there are 600, and finally another 10 where there are 900.

You could used one of the closed injection profiles to achieve this.

scn.inject(
  constantConcurrentUsers(300) during (10 minutes),
  constantConcurrentUsers(600) during (10 minutes),
  constantConcurrentUsers(900) during (10 minutes)
)   

Upvotes: 1

ben
ben

Reputation: 58

You can simply concatenate those commands:

scn.inject(
    rampUsers(300) during (10 minutes),
    rampUsers(300) during (10 minutes),
    rampUsers(300) during (10 minutes),
)

Like the documentation says:

The definition of the injection profile of users is done with the inject method. This method takes as argument a sequence of injection steps that will be processed sequentially. (https://gatling.io/docs/2.3/general/simulation_setup)

Also, the behavior you described could be achieved by just doing rampUsers(900) during (30 minutes).

Upvotes: 0

Related Questions