[Gatling 2] limit number of active connections

Hi there
is there any way to limit maximium number of active connections created during test?

I’ve come to a situation when server starts to close connections as number of connections
reaches 1.5k+ connections. When test reaches 2k connections - i have 100% fails.

So i need to try to load server but use not more than 1.5k active connections


Consider ramping up further by reducing the thinktime, then.
The formula for that is roughly:

Factor = rampup time passed / total rampup time
TPS = max load * factor
Thinktime = users / TPS - response time

How to build that in gatling is something best left as an exercise to the reader…


Is your system under test a website. If so, Gatling’s default behavior is correct, in the sense that every virtual users have their own connections.
IMHO, trying to cap the number of concurrent connection is a bad idea. If your system cannot handle that many connections, it probably means that it lack some proper connection tuning, like Keep-Alive max duration and the likes.

Note that it would be a good idea to set up maxRetry to something bigger than zero in gatling.conf so that Gatling properly handles connections closed from the server side.

If you really want to cap connections, please have a look at gatling.conf file.