Intent to Experiment: ServiceWorkerBypassFetchHandlerForMainResources

550 views
Skip to first unread message

Shunya Shishido

unread,
Feb 9, 2023, 11:23:19 AM2/9/23
to blink-dev

Contact emails

sisid...@chromium.org, kenji...@chromium.org


Explainer

https://github.com/sisidovski/service-worker-bypass-fetch-handler-for-main-resource


Specification

We’ll be working on the spec if the experiment confirms that this approach is viable and delivers significant performance upsides.


Summary

ServiceWorkerBypassFetchHandlerForMainResource (ServiceWorker fetch fast-path), is a change to the service worker implementation designed to let the browser bypass fetch handlers when appropriate.


With this feature, the request for the main resource will immediately happen without waiting for the ServiceWorker bootstrap and will also bypass the fetch handlers. The ServiceWorker is started at the same time as the request happens, but won’t intercept the request/response in the fetch handler. As a result, the browser can mitigate the bootstrap cost and the fetch handler execution.


For the sake of running a statistically meaningful experiment, we identified a few websites that would benefit from this optimized behavior and will automatically apply this new behavior to said websites. To avoid breakage, the optimization will be restricted to an appropriate version of these websites’ service workers (i.e. using a hash of the service worker scripts). Interested parties can also join the experiment by applying to the associated Origin Trial.



Blink component

Blink>ServiceWorker


Search tags

serviceworker


TAG review & status

Not yet


Risks



Interoperability and Compatibility



Gecko: No signal


WebKit: No signal


Web developers: No signals


Other signals:


WebView application risks

Does this intent deprecate or change behavior of existing APIs, such that it has potentially high risk for Android WebView-based applications?


If the ServiceWorker support is explicitly enabled for the Android WebView, they are affected by the change in the same way as the browser, but we believe the risk to be low. 



Goals for experimentation

The purpose of the experiment and the associated Origin Trial is to gather data on whether this has significant performance upsides or not. If this experiment shows good results, we’ll look into a proper intent to ship with spec changes, and potentially an API if we can’t always automate this optimized behavior. On that note, we don’t yet have a concrete idea for the proper API surface to enable this feature. We welcome any feedback, API proposals, and suggestions for additional bypassable scenarios (beyond the main resource for instance).



Reason this experiment is being extended

N/A


Ongoing technical constraints

None.


Debuggability



Will this feature be supported on all six Blink platforms (Windows, Mac, Linux, Chrome OS, Android, and Android WebView)?

Yes


Is this feature fully tested by web-platform-tests?

No, since in this iteration we don’t have a web exposed API, and the valid OriginTrial token itself is currently used to trigger the feature.

We plan to fully test the API via web-platform-tests once they are proposed.


Flag name

service-worker-bypass-fetch-handler-for-main-resource


Requires code in //chrome?

False


Tracking bug

https://bugs.chromium.org/p/chromium/issues/detail?id=1371756


Launch bug

https://launch.corp.google.com/launch/4232505


Estimated milestones

OriginTrial desktop last

115

OriginTrial desktop first

110

DevTrial on desktop

110


OriginTrial Android last

115

OriginTrial Android first

110

DevTrial on Android

110


OriginTrial webView last

115

OriginTrial webView first

110




Link to entry on the Chrome Platform Status

https://chromestatus.com/feature/5153002833313792


This intent message was generated by Chrome Platform Status.


Jeffrey Yasskin

unread,
Feb 9, 2023, 2:20:49 PM2/9/23
to Shunya Shishido, blink-dev
On Thu, Feb 9, 2023 at 8:23 AM Shunya Shishido <sisid...@chromium.org> wrote:
Have you started moving this into an incubation venue like the WICG? As of recently, https://www.chromium.org/blink/launching-features/#widen-review asks that you get it moved before starting an origin trial.

Thanks,
Jeffrey

--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAGMyg-aYxAEsNegu_6KQTFpC3J-tCGg8g49FLvZ81dC_c2NoZg%40mail.gmail.com.

Yoav Weiss

unread,
Feb 15, 2023, 9:41:54 AM2/15/23
to Jeffrey Yasskin, Shunya Shishido, blink-dev
Here's one signal I saw passing by. 
Do you have partners lined up for this? I can imagine their involvement can also be considered a signal.

Chris Harrelson

unread,
Feb 15, 2023, 12:03:18 PM2/15/23
to Yoav Weiss, Jeffrey Yasskin, Shunya Shishido, blink-dev
LGTM

