DNS load balancing

Hi there,

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

;; ANSWER SECTION:
example.com. 300 IN A 123.123.123.1
example.com. 300 IN A 123.123.123.2

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

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?

Cheers,

Stefan

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?

Stefan

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?

Stefan

Please do.