DNS load balancing

Hi there,

We have a HAProxy-cluster setup where we have configured our DNS to point at two HAProxy servers:

example.com. 300 IN A
example.com. 300 IN A

When we shutdown the HAProxy running at, gatling starts choking, instead of sending traffic to the HAProxy running at

If I’m correct, DNS resoultion in gatling is handled by org.asynchttpclient.channel.NameResolver.JdkNameResolver, but that will only return the first ip address from DNS.
Apparently, most browsers behave differently - for instance they might fallback to the second ip address when the first one is unavailable, or use alternating ip addresses between requests.

  1. Wouldn’t it make sense to create a few NameResolvers that match different browsers/clients in AHC?
  2. Wouldn’t it make sense to make the NameResolver pluggable/configurable in gatling to match browser behaviour?



I just noticed there is some code in io.gatling.http.request.builder.RequestExpressionBuilder and io.gatling.http.util.DnsHelper which deals with these things, overriding the default AHC behaviour.

However - this code also uses only the first record. Would it make sense to modify this behaviour?


Yes, but that’s quite some work!

Ok. Unfortunately, I’m still a scala novice, otherwise I would certainly have made a contribution.

Should I file a github issue in case someone finds time to look at this?


Please do.