When perf-testing a dummy RESTful service I have ran into the ConnectException: Cannot assign requested address
problem, described here or here, and applied the tuning recommendations - increased the ephemeral port range to 10000-65000, my ulimit -n
is 64000 and I have even enabled net.ipv4.tcp_tw_reuse
and net.ipv4.tcp_tw_recycle
- more info about these on this excellent blogpost Coping with the TCP TIME-WAIT state on busy Linux servers .
This still did not help, I still could simulate at most 10k requests per second (since in my test each user does only single request), so I've scaled out to 4 and later 8 client machines. On 4 machines I could do 5k requests/s per machine (total of 20k) but on 8 I even can't run on those 5k, so maybe the problem is elsewhere.
Nevertheless, I'd like to ask if there are any options to set SocketOptions
on the gatling connection, either through the Simulation or through gatling.conf - I'd like to use SO_REUSEADDR there. Some options (connection timeouts) can be set in gatling.conf, but I haven't found this one.
Also, is there any document describing how does Gatling share connections? I would expect either a big connection pool where the 'users' grab their connection instances or dummy each-user-opens-his-connection, but somewhere I've read that there's a connection pool per user (who's he sharing the connections with, then? Or are these just cached connection used in his previous requests?).
EDIT: So the solution was simple in the end: use .shareConnections
when setting ScenarioBuilder.protocols(...)
. I have tried to use -Dgatling.core.http.shareConnections
as command line arg (I am running the test from maven plugin) but it did not work; programmatic approach did.
I'd like to use SO_REUSEADDR there.
Not possible atm. Will be in 2.2.
is there any document describing how does Gatling share connections?
Yes, here. Default is one connection pool per virtual users, as a virtual users can use more than one concurrent connection when fetching resources, just like a browser. You can then switch to one shared global pool.