Editorial: use a per-cache dedicated parallel queue for Cache API methods - #1843
Draft
monica-ch wants to merge 1 commit into
Draft
Editorial: use a per-cache dedicated parallel queue for Cache API methods#1843monica-ch wants to merge 1 commit into
monica-ch wants to merge 1 commit into
Conversation
…hods Give each request response list (i.e. each Cache object) a dedicated parallel queue and route Cache.matchAll, Cache.addAll (batch commit step), Cache.put, Cache.delete, and Cache.keys through it, so reads and writes on the same Cache object are serialized. Cache.match and Cache.add are pure orchestrators that delegate to matchAll and addAll respectively, and do not touch the request response list themselves, so they are covered transitively without needing algorithm changes. Cache.addAll's initial fetch block is left as bare parallel since it only performs fetch and does not access the cache. Closes: w3c#1841
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1841. Follow-up to #1755, sibling to #1838.
Give each [=request response list=] (the internal representation of a {{Cache}} object) a dedicated parallel queue and route the {{Cache}} methods that read or mutate it through the queue, so reads and writes on the same {{Cache}} object are serialized.
Changes
<dfn>request response list parallel queue</dfn>(a [=parallel queue=]) attached to each [=request response list=], following the same pattern that Editorial: serialize CacheStorage access on a dedicated parallel queue #1838 introduced for the [=name to cache map=].Run … in parallelblock:in parallelsince it does not touch the [=request response list=].Queue a taskwrappers around promise resolution / rejection (from Editorial: queue a task in Cache API #1837) are preserved inside the enqueued steps.Total change: +7 / −5 in
index.bs, one commit.Out of scope (deliberately)
matchAll; enqueueing it too would cause a deadlock (it waits on a promise that can only be settled by another enqueued step). Covered transitively.addAll. Same reason.Rationale
Yoshi flagged this concern during #1755 review:
#1837 landed the queue-a-task-for-resolve fixes for these methods. This PR delivers the sibling per-cache parallel-queue work that was explicitly deferred in the split plan.
Coordination
The changes here do not overlap textually with the queue-a-task changes in #1837 — that PR only touches the promise resolve/reject lines, this PR only touches the outer
Run in parallellines. Either can merge first.Related
name to cache mapparallel queue), same dfn patternPreview | Diff