I have a single local redis replica of a remote master.

The master is specified by dns name because it's a service published to dns by consul.

Queries to the replica take milliseconds when the master name resolves.

But, if the master name doesn't resolve, queries to the replica take over 3.5 seconds - I suppose due to timeout looking up the dns name.

This is easy to test - take a working local redis, check query response time then set: replicaof this.is.not.a.name 6379

Now all queries will take longer.

Now change the local redis to not be a replica: replicaof no one

Queries are now quick again.

It'd be much nicer if redis tried to reconnect to the master out-of-band from queries, or I had a way to shorten the dns name resolution timeout

Comment From: yossigo

Hi @andybrown668, there is no configuration parameter for this. It's not a trivial problem because there is no portable way to handle async DNS or even set a timeout.

You may try to explore system-wide resolver configuration using /etc/resolv.conf configuration, but that would depend on the specific OS/distribution you use.