}
Mingyu LeiThis is concerning to me. Navigation is already performance sensitive and this adds a traversal of *all* session history entries for the current profile on every navigation that hits the network. Can we at least instrument with measurements how long does this take?
For example, I have currently 800+ tabs in my work profile to manage my state. Each tab has non-trivial session history. It is likely this change will add some milliseconds to each navigation I perform.
Nasko OskovThanks, yeah we are aware of the potential performance impact and that's why the feature flag was added. When it's turned off, IsMainFrameOriginAccessibleByHistoryNavigation will just return false (see the help method in content/browser/url_loader_factory_params_helper.cc.
The purpose of setting this flag is for metrics collecting, and we will only enable it to a very small amount of users (1% should be enough) in stable. After we have the metrics we want, the logic will be cleaned up.
Mingyu LeiI do not believe we should be experimenting on 1% stable with this code. Happy to discuss alternatives in higher bandwidth modes, but we should not be landing this CL.
I tried the local build with around 100 tabs, each with some entries, and the time taken for the tab traversal is around 0.1~0.2ms, yes I expect it to grow to more than 1ms when the number of tabs grow larger.
Also I found that this metric may not be as useful as we hope it to be, for example, when restoring a tab, it might be navigating to a resource whose main frame origin is not accessible (since it's closed before the restore). After some discussion with @rak...@chromium.org, I reimplement this and now we are differentiating the navigation by whether "it's loading a resource whose main frame origin is recently accessed". This actually sounds like another layer of LRU cache but it's for origin only.
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Mingyu LeiThis is concerning to me. Navigation is already performance sensitive and this adds a traversal of *all* session history entries for the current profile on every navigation that hits the network. Can we at least instrument with measurements how long does this take?
For example, I have currently 800+ tabs in my work profile to manage my state. Each tab has non-trivial session history. It is likely this change will add some milliseconds to each navigation I perform.
Nasko OskovThanks, yeah we are aware of the potential performance impact and that's why the feature flag was added. When it's turned off, IsMainFrameOriginAccessibleByHistoryNavigation will just return false (see the help method in content/browser/url_loader_factory_params_helper.cc.
The purpose of setting this flag is for metrics collecting, and we will only enable it to a very small amount of users (1% should be enough) in stable. After we have the metrics we want, the logic will be cleaned up.
Mingyu LeiI do not believe we should be experimenting on 1% stable with this code. Happy to discuss alternatives in higher bandwidth modes, but we should not be landing this CL.
I tried the local build with around 100 tabs, each with some entries, and the time taken for the tab traversal is around 0.1~0.2ms, yes I expect it to grow to more than 1ms when the number of tabs grow larger.
Also I found that this metric may not be as useful as we hope it to be, for example, when restoring a tab, it might be navigating to a resource whose main frame origin is not accessible (since it's closed before the restore). After some discussion with @rak...@chromium.org, I reimplement this and now we are differentiating the navigation by whether "it's loading a resource whose main frame origin is recently accessed". This actually sounds like another layer of LRU cache but it's for origin only.
Thank you for re-evaluating and coming up with a different solution. It looks like a better to have a LRU cache to store those. I have a comment on that solution, but I think this thread is at this point complete and I will resolve it.
GetRecentlyAccessedOriginSet().Put(std::move(origin));
If we continuously put origins in the set without pruning it periodically, wouldn't it grow unbounded over time? There is no recency defined for this set.
Commit-Queue | +1 |
GetRecentlyAccessedOriginSet().Put(std::move(origin));
If we continuously put origins in the set without pruning it periodically, wouldn't it grow unbounded over time? There is no recency defined for this set.
The size is a concern, so the set returned by `GetRecentlyAccessedOriginSet()` *is* an LRUCacheSet and I put the limit in feature flag param (`kRecentlyAccessedOriginCacheSize`, default to 64). The eviction behavior is also covered in the unit test.
// `IS_MAIN_FRAME_ORIGIN_RECENTLY_ACCESSED` load flag.
It would be good for the comment to mention that this only affects metrics.
Code-Review | +1 |
Code-Review | +1 |
LGTM
GetRecentlyAccessedOriginSet().Put(std::move(origin));
Mingyu LeiIf we continuously put origins in the set without pruning it periodically, wouldn't it grow unbounded over time? There is no recency defined for this set.
The size is a concern, so the set returned by `GetRecentlyAccessedOriginSet()` *is* an LRUCacheSet and I put the limit in feature flag param (`kRecentlyAccessedOriginCacheSize`, default to 64). The eviction behavior is also covered in the unit test.
Code-Review | +1 |
Code-Review | +1 |
Records the outcome of considering whether to reject a cache entry based on
in-memory hints. This is used to avoid accessing disk for entries that are
likely to be unusable. Recorded every time we try to open a cache entry, but
there is no active one.
This is the same as the description in "HttpCache.EntryRejectionStatus". Can we just make this a variant on the previous histogram, and update the summary in the variants accordingly to mention when it's recorded?
Commit-Queue | +1 |
for more background and discussion (googlers only)
Nasko OskovI do not have access to this document, even as a googler, so I cannot sign off on this CL without understanding why this change is necessary.
Mingyu LeiThanks for sharing the document. I am not convinced that walking all session history on each navigation synchronously is right approach here. Can this be accomplished in a different way that is not on the blocking path?
Done
It would be good for the comment to mention that this only affects metrics.
Done
Records the outcome of considering whether to reject a cache entry based on
in-memory hints. This is used to avoid accessing disk for entries that are
likely to be unusable. Recorded every time we try to open a cache entry, but
there is no active one.
This is the same as the description in "HttpCache.EntryRejectionStatus". Can we just make this a variant on the previous histogram, and update the summary in the variants accordingly to mention when it's recorded?
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Done
Code-Review | +1 |
This metric logs the outcome of considering whether to reject a cache entry
based on in-memory hints, which is used to avoid accessing disk for entries
that are likely to be unusable.
The general metric (with empty variant name) is recorded every time when we
try to open a cache entry but no active entry is found. A variant is
recorded specifically when the `UpdateIsMainFrameOriginRecentlyAccessed`
flag is set, indicating the request contains recent-access information for
the resource's main frame origin.
</summary>
<token key="Type">
<variant name="" summary="recorded for every request"/>
<variant name=".MainFrameOriginNotRecentlyAccessed"
summary="requests to resources whose main frame's origin is not
recently accessed"/>
<variant name=".MainFrameOriginRecentlyAccessed"
summary="requests to resources whose main frame's origin is recently
accessed"/>
Sorry if it was unclear, we can actually use the variants' summary in the histogram description, otherwise we won't see the differences on the dashboard.
```suggestion
Records the outcome of considering whether to reject a cache entry based on
in-memory hints. This is used to avoid accessing disk for entries that are
likely to be unusable. Recorded every time we try to open a cache entry, but
there is no active one{Type}
</summary>
<token key="Type">
<variant name="" summary="."/>
<variant name=".MainFrameOriginNotRecentlyAccessed"
summary=", only if `UpdateIsMainFrameOriginRecentlyAccessed` is
enabled and the request is for a resource whose main frame's origin is not
recently accessed."/>
<variant name=".MainFrameOriginRecentlyAccessed"
summary=", only if `UpdateIsMainFrameOriginRecentlyAccessed` is
enabled and the request is for a resource whose main frame's origin is recently
accessed."/>
```
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Commit-Queue | +1 |
This metric logs the outcome of considering whether to reject a cache entry
based on in-memory hints, which is used to avoid accessing disk for entries
that are likely to be unusable.
The general metric (with empty variant name) is recorded every time when we
try to open a cache entry but no active entry is found. A variant is
recorded specifically when the `UpdateIsMainFrameOriginRecentlyAccessed`
flag is set, indicating the request contains recent-access information for
the resource's main frame origin.
</summary>
<token key="Type">
<variant name="" summary="recorded for every request"/>
<variant name=".MainFrameOriginNotRecentlyAccessed"
summary="requests to resources whose main frame's origin is not
recently accessed"/>
<variant name=".MainFrameOriginRecentlyAccessed"
summary="requests to resources whose main frame's origin is recently
accessed"/>
Sorry if it was unclear, we can actually use the variants' summary in the histogram description, otherwise we won't see the differences on the dashboard.
```suggestion
Records the outcome of considering whether to reject a cache entry based on
in-memory hints. This is used to avoid accessing disk for entries that are
likely to be unusable. Recorded every time we try to open a cache entry, but
there is no active one{Type}
</summary>
<token key="Type">
<variant name="" summary="."/>
<variant name=".MainFrameOriginNotRecentlyAccessed"
summary=", only if `UpdateIsMainFrameOriginRecentlyAccessed` is
enabled and the request is for a resource whose main frame's origin is not
recently accessed."/>
<variant name=".MainFrameOriginRecentlyAccessed"
summary=", only if `UpdateIsMainFrameOriginRecentlyAccessed` is
enabled and the request is for a resource whose main frame's origin is recently
accessed."/>
```
Oh I thought we can only replace with the variant name in the template. Updated.
Thanks!
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
25 is the latest approved patch-set.
The change was submitted with unreviewed changes in the following files:
```
The name of the file: tools/metrics/histograms/metadata/net/histograms.xml
Insertions: 11, Deletions: 14.
The diff is too large to show. Please review the diff.
```
Add if origin is recently accessed in cache rejection status metrics
This CL marks navigation requests for resources whose main frame origin
has been seen before. Instead of checking the entire navigation history,
this CL introduces a new mechanism to track recently accessed main frame
origins.
A new feature flag, kUpdateIsMainFrameOriginRecentlyAccessed, is
introduced to control this functionality, and it is disabled by default.
When enabled, a new load flag, IS_MAIN_FRAME_ORIGIN_RECENTLY_ACCESSED,
and a new URLLoaderFactoryParams, is_main_frame_origin_recently_accessed
are used to plumb the information from //content/browser and
//services/network to //net/http.
When the feature is enabled, URLLoaderFactoryParamsHelper will maintain
an LRU cache of recently accessed main frame origins. On each main frame
navigation, the origin will be added to the cache. For each navigation
request, the browser will check if the main frame origin is in the cache
and set the new load flag accordingly.
The UMA metric HttpCache.EntryRejectionStatus is updated to be recorded
with suffixes MainFrameOriginRecentlyAccessed and
MainFrameOriginNotRecentlyAccessed to analyze the behavior differences
between requests based on whether their main frame origin has been
recently accessed.
See
https://docs.google.com/document/d/1rfWTtUjo5gfA8jFFw1SQzANK5hXxQf6QC4cFiGDyjns
for more background and discussion (googlers only)
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |