Bug 226083

Summary: Don't hang onto expired resources without validation headers in memory cache
Product: WebKit Reporter: Antti Koivisto <koivisto>
Component: Page LoadingAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: beidson, cdumez, ews-watchlist, ggaren, japhet, nham
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
patch
none
patch
ews-feeder: commit-queue-
patch
ews-feeder: commit-queue-
patch
none
patch
none
patch
ews-feeder: commit-queue-
patch
none
patch
none
patch none

Description Antti Koivisto 2021-05-21 07:23:54 PDT
They use memory while only being useful for history navigation. Disk cache can handle that.
Comment 1 Antti Koivisto 2021-05-21 07:44:42 PDT
rdar://78035612
Comment 2 Antti Koivisto 2021-05-21 08:14:44 PDT
Created attachment 429292 [details]
patch
Comment 3 Antti Koivisto 2021-05-21 08:18:35 PDT
Created attachment 429293 [details]
patch
Comment 4 Antti Koivisto 2021-05-24 12:13:10 PDT
Created attachment 429552 [details]
patch
Comment 5 Antti Koivisto 2021-05-25 05:19:02 PDT
Created attachment 429647 [details]
patch
Comment 6 Antti Koivisto 2021-05-25 06:20:06 PDT
Created attachment 429651 [details]
patch
Comment 7 Antti Koivisto 2021-05-25 07:36:26 PDT
Created attachment 429653 [details]
patch
Comment 8 Antti Koivisto 2021-05-26 01:51:26 PDT
Created attachment 429737 [details]
patch
Comment 9 Antti Koivisto 2021-05-26 01:53:19 PDT
Created attachment 429738 [details]
patch
Comment 10 Antti Koivisto 2021-05-26 07:59:18 PDT
Created attachment 429755 [details]
patch
Comment 11 Chris Dumez 2021-05-26 11:09:49 PDT
Comment on attachment 429755 [details]
patch

r=me
Comment 12 Geoffrey Garen 2021-05-26 11:11:25 PDT
Comment on attachment 429755 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=429755&action=review

> Source/WebCore/ChangeLog:29
> +        Remove expired resources without validation headers from the cache if the resource is otherwise deletable.

I guess this is the more conservative approach, so maybe it's best. But I wonder if there's any value to expired resources _with_ validation headers in the memory cache? In that case, we're going to do a network round trip to validate anyway, so maybe an IPC round trip to the network process is also fine. Long ago, Dave Hyatt told me that the real win of the memory cache was when it could respond synchronously in the current RunLoop iteration.
Comment 13 Antti Koivisto 2021-05-26 11:51:58 PDT
Reusing a resource from memory cache may also save decoding for images, parsing for  stylesheets, text decoding etc. (though decoded versions are thrown out pretty fast anyway for unreferenced resources).

But yeah, it might be time to throw out the entire revalidation logic in memory cache. Would certainly simplify things. Part of its job used to be to cover things networking layer wasn't handling well.
Comment 14 Geoffrey Garen 2021-05-26 12:14:06 PDT
> But yeah, it might be time to throw out the entire revalidation logic in
> memory cache. Would certainly simplify things. Part of its job used to be to
> cover things networking layer wasn't handling well.

I guess that's a topic for another bug. But might be worth trying out at some point.
Comment 15 EWS 2021-05-26 12:19:36 PDT
Committed r278119 (238169@main): <https://commits.webkit.org/238169@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 429755 [details].