1 min TTL in DNS cache

2,665 views
Skip to first unread message

sat

unread,
Apr 9, 2011, 12:07:56 PM4/9/11
to Chromium-discuss
Hello.

It looks to me that every entry in DNS cache has 1 min TTL and no
honoring of TTL value in DNS lookup response. Can anyone hint why this
is being built this way?.. Any good reason reason why 1 min TTL value
is chosen?

Thanks in advance
sat

sat

unread,
Apr 12, 2011, 9:54:12 AM4/12/11
to Chromium-discuss
still no replies :) anyone? anything?

Nico Weber

unread,
Apr 12, 2011, 10:48:00 AM4/12/11
to sata...@gmail.com, Chromium-discuss
On Tue, Apr 12, 2011 at 6:54 AM, sat <sata...@gmail.com> wrote:
> still no replies :) anyone? anything?
>
> On Apr 9, 7:07 pm, sat <satant...@gmail.com> wrote:
>> Hello.
>>
>> It looks to me that every entry in DNS cache has 1 min TTL and no
>> honoring of TTL value in DNS lookup response.

I doubt this is true :-) How did you come up with this number?

>> Can anyone hint why this
>> is being built this way?.. Any good reason reason why 1 min TTL value
>> is chosen?
>>
>> Thanks in advance
>> sat
>

> --
> Chromium Discussion mailing list: chromium...@chromium.org
> View archives, change email options, or unsubscribe:
>    http://groups.google.com/a/chromium.org/group/chromium-discuss
>

Nathan Williams

unread,
Apr 12, 2011, 11:22:54 AM4/12/11
to tha...@chromium.org, sata...@gmail.com, Chromium-discuss
src/net/base/host_resolver_impl.cc, lines 61-70:

HostCache* CreateDefaultCache() {
  static const size_t kMaxHostCacheEntries = 100;

  HostCache* cache = new HostCache(
      kMaxHostCacheEntries,
      base::TimeDelta::FromMinutes(1),
      base::TimeDelta::FromSeconds(0));  // Disable caching of failed DNS.

  return cache;
}

and search for later uses of this cache.

This is a limitation of using the system's getaddrinfo() interface to resolve names - it doesn't tell you anything about the cacheability of the results (It might not even be backed by DNS), so your choices are this kind of naive caching, or no caching at all.
I know people have looked at implementing DNS directly, to get around this limitation; to me, this seems like more of a system-level responsibility.

    - Nathan

Costi Elster

unread,
Apr 12, 2011, 11:41:07 AM4/12/11
to Nathan Williams, tha...@chromium.org, Chromium-discuss
Thank you very much Nathan!
But is there any deeper thought behind the one minute? 

One could suggest that this value is chosen as low enough to make sure that chromium refreshes DNS cache from OS-level DNS cache frequently enough. I'm trying to understand if 1min was chosen arbitrarily or there is a better thought there? I.e. why not 30 seconds? :)

Thanks,
sat

Richard Allen

unread,
Oct 11, 2013, 7:13:59 AM10/11/13
to chromium...@chromium.org, Nathan Williams, tha...@chromium.org
Sat, albeit this was a while ago, did you find out if there was any reason behind one minute? 

Chris Bentzel

unread,
Oct 11, 2013, 2:19:11 PM10/11/13
to rou...@gmail.com, Szymon Jakubczak, Chromium-discuss, Nathan Williams, Nico Weber
+szym, who can answer all questions about why the host cache acts as it does.

Do you have specific concerns about the current implementation? Note
that it is a bit different than where it was 2 years ago.
> --

Szymon Jakubczak

unread,
Oct 11, 2013, 3:09:00 PM10/11/13
to Chris Bentzel, rou...@gmail.com, Chromium-discuss, Nathan Williams, Nico Weber
Historically, HostCache was a cache in front of the getaddrinfo cache (if one's present). HostCache was created because there was no way to call getaddrinfo cheaply (no way to tell "from cache only"). 60s was chosen rather arbitrarily. It is long enough to outlast 99.5% page load times.

Today, on Mac, Linux, and CrOS, HostCache is _the_ DNS cache. It still uses 60s as minimum TTL because we don't want to have to resolve a record twice during one page load, and with many DNS records expiring in < 30s it becomes a performance hit for the client.

Low TTLs are essential for responsive load balancing, but at the end client they are not as critical as in the caching recursive DNS server (e.g., at the ISP level).

Chris Bentzel

unread,
Oct 23, 2016, 8:17:14 PM10/23/16
to Pietrod, Chromium-discuss, rou...@gmail.com, n...@chromium.org, tha...@chromium.org
This is still on top of any system resolver cache, so it's unlikely to be a minute each time.

On Sun, Oct 23, 2016 at 8:06 PM Pietrod <pietr...@gmail.com> wrote:
from Nathan Williams answer it seems there isn't an option to change the 1 minute setting am I right? I really don't need a dns refresh every minute!

Pietrod

unread,
Oct 25, 2016, 2:10:15 AM10/25/16
to Chromium-discuss, cben...@chromium.org, rou...@gmail.com, n...@chromium.org, tha...@chromium.org
from Nathan Williams answer it seems there isn't an option to change the 1 minute setting am I right? I really don't need a dns refresh every minute!

Il giorno venerdì 11 ottobre 2013 21:09:00 UTC+2, szym ha scritto:

rus...@wordpressoverwatch.com

unread,
Sep 2, 2017, 4:08:28 PM9/2/17
to Chromium-discuss, cben...@chromium.org, rou...@gmail.com, n...@chromium.org, tha...@chromium.org, pietr...@gmail.com
I agree. It would be nice if there was an option to change the 1 minute setting. For those of us who frequently make changes to our hosts file, it would be nice if we didn't have to wait an entire minute to see changes to the hosts file take affect, and since almost all websites load in less than 10 seconds, I would fine it much more convenient if I could lower this 1 minute setting.
Reply all
Reply to author
Forward
0 new messages