diff options
author | eroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-10 07:23:40 +0000 |
---|---|---|
committer | eroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-10 07:23:40 +0000 |
commit | 112bd4674a886777b79dcd03263088b692fb47fd (patch) | |
tree | 7cf667fa50e6e9284d3a4f1d294cf86719698ff9 /net/tools/hresolv | |
parent | a4121a67a6a1383048d31130305e472966b44c97 (diff) | |
download | chromium_src-112bd4674a886777b79dcd03263088b692fb47fd.zip chromium_src-112bd4674a886777b79dcd03263088b692fb47fd.tar.gz chromium_src-112bd4674a886777b79dcd03263088b692fb47fd.tar.bz2 |
Cache failed DNS resolutions for 1 second.
This is a very small time to live, since we want to be able to respond quickly when formerly unresolvable names become resolvable.
Even such a small time is still useful, since cache misses for unresolvable names can be extremely costly (order of several seconds).
For example, in our corp PAC script, the URL's host is resolved 3 times, so:
Without caching, total runtime is (2.5 seconds) * 3 --> 7.5 seconds.
Whereas with caching it would be: (2.5 seconds) * 1 --> 2.5 seconds
This time to live will need to be tuned as part of bug 25472.
BUG=11079
Review URL: http://codereview.chromium.org/464084
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34238 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/tools/hresolv')
-rw-r--r-- | net/tools/hresolv/hresolv.cc | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/net/tools/hresolv/hresolv.cc b/net/tools/hresolv/hresolv.cc index 18a98ff..f662817 100644 --- a/net/tools/hresolv/hresolv.cc +++ b/net/tools/hresolv/hresolv.cc @@ -446,8 +446,13 @@ int main(int argc, char** argv) { } } + net::HostCache* cache = new net::HostCache( + options.cache_size, + base::TimeDelta::FromMilliseconds(options.cache_ttl), + base::TimeDelta::FromSeconds(0)); + scoped_refptr<net::HostResolver> host_resolver( - new net::HostResolverImpl(NULL, options.cache_size, options.cache_ttl)); + new net::HostResolverImpl(NULL, cache)); ResolverInvoker invoker(host_resolver.get()); invoker.ResolveAll(hosts_and_times, options.async); |