I’ve started experimenting with Gatling (3.3.1) over the past few weeks. It’s a great tool and this community is a nice place for information, but I haven’t found an answer to something which I’m trying to understand.
What is the expected behaviour when shareConnections and maxConnectionsPerHost(X) are both used? I would expect this to create at most X outgoing connections per host and have all users share this common pool of connections. However I’ve noticed that this does not hold when running with a relatively large number of virtual users. For example, running 4000 users with shareConnections and maxConnectionsPerHost(50) and 3 hosts, I was expecting to see (using netstat) around 150 outgoing connections. What I notice instead is around 600-700 connections being used during the test.
The way I count the number of connections is by using
sudo lsof -n -i | grep -e LISTEN -e ESTABLISHED | grep java | wc -l
When not running a test, I only see 4-5 active connections. And when investigating the connections when running the tests, they indeed all seem to be going to the correct hosts, so I’m quite confident that these are connections used by Gatling.
Could anyone please offer some insight on this behaviour? I need to have a tight control over this number of connections, if possible.