I agree with the change Jeffrey referred to in general, but in this case it's a small change to an existing consensus spec, and the proposal is summarized there also.

Regarding the process change, the API owners will start a thread on blink-api-owners-discuss@ to make sure no one has concerns about the new incubation requirement for origin trials of upcoming features.

Shunya Shishido

unread,
Feb 15, 2023, 10:41:28 PM2/15/23
to Chris Harrelson, Yoav Weiss, Jeffrey Yasskin, blink-dev
Thank you Chris, yes we filed an issue on the ServiceWorker Github repo and asked for feedback there.

We have several partners who are interested in this experiment.
Also, though this experiment only targets main resources for now, here is another comment that shows an interest to have a way to declare carve-outs from ServiceWorker.

Chris Harrelson

unread,
Feb 17, 2023, 6:00:51 PM2/17/23
to Shunya Shishido, Yoav Weiss, Jeffrey Yasskin, blink-dev
On Wed, Feb 15, 2023 at 7:41 PM Shunya Shishido <sisid...@chromium.org> wrote:
Thank you Chris, yes we filed an issue on the ServiceWorker Github repo and asked for feedback there.

On Thu, Feb 16, 2023 at 2:03 AM Chris Harrelson <chri...@chromium.org> wrote:
LGTM

I agree with the change Jeffrey referred to in general, but in this case it's a small change to an existing consensus spec, and the proposal is summarized there also.

Regarding the process change, the API owners will start a thread on blink-api-owners-discuss@ to make sure no one has concerns about the new incubation requirement for origin trials of upcoming features.

Mike reminded me that in fact it was discussed here. Though I think the corresponding PSA missed this nuance, sorry about that.

Yoav Weiss

unread,
Feb 20, 2023, 2:06:16 AM2/20/23
to Chris Harrelson, Shunya Shishido, Jeffrey Yasskin, blink-dev
On Sat, Feb 18, 2023 at 12:00 AM Chris Harrelson <chri...@chromium.org> wrote:


On Wed, Feb 15, 2023 at 7:41 PM Shunya Shishido <sisid...@chromium.org> wrote:
Thank you Chris, yes we filed an issue on the ServiceWorker Github repo and asked for feedback there.

On Thu, Feb 16, 2023 at 2:03 AM Chris Harrelson <chri...@chromium.org> wrote:
LGTM

I agree with the change Jeffrey referred to in general, but in this case it's a small change to an existing consensus spec, and the proposal is summarized there also.

Regarding the process change, the API owners will start a thread on blink-api-owners-discuss@ to make sure no one has concerns about the new incubation requirement for origin trials of upcoming features.

Mike reminded me that in fact it was discussed here. Though I think the corresponding PSA missed this nuance, sorry about that.

I think both the discussion and the guidance were saying something slightly different than what Jeffrey said above.
I believe we discussed the spec being in an incubation venue for OT extensions beyond the first 6 milestones. Not necessarily for experiment requests that are just starting out.

Mike Taylor

unread,
Feb 21, 2023, 8:35:48 PM2/21/23
to Yoav Weiss, Chris Harrelson, Shunya Shishido, Jeffrey Yasskin, blink-dev

On 2/20/23 2:05 AM, Yoav Weiss wrote:



On Sat, Feb 18, 2023 at 12:00 AM Chris Harrelson <chri...@chromium.org> wrote:


On Wed, Feb 15, 2023 at 7:41 PM Shunya Shishido <sisid...@chromium.org> wrote:
Thank you Chris, yes we filed an issue on the ServiceWorker Github repo and asked for feedback there.

On Thu, Feb 16, 2023 at 2:03 AM Chris Harrelson <chri...@chromium.org> wrote:
LGTM

I agree with the change Jeffrey referred to in general, but in this case it's a small change to an existing consensus spec, and the proposal is summarized there also.

Regarding the process change, the API owners will start a thread on blink-api-owners-discuss@ to make sure no one has concerns about the new incubation requirement for origin trials of upcoming features.

Mike reminded me that in fact it was discussed here. Though I think the corresponding PSA missed this nuance, sorry about that.

I think both the discussion and the guidance were saying something slightly different than what Jeffrey said above.
I believe we discussed the spec being in an incubation venue for OT extensions beyond the first 6 milestones. Not necessarily for experiment requests that are just starting out.

That matches my understanding as well.

Reply all
Reply to author
Forward
0 new messages