# Running scenarios in parallel

**URL:** <https://community.gatling.io/t/running-scenarios-in-parallel/5299>\
**Category:** Gatling (Open-Source)\
**Created:** [October 16, 2019, 11:37pm UTC](https://community.gatling.io/t/running-scenarios-in-parallel/5299 "2019-10-16T23:37:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nagendra\_Darla](https://avatars.discourse-cdn.com/v4/letter/n/e8c25b/32.png) [@Nagendra\_Darla](https://community.gatling.io/u/Nagendra_Darla)\
**Post date:** [October 16, 2019, 11:37pm UTC](https://community.gatling.io/t/running-scenarios-in-parallel/5299/1 "2019-10-16T23:37:51Z")

</div>

Hi,

Will below script runs the scenarios in parallel/concurrently? or do I have to do it differently? My goal is to run different scenarios concurrently to test the performance of the system.

```auto
val usersApiScenarios = List(
  GetAllUsers.getUsers.inject(
    atOnceUsers(100),
  ),
  GetUserByUsername.getUserByUsername.inject(
    atOnceUsers(100),
  )
 )

```

---

<div class="post-metadata">

**Author:** ![Alex\_Xiong](https://avatars.discourse-cdn.com/v4/letter/a/73ab20/32.png) [@Alex\_Xiong](https://community.gatling.io/u/Alex_Xiong)\
**Post date:** [October 17, 2019, 7:07am UTC](https://community.gatling.io/t/running-scenarios-in-parallel/5299/2 "2019-10-17T07:07:33Z")

</div>

if you want to run scenarios concurrently:  
setUp(  
scn\_1.inject(// traffic profile),  
scn\_2.inject(// traffic profile)  
)

if you want to run scenarios sequentially,  
setUp(  
scn\_1.inject( … during x seconds)  
scn\_2.inject(  
nothingFor(x seconds),  
// traffic profile  
)  
)

And ofc, within each scenarios, you could execute sequentially: scn = scenario(“randomName”).exec(api\_1, api\_2, api\_3)

Those are my experience, might not be the best solution, but works.

Best,  
Alex

---

<div class="post-metadata">

**Author:** ![Nagendra\_Darla](https://avatars.discourse-cdn.com/v4/letter/n/e8c25b/32.png) [@Nagendra\_Darla](https://community.gatling.io/u/Nagendra_Darla)\
**Post date:** [October 17, 2019, 7:55pm UTC](https://community.gatling.io/t/running-scenarios-in-parallel/5299/3 "2019-10-17T19:55:12Z")

</div>

Thank you Alex.

But I am trying to understand.  
The only difference I see is that if the scenarios are separated by coma in the setup, they run concurrently. And if there is no coma between the scenarios they run sequentially.  
Am I right?

Can point me to any documentation if there is any.

Thank You in advance.

---

<div class="post-metadata">

**Author:** ![Alex\_Xiong](https://avatars.discourse-cdn.com/v4/letter/a/73ab20/32.png) [@Alex\_Xiong](https://community.gatling.io/u/Alex_Xiong)\
**Post date:** [October 18, 2019, 1:29am UTC](https://community.gatling.io/t/running-scenarios-in-parallel/5299/4 "2019-10-18T01:29:37Z")

</div>

oh, sorry, that was a typo, there should be comma, the difference is that to run scn sequentially, I use “nothingFor” [https://gatling.io/docs/current/general/simulation\_setup/#open-model](https://gatling.io/docs/current/general/simulation_setup/#open-model)  
to make sure the second scn only starts after the first.

---

<div class="post-metadata">

**Author:** ![Nagendra\_Darla](https://avatars.discourse-cdn.com/v4/letter/n/e8c25b/32.png) [@Nagendra\_Darla](https://community.gatling.io/u/Nagendra_Darla)\
**Post date:** [October 18, 2019, 9:03pm UTC](https://community.gatling.io/t/running-scenarios-in-parallel/5299/5 "2019-10-18T21:03:00Z")

</div>

Thank you.
