Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add workerStart attribute to measure (Service)Worker startup time #11

Closed
igrigorik opened this issue Feb 23, 2015 · 8 comments · Fixed by #18
Closed

Add workerStart attribute to measure (Service)Worker startup time #11

igrigorik opened this issue Feb 23, 2015 · 8 comments · Fixed by #18

Comments

@igrigorik
Copy link
Member

If the app is ServiceWorker-enabled then all fetches are routed to the SW, where they may be fulfilled from local cache, rewritten, forwarded to remote server, etc. However, the SW script may be terminated at any point and may need to be (re)started prior to servicing the request - e.g. navigation request spools up a worker, which is then killed, and a new worker is started up to service a subresource fetch.

The application needs to be able to distinguish and measure the worker startup time.


Attribute definition:

workerStart: The workerStart attribute must return a DOMHighResTimeStamp [HR-TIME] with the time immediately before the user agent starts the Worker required to service the request. If the worker process is already available, then this attribute must return the same value as fetchStart.

For processing section update (add new step before 3.5):

If the current browsing context has a registered Service Worker, immediately before a user agent starts the worker process or forwards the request to an existing worker process, record the current time as workerStart.

Does that look reasonable? Anything I'm forgetting? </handwaving>

P.S. Once we iron out the language here, we'll need to make a similar update to Navigation Timing..

/cc @jakearchibald @slightlyoff @KenjiBaheux

@slightlyoff
Copy link

Love it.

@toddreifsteck
Copy link
Member

This seems reasonable. Adding @aliams to thread.

@vigneshshanmugam
Copy link

This is awesome 👍

@yoavweiss
Copy link
Contributor

Sounds great!

What would that value be set to when SW is not installed? identical to fetchStart? Zero? Or should it simply not be there?

@furoshiki
Copy link

+1

@igrigorik
Copy link
Member Author

What would that value be set to when SW is not installed? identical to fetchStart? Zero? Or should it simply not be there?

To be consistent with how other attributes are initialized (e.g. secureConnectionStart), initializing to zero when SW is not present seems like the best way to go. This way you also have a clear indicator of whether SW is used or not.

@KenjiBaheux
Copy link

This will be quite useful, thanks for working it out.

@KenjiBaheux
Copy link

Filed https://code.google.com/p/chromium/issues/detail?id=465640 to track in blink

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants