Understanding shareConnections and maxConnectionsPerHost

Hi,

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.

Kind regards,
Razvan Brinzea

shareConnections and maxConnectionsPerHost are completely unrelated and incompatible.

shareConnections is for using a single global connection pool for simulating server to server traffic.
maxConnectionsPerHost is for limiting the number of connections to a same host when fetching multiple concurrent resources over HTTP/1.1.

I see, thanks for the quick reply! So essentially the way to cap the number of connections being opened to the hosts is by controlling the number of virtual users that are being run, right?

Regards,
Razvan Brinzea

luni, 13 aprilie 2020, 17:28:31 UTC+3, Stéphane Landelle a scris:

Exactly