Intent to Experiment: scheduler.postTask

200 views
Skip to first unread message

Scott Haseley

unread,
Jan 31, 2020, 8:06:04 PM1/31/20
to blink-dev

Contact emails

shas...@chromium.org, jap...@chromium.org


Spec

Explainer: https://github.com/WICG/main-thread-scheduling/blob/master/PrioritizedPostTask.md.


Summary

Userspace tasks often have varying degrees of importance (related to user experience), but the Platform lacks a unified API to schedule prioritized work. The postTask API allows developers to schedule tasks (javascript callbacks) with a native browser scheduler at 3 levels of priority: user-blocking, user-visible, and background. It also exposes a TaskController, which can be used to dynamically cancel tasks and change their priority.


Link to “Intent to Prototype” blink-dev discussion

https://groups.google.com/a/chromium.org/forum/#!msg/blink-dev/HvqbB7TGJKU/xda9kTXGBAAJ


Goals for experimentation

We’re looking for feedback on API shape, performance, and usefulness of the MVP.


API shape:

 - We want to validate that the new Signal/Controller-based API is ergonomic for developers (the shape has evolved quite a bit). Is it easy to use/integrate with existing schedulers or app code?

 - We also want feedback on the priorities: are the priorities intuitive/useful? Are there (general) use cases that aren’t captured by these priorities? (See explainer for more discussion around number of priorities).


Performance:

We’re relying on site-specific latency and responsiveness metrics for measuring performance. Specifically, we’re looking to find out if site-specific performance improves, regresses, or stays the same. The outcome can depend on a lot of factors, e.g. does the site already have a scheduler? how much of the page does the site own? how well does the implementation’s approach to integrating postTask tasks and tasks from other task sources work? Our hypothesis is that performance shouldn’t regress, but we want to validate this. And if it does regress performance, we want to understand why and possibly vary the implementation.


Usefulness of the MVP: We’re looking to answer a couple questions here:

1. Does the API simplify scheduling?

2. Is the postTask MVP useful enough on its own, or are there vital features missing? For example, are there enough guarantees/predictability around postTask priorities to be useful, or are priorities needed elsewhere (e.g. fetch, IDB)?


Experimental timeline

We’d like to experiment in M81-M83.


Any risks when the experiment finishes?

No.


Ongoing technical constraints

None.


Debuggability

Given the complex nature of scheduling, we think this feature will benefit greatly from DevTools integration, minimally:

1. The API should work with async call stacks (this was already landed).

2. Timeline integration -- when tasks are posted, priority of tasks that run, etc. We plan to implement this in the near term.


There are likely other integrations that developers would benefit from, and we’re planning to work with partners on determining what integration will make debugging easier. Some of this will be informed by their experience with the OT.


Will this feature be supported on all five Blink platforms supported by Origin Trials (Windows, Mac, Linux, Chrome OS, and Android)?

Yes.


Link to entry on the feature dashboard

https://www.chromestatus.com/feature/6031161734201344


Yoav Weiss

unread,
Feb 4, 2020, 9:12:36 AM2/4/20
to Scott Haseley, blink-dev
LGTM

This has been thoroughly discussed in the WebPerf WG and industry folks showed a lot of excitement towards better scheduling primitives.
Do you have partners lined up to start testing in the M81 timeframe?

--
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/CAKXGoJ189-_48cMn%3D4deTU8f3y%2B1Jhmk1Eh%2BHqGFVhEhMnTHcA%40mail.gmail.com.

Alexander Timin

unread,
Feb 4, 2020, 10:07:31 AM2/4/20
to Yoav Weiss, Scott Haseley, blink-dev
non-owner lgtm from the scheduling perspective.

Scott Haseley

unread,
Feb 4, 2020, 1:56:59 PM2/4/20
to Alexander Timin, Yoav Weiss, blink-dev
Do you have partners lined up to start testing in the M81 timeframe?

Yes, we’re working with React folks on integrating it into their scheduler, and they plan to run the OT on Facebook. We’re working on outreach to more interested partners. Depending on response, we might need to push the timeline back by a release, but I'm hoping we can start in M81.

Yoav Weiss

unread,
Feb 4, 2020, 11:05:31 PM2/4/20
to Scott Haseley, Alexander Timin, blink-dev
On Tue, Feb 4, 2020 at 10:56 AM Scott Haseley <shas...@google.com> wrote:
Do you have partners lined up to start testing in the M81 timeframe?

Yes, we’re working with React folks on integrating it into their scheduler, and they plan to run the OT on Facebook. We’re working on outreach to more interested partners. Depending on response, we might need to push the timeline back by a release, but I'm hoping we can start in M81.

SGTM! Generally, it's good to bare in mind that it's easier to push back a release than to extend the OT.

Scott Haseley

unread,
Mar 16, 2020, 4:42:11 PM3/16/20
to Yoav Weiss, Alexander Timin, blink-dev
FYI: we’re updating the timeline to start in M82, running through M84.

We've been working with Facebook/React on integrating this into the React scheduler, and they're on board with starting in the M82 timeframe. Google Search is also  interested in running an experiment in this timeframe. There has been interest from several other frameworks/sites as well, so we'd like to move forward with enabling this for experimentation starting in M82.

More information about the running the origin trial can be found here, including feature status.
Reply all
Reply to author
Forward
0 new messages