# Inject user each minute

**URL:** <https://community.gatling.io/t/inject-user-each-minute/6480>\
**Category:** Gatling (Open-Source)\
**Created:** [February 18, 2022, 2:13pm UTC](https://community.gatling.io/t/inject-user-each-minute/6480 "2022-02-18T14:13:53Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![hbellat](https://avatars.discourse-cdn.com/v4/letter/h/7feea3/32.png) [@hbellat](https://community.gatling.io/u/hbellat)\
**Post date:** [February 18, 2022, 2:13pm UTC](https://community.gatling.io/t/inject-user-each-minute/6480/1 "2022-02-18T14:13:53Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![sbrevet](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/sbrevet/32/830_2.png) [@sbrevet](https://community.gatling.io/u/sbrevet)\
**Post date:** [February 18, 2022, 2:30pm UTC](https://community.gatling.io/t/inject-user-each-minute/6480/2 "2022-02-18T14:30:08Z")

</div>

Hi,

You could try:

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

```

Documentation: [Injection / open-model](https://gatling.io/docs/gatling/reference/current/core/injection/#open-model)

Cheers,

---

<div class="post-metadata">

**Author:** ![hbellat](https://avatars.discourse-cdn.com/v4/letter/h/7feea3/32.png) [@hbellat](https://community.gatling.io/u/hbellat)\
**Post date:** [February 18, 2022, 2:54pm UTC](https://community.gatling.io/t/inject-user-each-minute/6480/3 "2022-02-18T14:54:12Z")

</div>

Would you like to give more explanation please ?

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

Thanks

---

<div class="post-metadata">

**Author:** ![sbrevet](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/sbrevet/32/830_2.png) [@sbrevet](https://community.gatling.io/u/sbrevet)\
**Post date:** [February 18, 2022, 3:01pm UTC](https://community.gatling.io/t/inject-user-each-minute/6480/4 "2022-02-18T15:01:11Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![shoaib42](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/shoaib42/32/844_2.png) [@shoaib42](https://community.gatling.io/u/shoaib42)\
**Post date:** [February 19, 2022, 11:02pm UTC](https://community.gatling.io/t/inject-user-each-minute/6480/5 "2022-02-19T23:02:10Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![sbrevet](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/sbrevet/32/830_2.png) [@sbrevet](https://community.gatling.io/u/sbrevet)\
**Post date:** [February 20, 2022, 1:17pm UTC](https://community.gatling.io/t/inject-user-each-minute/6480/6 "2022-02-20T13:17:25Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![shoaib42](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/shoaib42/32/844_2.png) [@shoaib42](https://community.gatling.io/u/shoaib42)\
**Post date:** [February 20, 2022, 3:38pm UTC](https://community.gatling.io/t/inject-user-each-minute/6480/7 "2022-02-20T15:38:16Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![hbellat](https://avatars.discourse-cdn.com/v4/letter/h/7feea3/32.png) [@hbellat](https://community.gatling.io/u/hbellat)\
**Post date:** [February 22, 2022, 12:45pm UTC](https://community.gatling.io/t/inject-user-each-minute/6480/8 "2022-02-22T12:45:41Z")

</div>

Hello Sebastien  
Yes it works.  
Many thanks
