Polling kills my machine


I’m in the 3.9 version of Gatling. I don’t know if I’m doing well but with this scenario:

ScenarioBuilder scenarioBuild() {



My laptop finish to block. It creates many many requests. My goal was to exec a request every 5 secs during 1 minute. What I’m doing wrong?

Here a copy of the console report:

---- Requests ------------------------------------------------------------------
> Global                                                   (OK=12     KO=40929 )
> Computer filter Commodore                                (OK=12     KO=40929 )
---- Errors --------------------------------------------------------------------
> j.n.SocketException: No buffer space available (maximum connec  40929 (100.0%)
tions reached?): connect

Thanks in advance!

check this solution:

poll is a non blocking background task so your scenario terminates immediately as it doesn’t contain anything else.

Your injection profile is constantConcurrentUsers(1) meaning a new virtual user starts as soon as the current single one terminates.

As a result, you’re indeed spawning virtual users like crazy.

Note that your scenario must call .exec(poll().stop()).

Ok. Thanks slandelle. I didn’t fully understand poll action.

I don’t get why:

is solution if you write:

I’m little confused :confused:

Of corse you are missing things that @slandelle mention but you try to archive some goal.

@GeMi Both our answers are partial solutions: you explained how to implement the user case properly, I explained why the current code doesn’t work and why it crashes (and that it’s not a Gatling bug).

1 Like