Failing DNS lookups slowing down site after upgrade

I ran into a problem today while setting up a content delivery server after upgrading from Sitecore 6.4 to 7.2. After setting everything up, the site ran very slowly and the Sitecore Log started filling with exceptions like this:

System.Net.Sockets.SocketException: The requested name is valid, but no data of the requested type was found
...
Sitecore.Web.WebUtil.GetHostIPAddress()

When looking into what happens inside GetHostIPAddress() I found out that Sitecore calls this method to resolve the IP from the host name on each request.

Normally not a problem but, in this setup, the CD running behind a load balancer couldn’t resolve the domain name it was serving. That way DNS lookup timed out on each request. By adding the domain names of the site with the local IP to the hosts file, I could resolve the problem and the site was immediately working at full speed again.

# example hosts file entry
127.0.0.1 www.mydomain.com

By the look of it, older versions of Sitecore didn’t do this kind of DNS resolving on each request. That’s why you should keep this in mind when upgrading CD servers.


Leave a Reply

Your email address will not be published. Required fields are marked *