Thanks for the responses.
shouldbe q931, in a private email to me, and Baptiste, both suggested I not use 
DNS.
Baptiste suggested VRRP and shouldbe q931 suggested something similar using 
keepalived.
I replied to shouldbe q931 thus:

As far as I know, keepalived requires a separate network interface connecting 
the 2 servers
to manage the heartbeat connection.
In my case, the 2 HAProxy servers are in different Amazon AWS Availability 
Zones (Data Centers)
with different network subnets.
I don’t think I can make keepalived work in this configuration.

Igor, you suggested 30 seconds was too long for a health check failover.
Unfortunately, that is the minimum setting that NS1 supports.

The reason the NS1 Filter only returns the first healthy HAProxy is that this 
configuration has been in place
for quite some time while my HAProxy servers were running version 1.5.
I’m in the process of upgrading all my HAProxy servers to version 1.7.8 with a 
peers section defined.
So I believe I can now safely change the NS1 Filter to round-robin mode.

You’re suggestion to reduce the JVM ttl value sounds interesting.
I’m guessing you think this will force IE to refresh its DNS cache.

Something interesting appeared in my testing.
With haproxy1 and haproxy2 running, I connected to my app using IE.
I then shutdown haproxy1.
After 30 seconds, NS1 performed a DNS failover to haproxy2 and the IE client 
complained about no connection.
(In a 2nd tab it connects immediately as usual.)
After about 20 minutes the first tab reconnected.
I then restarted haproxy1.
After 30 seconds, NS1 performed a DNS switch back to haproxy1.
Now the IE client continued to operate correctly!
It’s as if it had seen haproxy1 before so it didn’t complain on the switch 
back?!?

From: Igor Cicimov [mailto:ig...@encompasscorporation.com]
Sent: July-08-17 9:14 AM
To: Norman Branitsky <norman.branit...@micropact.com>
Cc: HAProxy <haproxy@formilux.org>
Subject: RE: HAProxy failover - DNS change cached by IE for a long time

On 8 Jul 2017 2:58 am, "Norman Branitsky" 
<norman.branit...@micropact.com<mailto:norman.branit...@micropact.com>> wrote:
I changed the TTL on my application’s DNS entry, to no avail.
Try tuning these parameters in jvm, assuming Sun oracle jdk here:

-Dsun.net.inetaddr.ttl=value
-Dsun.net.inetaddr.negative.tt<http://Dsun.net.inetaddr.negative.tt>l=value

If security manager is installled System wide, by adding a line containing

networkaddress.cache.ttl=value

in $JAVA_HOME/jre/lib/security/java.security

JDK 1.6, 1.7 & 1.8 default cache setting:

30 secs (When a security manager is not set)
-1           (When a security manager is set)

* DNS Cache is refreshed every 30 seconds

So adjust the value to some low value of 10 sec say.
Once the DNS entry updates to point to the 2nd HAProxy server,
IE displays it’s dnserror.htm page:
“This page can’t be displayed”.
Copy/Paste the URL into a new tab and the page renders immediately.
The original tab continues to display the dnserror page –
probably for 20 minutes.
From: Norman Branitsky 
[mailto:norman.branit...@micropact.com<mailto:norman.branit...@micropact.com>]
Sent: June-27-17 10:44 AM
To: haproxy@formilux.org<mailto:haproxy@formilux.org>
Subject: HAProxy failover - DNS change cached by IE for a long time

This sender failed our fraud detection checks and may not be who they appear to 
be. Learn about spoofing<http://aka.ms/LearnAboutSpoofing>

Feedback<http://aka.ms/SafetyTipsFeedback>

Using the NS1 managed DNS service, I monitor the health of 2 HAProxy 1.7.7 
servers defined as peers.
NS1 checks the health of the HAProxy servers every 30 seconds.
If haproxy1 fails to respond, NS1 changes the DNS response to point to haproxy2.
When haproxy1 comes back online, NS1 reverts the DNS response to haproxy1.
NS1 checks the health of my Java application server every 60 seconds.
NS1 DNS records looks like this:

haproxy1 A record

haproxy2 A record

tm1      CNAME record “Dynamic” – NS1 “filter” returns the first in the list of 
all health haproxy servers

vr       CNAME record pointing to tm1 – name of the Java application server
If I connect to my Java application with Chrome or Firefox, I often don’t 
notice the haproxy DNS failover.
If I do get a connection error, it almost always reconnects within seconds.
I don’t lose my session.
If I connect to my Java application with IE (only tested IE10 mode so far), the 
haproxy DNS failover cause a DNS error.
This error won’t clear for at least 20 minutes.
If I open a new tab I connect instantly.
Since the JSESSIONID cookie is still available, I’m still logged in but 
obviously not on the same data entry page.
What can I do to kick IE in the head and cause it to refresh its DNS cache?
It doesn’t seem to respect the TTL value.

Reply via email to