Inject user each minute

Hi,
I want to inject a user each 60 sec.
Would you like to suggest which method I can use to do that.

Many thanks

Hi,

You could try:

setUp(
  scn.injectOpen(
    constantUsersPerSec(1d / 60).during(180), // 180 seconds is 3 minutes
  ).protocols(httpProtocol)
);

Documentation: Injection / open-model

Cheers,

Would you like to give more explanation please ?

For my understanding constantUsersPerSec inject a number of user in each Second.

Thanks

Exactly, but the argument is a rate.
Note that the rate may be lower than 1.

So, if you inject 1/60 user (0.0166… user) per second, you will inject your full user at the 60th seconds.

Does that helps?
Cheers!

I’ve been using 1/60.0 so as not to do an integer division

Matter of taste, I guess ^^
I prefer to cast the first number ( 1d / 60 ) to ensure that the operator is the one of the type I want (and not to expect the compiler see that there is no / operator on Int that take a float, then consider the first one as float).

Good God, I read it as Id/60 not as 1d/60. I definitely need glasses

Hello Sebastien
Yes it works.
Many thanks

1 Like