Current time: 10-16-2019, 12:58 PM Hello There, Guest! (LoginRegister)

Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
DNS TTL & CDN
06-11-2011, 08:21 PM (This post was last modified: 06-11-2011 08:23 PM by Marvin.)
Post: #1
DNS TTL & CDN
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?

Marvin
Find all posts by this user
Quote this message in a reply
06-14-2011, 08:33 PM
Post: #2
RE: DNS TTL & CDN
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.

(06-11-2011 08:21 PM)Marvin Wrote:  I changed the TTL of all the records at my DNS from 30 minutes to 14 days.

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.

(06-11-2011 08:21 PM)Marvin Wrote:  Is there anything more I can do? [....] cdn.mydomain.com

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 .. 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.
Find all posts by this user
Quote this message in a reply
06-14-2011, 11:50 PM
Post: #3
RE: DNS TTL & CDN
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.
Visit this user's website Find all posts by this user
Quote this message in a reply
06-15-2011, 02:11 AM (This post was last modified: 06-15-2011 04:11 AM by Marvin.)
Post: #4
RE: DNS TTL & CDN
Jesper Wrote: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.

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. :-)
http://www.webpagetest.org/result/110614_2C_TSY3/

Jesper Wrote:Personally, I would not do that. Earlier in my career a provider went down catastrophically for 2 days

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.

Jesper Wrote:Another thing you can do, is to go with a more performant DNS host.

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

Patrick Wrote:make sure the CDN provider is also using an anycast network for their DNS

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.

Marvin
Find all posts by this user
Quote this message in a reply
06-19-2011, 09:00 PM (This post was last modified: 06-19-2011 09:02 PM by Marvin.)
Post: #5
RE: DNS TTL & CDN
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?

Marvin
Find all posts by this user
Quote this message in a reply
06-20-2011, 11:15 PM
Post: #6
RE: DNS TTL & CDN
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.
Visit this user's website Find all posts by this user
Quote this message in a reply
06-21-2011, 12:40 AM
Post: #7
RE: DNS TTL & CDN
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.

Marvin
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)