How to use Gatling to let users run scenario concurrently?


I’m using Gatling sbt plugin to run some of my test but I found out even though I can bring up users together, but the scenarios can only run by one user at a time.

So I wrote some simple test like this. I set 10 users, I expect to have different users run concurrently so I should see printlns for different numbers. But I can only see one number that means only one user running the scenario.

I’m using sbt plugin version 1.0. gatling core version is 2.0.0

def basicTestAction = {
  exec((session) => {
    withReporting(session) {

You’re creating a busy loop that will never release the thread.

Hi, Stephane:

Thanks for replying. I meant to make it more clear that it will run one by one.I tried to remove the while loop or give it a limit, but see the same thing, the second user will only run scenario after the first user done.

For users spawn at the exact same time (atOnceUsers), first action gets currently executed in the scheduler thread.
Impossible to guess if that’s an issue and if we’d get a speed boost if we were jumping into an event loop here, we’d have to benchmark.
Remember that your usage violates a string Gatling principle: don’t run long computations in our threads.

Thanks Stephane.

Do you mean we can’t add event loop in a scenario?

I’m not sure what you mean by “don’t run long computations in our threads”? Could you please explain?