Delayed DNS Resolution On RHEL Derived VPS Print

  • 0

Recently a client brought to our attention that there was sometimes a delay when making certain types of network requests from their VPS.

As excellent network performance is one of the things we pride ourselves in at Farbyte, our support team took it upon themselves to find out the cause.

During our investigations, we found that any network request made from the VPS using a DNS name seemed to be delayed by about 5 seconds before responding. This included using tools like curl and wget from the command line. It also delayed the response of web pages being delivered from the VPS that were in turn gathering data from other 3rd party sources (e.g. RSS feeds).

To test if you're being affected by this issue, you can run the following command:

time wget www.farbyte.com

You should get a result something similar to:

real    0m0.269s
user    0m0.001s
sys     0m0.002s

If the results you get indicate a response of about 5 seconds, then you have the same problem.

Red Hat Linux LogoIt turned out that the issue affects some of the newer Red Hat Linux based distributions (CentOS6, SL6, etc.) that have IPv6 turned on by default for domain name resolution. Older distributions were not affected.

We found the fault attributable to the DNS resolver service on the VPS issuing an IPv6 AAAA record request prior to an IPv4 A record request, even though there were no IPv6 addresses allocated to the VPS!

The IPv6 DNS request would time out after about 5 seconds and thus the DNS resolver would subsequently send an IPv4 DNS request. The IPv4 request  would resolve in a normal fashion and the data transfer would be fulfilled via IPv4.

Like most things, once you know the cause of an issue the fix can be quite simple. In this case we added the following line into the /etc/resolv.conf file:

options single-request

That's all there is to it! DNS based hostnames were now resolved in lightening fast times once again.


Was this answer helpful?

« Back