Sunday, March 24, 2024

Hmmm...DNS cache expiry patterns ...

So I need a really fast DDNS because ... reasons ... so I tried out the cloudflare DDNS.

Basically what I did is I sent the update query and then I kept running the host command over and over again.

So I sent the update query then I saw it took around 44 seconds for the new value to show up in host.

I tried dynu which says it has 30 second TTL (WOW!) and saw that DNS update took around 48 seconds.

But then I tried dynu again and saw that this time the DNS update took only 4 seconds.

I investigated further and saw this pattern:

21:24:36 Request sent

21:25:24 DNS updated (48s)


21:26:21 Request sent

21:26:25 DNS updated (4s)

 

23:45:02 Request sent

23:46:01 DNS updated (59s)

 

23:46:22 Request sent

23:47:03 DNS updated (41s)

 

23:47:19 Request sent

23:48:03 DNS updated (44s)

 

23:48:57 Request sent

23:49:03 DNS updated (6s)

 
I find it interesting that in the last 4 cases, the DNS update happened near the start of the minute, but in the first two cases, the DNS update happened near second 24-25. 

It could just be a coincidence, or this could indicate that DNS cache timeouts are happening roughly in 1 minute intervals, but with some drift.

I tried again with Cloudflare:

23:58:11 Request sent

23:58:38 DNS updated (27s)

 

00:00:08 Request sent

00:00:52 DNS updated (44s)


00:01:17 Request sent

00:01:52 DNS updated (35s)

 

00:02:44 Request sent

00:02:53 DNS updated (9s)


Here again we see the familiar pattern of the DNS updating around the same second for multiple minutes consecutively, yet from 23:58 to 00:00 it changed from second 38 to second 52-53. 

It seems to me that there is some kind of pattern that occurs regardless of which DDNS service you use.

DNS updates happen via cache expiry, and it seems that the cache can expire around the same time every minute?

Also it seems that the expiry time also changes?

Not really sure what's going on.

 

 

 

In any case, my takeaway from all this is that you cannot count on a TTL of less than 60 seconds. The dynu TTL of 30 seconds does not seem to guarantee that you will see the DNS updated in less than 30 seconds after it changes - sometimes it is more than 30 seconds, sometimes it is less. It should be less than 60 seconds though.

I suppose if you want really fast DDNS, you could host your own special "DNS" server and send a packet there every second so that it will know immediately when your IP changes...

No comments:

Post a Comment