Comments on: ResourceTiming in Practice https://nicj.net/resourcetiming-in-practice/ Home to Nic Jansma, a software developer at Akamai building high-performance websites, apps and open-source tools. Sat, 20 Nov 2021 13:26:31 +0000 hourly 1 https://wordpress.org/?v=5.5.3 By: Assessing loading performance in the field with Navigation Timing and Resource Timing https://nicj.net/resourcetiming-in-practice/comment-page-1/#comment-1248176 Sat, 20 Nov 2021 13:26:31 +0000 http://nicj.net/?p=1728#comment-1248176 […] ResourceTiming in Practice. […]

]]>
By: Nic https://nicj.net/resourcetiming-in-practice/comment-page-1/#comment-1246698 Sat, 18 Apr 2020 18:25:37 +0000 http://nicj.net/?p=1728#comment-1246698 In reply to Bogdan Ripa.

Nothing yet, unfortunately. There is discussion around a “FetchObserver” or another mechanism to listen for the “start” of resources.

There’s some discussion here: https://github.com/w3c/resource-timing/issues/137 and please include your feedback as it can help push issues forward!

]]>
By: Bogdan Ripa https://nicj.net/resourcetiming-in-practice/comment-page-1/#comment-1246687 Thu, 16 Apr 2020 10:23:09 +0000 http://nicj.net/?p=1728#comment-1246687 Hi there, nice article!

Quick question: Is there a way to get the list of resources that are “in progress”?

I’ve notices that the performance.getEntries() array populates when the transfer is done, but does not give any hints about the resources that are in-progress.

]]>
By: mark https://nicj.net/resourcetiming-in-practice/comment-page-1/#comment-1246579 Mon, 02 Mar 2020 10:20:22 +0000 http://nicj.net/?p=1728#comment-1246579 safari doesn’t support transferSize.

]]>
By: Nic https://nicj.net/resourcetiming-in-practice/comment-page-1/#comment-1244916 Sat, 14 Jul 2018 00:53:54 +0000 http://nicj.net/?p=1728#comment-1244916 @prathamesh rasam: Thanks! Updated the post.

@Raffi: Yup! See the Timing-Allow-Origin section: https://nicj.net/resourcetiming-in-practice/#timing-allow-origin

]]>
By: Raffi https://nicj.net/resourcetiming-in-practice/comment-page-1/#comment-1244901 Tue, 12 Jun 2018 23:58:47 +0000 http://nicj.net/?p=1728#comment-1244901 One tip you might want to add — it appears the content size values are reported as 0 for cross-origin resources. This makes the cache hit detection a bit trickier and it explains one of the (slightly maddening) differences between exploring the resource performance data in a browser’s dev tool versus examining the data returned from the PerformanceResourceTiming API.

There is a header — Timing-Allow-Origin — that can be set to have the values reported correctly (have not tested myself but seems likely.)

]]>
By: prathamesh rasam https://nicj.net/resourcetiming-in-practice/comment-page-1/#comment-1244899 Wed, 06 Jun 2018 12:08:37 +0000 http://nicj.net/?p=1728#comment-1244899 I was browsing the site while checking resource API, I got initiator type ‘use’
PerformanceResourceTiming
connectEnd: 22462.399999960326
connectStart: 22462.399999960326
decodedBodySize: 6699
domainLookupEnd: 22462.399999960326
domainLookupStart: 22462.399999960326
duration: 52.700000000186265
encodedBodySize: 2106
entryType: “resource”
fetchStart: 22462.399999960326
initiatorType: “use”
name: “https://in.bookmyshow.com/chunks/icons/showtimes-icons-1310d4c2.svg#icon-location”
nextHopProtocol: “http/1.1”
redirectEnd: 0
redirectStart: 0
requestStart: 22464.799999957904
responseEnd: 22515.099999960512
responseStart: 22501.99999997858
secureConnectionStart: 0
serverTiming: []
startTime: 22462.399999960326
transferSize: 2686
workerStart: 0
__proto__: PerformanceResourceTiming

when we get ‘use’ initiator type

URL used on mobile site (PWA) – https://in.bookmyshow.com/buytickets/parmanu-the-story-of-pokhran-mumbai/movie-mumbai-ET00058781-MT/20180606

]]>
By: Nic https://nicj.net/resourcetiming-in-practice/comment-page-1/#comment-1244860 Wed, 02 May 2018 12:29:45 +0000 http://nicj.net/?p=1728#comment-1244860 In reply to prathamesh rasam.

There is an open Chrome bug on the blank initiatorType: https://bugs.chromium.org/p/chromium/issues/detail?id=649571

