[webkit-changes] [WebKit/WebKit] 470bd5: Use mapped files in CacheStorageDiskStore
bnham
noreply at github.com
Thu Jul 20 21:48:42 PDT 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 470bd54de983712380aa5478840b0fe53e566f76
https://github.com/WebKit/WebKit/commit/470bd54de983712380aa5478840b0fe53e566f76
Author: Ben Nham <nham at apple.com>
Date: 2023-07-20 (Thu, 20 Jul 2023)
Changed paths:
M Source/WTF/wtf/FileSystem.h
M Source/WebKit/NetworkProcess/storage/CacheStorageDiskStore.cpp
M Source/WebKit/NetworkProcess/storage/CacheStorageDiskStore.h
Log Message:
-----------
Use mapped files in CacheStorageDiskStore
https://bugs.webkit.org/show_bug.cgi?id=259371
rdar://problem/112623177
Reviewed by Chris Dumez.
Currently CacheStorageDiskStore reads entire files into dirty memory. When many DOMCache operations
in flight, this can lead to a temporary explosion in NetworkProcess memory usage (in the gigabytes
of footprint).
To fix this issue, we use read-only mapped files in CacheStorageDiskStore instead, as we do with the
regular network cache. This trades dirty footprint for higher vnode usage. But that should be okay
as the number of vnodes consumed by DOMCache should be much lower than the number of vnodes used by
NetworkCache, which is already mmap'ing everything.
I also removed some unnecessary cross-thread copies, as the data we're passing across threads isn't
affined to a particular thread (e.g. no non-atomic ref counts).
* Source/WTF/wtf/FileSystem.h:
(WTF::FileSystemImpl::MappedFileData::toSpan):
(WTF::FileSystemImpl::MappedFileData::create):
* Source/WebKit/NetworkProcess/storage/CacheStorageDiskStore.cpp:
(WebKit::readRecordInfoFromFileData):
(WebKit::CacheStorageDiskStore::readRecordFromFileData):
(WebKit::CacheStorageDiskStore::readAllRecordInfosInternal):
(WebKit::CacheStorageDiskStore::readAllRecordInfos):
(WebKit::CacheStorageDiskStore::readRecordsInternal):
(WebKit::CacheStorageDiskStore::readRecords):
* Source/WebKit/NetworkProcess/storage/CacheStorageDiskStore.h:
Canonical link: https://commits.webkit.org/266199@main
More information about the webkit-changes
mailing list