Issue: I’ve observed that each time I ran a WebPageTest, the first test would indicate a longer DNS lookup time than all the subsequent tests.

How I helped it: I changed the TTL of all the records at my DNS from 30 minutes to 14 days. (14 days is probably unusually long, but I don’t plan on switching my current host, and if I ever do, I will lower the TTL at least a couple of weeks in advance.)

Is there anything more I can do? Tests show that the issue has been resolved for the base page, which is served from my origin server, but the issue has not been helped for files served by my CDN, even though I changed the DNS TTL of cdn.mydomain.com, too. I suspect the CDN provider would have to change their TTL settings, too, for this to improve. Am I correct in my assumption? Is there a chance a CDN provider will do it if I request it?

DNS lookup times can fluctuate quite a bit, dependent on many things. I’ve often seen mine be between 100 ms and 200 ms, and up to 400 ms isn’t unheard of.

Personally, I would not do that. Earlier in my career a provider went down catastrophically for 2 days (one of those issues that should not be able to happen). We had cached DNS entries out in different ISP caches. We were offline for some customers for days, and unable to do a thing about it. That was horrible.

I tend to keep my main A Records at 30 minutes TTL, and consider up to 3 hours TTL to be reasonable.

Perhaps skip the vanity domain CNAME cdn.mydomain.com and just reference the CDN URL directly in your HTML? Who cares that somebody can see which CDN provider you’re using directly in the HTML HREF’s.

Another thing you can do, is to go with a more performant DNS host. The differences are quite small, but a DNS host with
[]a BGP Anycast’ed network (http://en.wikipedia.org/wiki/Anycast)
]and DNS servers on many continents
[*]and excellent upstream connectivity
… will on average be a little bit faster than a DNS provider with a smaller and/or single-homed network. It’s not much, perhaps at most 50 ms if all your customers are on the same continent as your DNS host, and perhaps up to a couple of hundred ms in the worst case if your customers are very far away.

Some examples of Anycast’ed DNS are DynDNS Dynect, EasyDNS, and Amazon Route 53.

Jesper nailed it pretty well. The only thing I would add on the CDN case is to make sure the CDN provider is also using an anycast network for their DNS (some of the largest are not which just boggles the mind). There are also a couple of CDN providers that do TCP Anycast (CacheFly and MaxCDN/NetDNA I believe) so they can have long TTL’s on their entries.

What an excellent idea! Thank you so much, Jesper. I just implemented it! Done, and I’m a happy camper. I bet it saves a few precious milliseconds. It’s hard to measure it, so I’m not even going to bother, but I know it’s going to help.

For some reason, it even improved my score from 98 to 100. :slight_smile:

I hear you loud and clear, Jesper. If this was a commercial site, I wouldn’t take this risk either. But this is just a hobby site of mine, and the world will not end if it goes down for a while. For now, I do prefer to improve the performance a small bit, even if I have to take this risk. My current host is very good, too.

A couple of months ago I switched to DNS Made Easy, and I’m happy I did.

My CDN provider is AISO, a reseller of EdgeCast. I don’t know for sure if they are using an Anycast network also for their DNS. My guess is that they probably are, but I don’t know how to determine that.

Just like I substituted the vanity domain CNAME cdn.mydomain.com and just referenced the CDN URL directly in my HTML, as suggested by Jesper, could I also change the DNS server references at my registrar from, for example, ns1.myhost.com and ns2.myhost.com, to their corresponding IP numbers?

Would this work? And if yes, then would this also help?

It might help a little but you may be making things more fragile if your DNS provider is expecting to be able to rotate the IP addresses (maintenance, etc). Making the change to your authority records can take over a week to propagate (at least that’s what I was seeing when I moved WebPagetest’s hosting). Since it’s a hobby site you can certainly experiment with it but I don’t expect that the results are going to be noticeable.

Thanks, Pat. I did try to experiment, but my registrar’s web form is not accepting IP numbers for this. When I substitute ns1.example.com with an IP and save it, and then when I refresh the page, the nst1.example.com is still there. So I’m not going to worry about it, and I will leave it as is.