Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(120)

Issue 125107: * Move the global "DnsResolutionObserver" code depended on by DNS prefetcher,... (Closed)

Created:
11 years, 6 months ago by eroman
Modified:
9 years, 6 months ago
CC:
chromium-reviews_googlegroups.com
Visibility:
Public.

Description

* Move the global "DnsResolutionObserver" code depended on by DNS prefetcher, into HostResolver. This has the advantage that consumers of DNS no longer have to remember to call "DidFinishDnsResolutionWithStatus()" followed by "DidStartDnsResolution()" in order for the prefetcher to observe the resolution. Instead it just happens automatically, and subscribers register via HostResolver::AddObserver() on a particular resolver instance. * To accomodate the prefetcher's observer, HostResolver::Resolve() needs an additional "referrer" parameter. This is slightly awkward since "referrer" has nothing to do with the actual resolve request. To simplify plumbing through this and other optional parameters, Resolve() was changed to take a "RequestInfo&" parameter in place of say {hostname, port, flags}. * Added an option to HostResolver::Resolve() for disallowing cached responses (RequestInfo::allow_cached_response). This will be used when you refresh a page, to bypass the host cache. The code to do this has been added to HttpNetworkTransaction, but is commented out pending an appropriate unit-test to verify it. BUG=14056 Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=18371

Patch Set 1 #

Patch Set 2 : Sync and fix-up some comments #

Patch Set 3 : rename magic referrer #

Total comments: 26

Patch Set 4 : Address jar's comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+523 lines, -264 lines) Patch
M chrome/browser/net/dns_global.cc View 1 2 3 5 chunks +33 lines, -18 lines 0 comments Download
M chrome/browser/net/dns_master.cc View 1 2 3 1 chunk +10 lines, -2 lines 0 comments Download
M chrome/browser/net/dns_master_unittest.cc View 1 1 chunk +2 lines, -1 line 0 comments Download
M net/base/client_socket_handle.h View 1 3 chunks +4 lines, -4 lines 0 comments Download
M net/base/client_socket_handle.cc View 1 1 chunk +2 lines, -3 lines 0 comments Download
M net/base/client_socket_pool.h View 1 2 chunks +2 lines, -3 lines 0 comments Download
M net/base/dns_resolution_observer.h View 1 2 3 2 chunks +11 lines, -31 lines 0 comments Download
D net/base/dns_resolution_observer.cc View 1 1 chunk +0 lines, -60 lines 0 comments Download
M net/base/host_resolver.h View 1 2 3 8 chunks +73 lines, -7 lines 0 comments Download
M net/base/host_resolver.cc View 1 2 3 12 chunks +87 lines, -28 lines 0 comments Download
M net/base/host_resolver_unittest.cc View 1 2 3 11 chunks +190 lines, -18 lines 0 comments Download
M net/base/ssl_client_socket_unittest.cc View 1 6 chunks +13 lines, -12 lines 0 comments Download
M net/base/ssl_test_util.cc View 1 1 chunk +2 lines, -1 line 0 comments Download
M net/base/tcp_client_socket_pool.h View 1 3 chunks +15 lines, -5 lines 0 comments Download
M net/base/tcp_client_socket_pool.cc View 1 2 3 4 chunks +14 lines, -27 lines 0 comments Download
M net/base/tcp_client_socket_pool_unittest.cc View 1 12 chunks +26 lines, -25 lines 0 comments Download
M net/base/tcp_client_socket_unittest.cc View 1 1 chunk +2 lines, -1 line 0 comments Download
M net/base/tcp_pinger_unittest.cc View 1 2 chunks +4 lines, -2 lines 0 comments Download
M net/ftp/ftp_network_transaction.cc View 1 2 3 2 chunks +7 lines, -7 lines 0 comments Download
M net/http/http_network_transaction.cc View 1 2 3 1 chunk +20 lines, -1 line 0 comments Download
M net/net.gyp View 1 1 chunk +0 lines, -1 line 0 comments Download
M net/proxy/proxy_resolver_v8.cc View 1 2 chunks +6 lines, -7 lines 0 comments Download

Messages

Total messages: 4 (0 generated)
eroman
jar: please review. willchan: just FYI, since i made slight changes to client socket pool ...
11 years, 6 months ago (2009-06-14 09:23:47 UTC) #1
jar (doing other things)
Generally the change looks quite good. I had a few questions and comments below that ...
11 years, 6 months ago (2009-06-14 15:30:05 UTC) #2
eroman
http://codereview.chromium.org/125107/diff/1043/1062 File chrome/browser/net/dns_global.cc (right): http://codereview.chromium.org/125107/diff/1043/1062#newcode146 Line 146: virtual void OnStartResolution(int requet_id, On 2009/06/14 15:30:06, jar ...
11 years, 6 months ago (2009-06-14 23:22:39 UTC) #3
jar (doing other things)
11 years, 6 months ago (2009-06-15 04:25:45 UTC) #4
LGTM++++++

I'm really psyched to see this land.  This bug is definitely impacting
statistics we're gathering, and negatively impacting the user.

p.s., See side comment below.

http://codereview.chromium.org/125107/diff/1043/1051
File net/base/host_resolver.cc (right):

http://codereview.chromium.org/125107/diff/1043/1051#newcode470
Line 470: // http://crbug.com/9598
On 2009/06/14 23:22:39, eroman wrote:
> On 2009/06/14 15:30:06, jar wrote:
> > You may want to update that bug.  IMO, the de-duping of active requests
should
> > greatly reduce the maximum count, and may make this bug a non-issue.
> 
> I still want that bug done.
> 
> In addition, now that we know which requests are issued by the DNS prefetcher,
> we can do some fancier global scheduling. For example, if we already have a
> number of non-speculative jobs in progress, we can outright drop the DNS
> prefetcher's request. Or we can queue it with low priority. (The throttling we
> currently do in the prefetcher doesn't take into account the current load for
> non-speculative requests.)

It turns out that the total number of "speculative" requests is very bounded
(currently 8 max by default).  The only reason for the number of outstanding
resolution requests to grow large is because users are really navigating to all
these (now distinct) domains!?!  In that situation, removing a fixed constant
(the speculative ones?) would have little impact.

Also note that IF you decide to try to "discard" speculative resoltion, the
correct systematic thing to do is to delay them as long as you need to in a
queue, rather than "discard them."  A delay will correctly put back-pressure on
the pre-resolution system to discard its internal queue.  By delaying them, all
you end up doing is "taking a long time to resolve" and at the same time, you
throttle them implicitly.  If you really "dropped" the request, then there would
be a question of what you return to the pre-resolution system (found? not
found?), and you'd end up getting more requests that you'd end up having to give
equally non-answers to. Delaying is the way to go.... but as I said... I really
think the de-duping of contemporaneous requests effectively solved the bug.

The *only* way I can imagine the bug continuing to be present is IF there are
MANY tabs, and each tab is autoloading... an each autoload causes its own set of
navigational resolutions (to new domains.. which are not cached??).  I'm very
hard pressed to believe that is a real-world scenario (beyond some internet
wide, auto-crawling JS system).

Powered by Google App Engine
This is Rietveld 408576698