You could add a comment, or star it, to let them know it’s affecting you. In the meantime, you could UA sniff Chrome and if the initiatorType is blank, there’s a high liklihood that it is fetch — I’m not aware of any other APIs that have a blank initiatorType today.

]]>
By: prathamesh rasam https://nicj.net/resourcetiming-in-practice/comment-page-1/#comment-1244859 Wed, 02 May 2018 06:21:08 +0000 http://nicj.net/?p=1728#comment-1244859 Hi I want to identify all fetch calls from resource timing API list, safari provides initiatorType as “fetch”, I am able to identify at safari, but chrome provides empty string as “” & firefox provides initiator type as other, so its difficult to identify at this 2 browsers, any other way to identify fetch calls from resource Timing API or performance observer ?

]]>
By: Nic https://nicj.net/resourcetiming-in-practice/comment-page-1/#comment-1244850 Wed, 18 Apr 2018 02:55:41 +0000 http://nicj.net/?p=1728#comment-1244850 This article has been updated for 2018!

]]>
By: Nic https://nicj.net/resourcetiming-in-practice/comment-page-1/#comment-1243586 Sat, 10 Mar 2018 16:58:39 +0000 http://nicj.net/?p=1728#comment-1243586 In reply to Odi.

Hi Odi,

ResourceTiming data is completely separate from things like XMLHttpRequest because it was designed to holistically report on everything in the page, instead of having direct tie-ins to each component.

That being said, you may be interested in the discussions on adding a “fetch ID” or “request ID” that might help correlate specific XHRs (fetches) with ResourceTiming entries:

https://github.com/w3c/resource-timing/issues/8
https://github.com/w3c/resource-timing/issues/39

]]>
By: Odi https://nicj.net/resourcetiming-in-practice/comment-page-1/#comment-1243506 Fri, 09 Mar 2018 10:38:12 +0000 http://nicj.net/?p=1728#comment-1243506 ResourceTiming data is a separate API and not integrated with XMLHttpRequest. So when you do many XHRs in parallel to the same URL its impossible to correlate the performance data with the requests. I don’t understand why the performance API was not integrated with XHR directly. Like that it’s not very useful.

]]>
By: Nic https://nicj.net/resourcetiming-in-practice/comment-page-1/#comment-1230456 Thu, 27 Apr 2017 11:25:22 +0000 http://nicj.net/?p=1728#comment-1230456 @Kristof: Added!

]]>
By: Nic https://nicj.net/resourcetiming-in-practice/comment-page-1/#comment-1230454 Thu, 27 Apr 2017 11:21:05 +0000 http://nicj.net/?p=1728#comment-1230454

@Mike: Hi Nic, could you please tell me a little bit more about on what is “all redirected resources” ? I noticed that most of the time, duration = responseEnd – fetchStart for regular image/JS resources.

If you’re downloading http://a.com/foo.png and it 301 redirects to http://a.com/bar.png, the time it took to do the redirect will be between startTime and fetchStart.

@Mike: If I can guarantee that the script will not be redirected for sure then we are safe to rely on the “duration” value for cross domain resources right ?

I think so, yes.

]]>
By: Kristof https://nicj.net/resourcetiming-in-practice/comment-page-1/#comment-1228274 Thu, 05 Jan 2017 10:44:19 +0000 http://nicj.net/?p=1728#comment-1228274 Hi Nic,

Thanks for the great article!
For completeness, I would add Dynatrace UEM on top of New Relic and AppDynamics offerings, as it captures all W3C Resource timings for every action of every user.

And yes I work for Dynatrace. However I thought if you add 2 then you might just as well ad the third as well ;-).

Cheers,
Kristof

]]>
By: Mike https://nicj.net/resourcetiming-in-practice/comment-page-1/#comment-1227895 Wed, 14 Dec 2016 01:34:40 +0000 http://nicj.net/?p=1728#comment-1227895 @Mike

If I can guarantee that the script will not be redirected for sure then we are safe to rely on the “duration” value for cross domain resources right ?

]]>
By: Mike https://nicj.net/resourcetiming-in-practice/comment-page-1/#comment-1227894 Wed, 14 Dec 2016 01:20:42 +0000 http://nicj.net/?p=1728#comment-1227894 duration will include time to fetch all redirected resources (if any) as well as the final resource. To track the overall time it took to fetch just the final resource, you may want to use (responseEnd – fetchStart).

Hi Nic, could you please tell me a little bit more about on what is “all redirected resources” ? I noticed that most of the time, duration = responseEnd – fetchStart for regular image/JS resources.

Thanks in advance!

]]>
By: Abhishek Agarwal https://nicj.net/resourcetiming-in-practice/comment-page-1/#comment-1221940 Mon, 04 Jan 2016 22:14:25 +0000 http://nicj.net/?p=1728#comment-1221940 @ Nic

Thank you Nic for the reply. I will take a look at plugin you mentioned.

]]>
By: Nic https://nicj.net/resourcetiming-in-practice/comment-page-1/#comment-1221938 Sun, 03 Jan 2016 19:11:06 +0000 http://nicj.net/?p=1728#comment-1221938 @ Aaron Peters

Thanks for the research! I’ve updated with your comments. Bummed I didn’t bump into you at VelocityConf EU!

I’m still seeing duration=0 for FF 43 on Windows for DNS failures. Strangely, on Mac FF 43, I don’t see any ResourceTiming entries for DNS failures via Andy Davies’ test case: http://andydavies.github.io/rt-tests/dns-failure.html

]]>
By: Nic https://nicj.net/resourcetiming-in-practice/comment-page-1/#comment-1221937 Sun, 03 Jan 2016 18:57:05 +0000 http://nicj.net/?p=1728#comment-1221937 @ Abhishek Agarwal

ResourceTiming only notifies you of resource fetches after they are complete. In order to instrument all XHR activity, you may need to overwrite the XMLHttpRequest object. See auto_xhr.js in Boomerang for one way of doing this: https://github.com/lognormal/boomerang/blob/master/plugins/auto_xhr.js

]]>
By: Abhishek Agarwal https://nicj.net/resourcetiming-in-practice/comment-page-1/#comment-1221929 Tue, 29 Dec 2015 20:37:34 +0000 http://nicj.net/?p=1728#comment-1221929 Awesome article.

how can I use Resource Timing API to instrument XmlHttpRequests and log timing as soon as that happens? Just curious what event is fired before XHR resource starts and ends similar to Network tab of Chrome Dev tools? Please advise. Thanks a lot

]]>
By: Aaron Peters https://nicj.net/resourcetiming-in-practice/comment-page-1/#comment-1221801 Thu, 08 Oct 2015 17:23:34 +0000 http://nicj.net/?p=1728#comment-1221801 Hi Nic,

More people should write these kind of deep-dive articles. Well done!

Some feedback based on tests on FF 41.0.1 (latest) on Mac OS X Yosemite (10.10.4) :

DNS Failure: “domainLookupStart through responseStart and duration are 0. responseEnd is non-zero.”
I consistently see duration being non-zero, and seems to be the actual time it took, eg. 282.43245599999955.

TCP Failure: “domainLookupStart through responseStart and duration are 0. responseEnd is non-zero.”
This is still the case, which is cool, because now it can be distinguished from a DNS Failure.

404: “All timestamps are non-zero, though duration is 0.”
I see duration being non-zero and the value ‘looks about right’.

PS: coming to Velocityconf EU 2015 in Amsterdam? If so, let’s meet for coffee and RT API chatting.

]]>
By: Nic https://nicj.net/resourcetiming-in-practice/comment-page-1/#comment-1221711 Wed, 22 Jul 2015 13:58:23 +0000 http://nicj.net/?p=1728#comment-1221711 @ Nikhil

Great catch. Apologies for not actually testing the code I was showing!

It looks like Chrome supports onwebkitresourcetimingbufferfull and FireFox supports onresourcetimingbufferfull Functions on the performance object. This may change with the latest draft as it’s supposed to be an EventListener now (http://www.w3.org/TR/resource-timing/). IE doesn’t appear to support either, I’ve pinged them to see if we’re missing something.

I’ve updated the sample code above.

]]>
By: Nikhil https://nicj.net/resourcetiming-in-practice/comment-page-1/#comment-1221704 Thu, 16 Jul 2015 23:39:55 +0000 http://nicj.net/?p=1728#comment-1221704 Hi,

Are you sure that document.addEventListener(“onresourcetimingbufferfull”, function { // do something }); works?
The onresourcetimingbufferfull event is inside the window.performance object. Moreover, IE 11 does not even have this event to attach to. Any idea how to overcome this?

]]>
By: Šime Vidas https://nicj.net/resourcetiming-in-practice/comment-page-1/#comment-1221665 Fri, 05 Jun 2015 02:22:47 +0000 http://nicj.net/?p=1728#comment-1221665 .workerStart is available in Chrome Canary behind flag.

]]>
By: Vignesh https://nicj.net/resourcetiming-in-practice/comment-page-1/#comment-1221664 Thu, 04 Jun 2015 14:30:28 +0000 http://nicj.net/?p=1728#comment-1221664 Brilliant write up Nic 🙂

Any idea on why we need ALPN Protocol Id on the RT? what is the use case its solving?

]]>
By: Nic https://nicj.net/resourcetiming-in-practice/comment-page-1/#comment-1221663 Mon, 01 Jun 2015 23:51:29 +0000 http://nicj.net/?p=1728#comment-1221663 2015/06/01: Added the “ResourceTiming – Coming Soon” section

]]>