Bug 212757 - REGRESSION (r253616): Slower page load speed on sites with many media queries (including a number of sites on Akamai)
Summary: REGRESSION (r253616): Slower page load speed on sites with many media queries...
Status: CLOSED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: Safari 13
Hardware: iPhone / iPad iOS 13
: P2 Major
Assignee: Nobody
URL:
Keywords: InRadar
Depends on: 213243
Blocks: 205264
  Show dependency treegraph
 
Reported: 2020-06-04 09:42 PDT by Gaurav Saxena
Modified: 2020-08-04 15:35 PDT (History)
14 users (show)

See Also:


Attachments
graph for iOS13.3 and iOS 13.4 - user traffic vs page load time (106.59 KB, image/png)
2020-06-04 12:44 PDT, Gaurav Saxena
no flags Details
iOS and Mac OSX Browser Performance Comparison (229.36 KB, image/jpeg)
2020-06-05 06:19 PDT, Paul Calvano
no flags Details
iOS and Mac OSX Browser Performance Comparison (269.42 KB, image/jpeg)
2020-06-05 06:33 PDT, Paul Calvano
no flags Details
Page load times across different iOS versions and trend for MAC Safari browser (80.91 KB, image/png)
2020-06-05 07:29 PDT, Gaurav Saxena
no flags Details
p75 iPhone - loadeventstart - customer A - US Retailer - SpeedCurve LUX (88.49 KB, image/png)
2020-06-12 11:51 PDT, Cliff Crocker
no flags Details
p75 iPhone - loadeventstart - customer B - US Retailer - SpeedCurve LUX (88.49 KB, image/png)
2020-06-12 11:52 PDT, Cliff Crocker
no flags Details
p75 iPhone - loadeventstart - customer C - US Retailer - SpeedCurve LUX (90.36 KB, image/png)
2020-06-12 11:55 PDT, Cliff Crocker
no flags Details
iOS13.6_iOS14.0 response time improved. (33.10 KB, image/png)
2020-08-04 15:34 PDT, Gaurav Saxena
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gaurav Saxena 2020-06-04 09:42:39 PDT
Hi Team,

We do real time user performance monitoring and found out that from 10th May onwards response time degraded by 1.2 to 1.7 secs on Iphone Mobile Safari browser. 
From 10th May majority of the user traffic switched to iOS 13.4 or up. Seems Mobile Safari 13.1 was shipped with iOS 13.4. 

Seems more time is taken between DOMContentLoadedStart and DOMContentLoadedEnd event. 

We see similar issues/trend across other webistes also. 

Can you please investigate and provide more details on this issue?
Comment 1 Paul Calvano 2020-06-04 09:58:41 PDT
Hello. I'm seeing this performance degradation across 37% of sites measured w/ our real user measurement service. This includes many large e-commerce and media websites. 

I've shared some details in this twitter thread - https://twitter.com/paulcalvano/status/1268114487426666496

The slowdown became apparent once 13.1 was the majority of Mobile Safari traffic. However I can see that 13.1 was consistently slower for those sites.  The slowdown appears to be occurring between the DOM Content Loaded End time and the DOM Complete time. 

Please let me know if there are any additional details I can provide to help triage this.

- Paul
Comment 2 Gaurav Saxena 2020-06-04 12:44:01 PDT
Created attachment 401062 [details]
graph for iOS13.3 and iOS 13.4 - user traffic vs page load time

Adding graph showing user traffic vs pageload time for iOS 13.3 and iOS 13.4.
Comment 3 Maciej Stachowiak 2020-06-04 14:52:16 PDT
Can you share some websites that are affected? Is it possible to reproduce the slowdown testing devices with older and newer OS side by side?
Comment 4 Radar WebKit Bug Importer 2020-06-04 14:52:34 PDT
<rdar://problem/63997043>
Comment 5 Geoffrey Garen 2020-06-04 15:02:22 PDT
Also, could you share how DOMContentLoadedStart and DOMContentLoadedEnd are recorded (or share a code snippet)?
Comment 6 Maciej Stachowiak 2020-06-04 16:07:54 PDT
Also what domComplete means.
Comment 7 Maciej Stachowiak 2020-06-04 17:45:34 PDT
Answering my own question regarding domfomplete:

It's defined in Navigation Timing as being right before document.readyState is set to "complete":
https://w3c.github.io/navigation-timing/#dom-performancenavigationtiming-domcomplete

Which in turn happens right before firing the "load" event:
https://html.spec.whatwg.org/multipage/parsing.html#the-end:current-document-readiness-2

So basically this all suggests that, given the data here, there is a significant delay additional between the end of DOMContnetLoaded and the start of the load event.

https://twitter.com/paulcalvano/status/1268114491499261952
Comment 8 Paul Calvano 2020-06-04 18:23:07 PDT
Thanks for looking into this.   

As Maciej noted, all of these times are defined in the Navigation Timing specification.  https://www.w3.org/TR/navigation-timing/.  

We're using real user measurement data from Akamai's mPulse service to measure the performance real users are experiencing.

I've encouraged impacted sites to comment on this bug report. I'm also reaching out to a few and will share some examples once I have permission to do so.
Comment 9 Gaurav Saxena 2020-06-04 18:59:52 PDT
Thanks for looking in to this issue. 

Few website urls where we see the impact:
https://www.bell.ca/mobility
https://www.bell.ca/Mobility/Smartphones_and_mobile_internet_devices
https://support.bell.ca/
Comment 10 Maciej Stachowiak 2020-06-05 00:21:51 PDT
(In reply to Gaurav Saxena from comment #9)
> Thanks for looking in to this issue. 
> 
> Few website urls where we see the impact:
> https://www.bell.ca/mobility
> https://www.bell.ca/Mobility/Smartphones_and_mobile_internet_devices
> https://support.bell.ca/

Thanks for sharing some URLs. Are you able to reproduce this locally? Does visiting these pages with older and newer iOS show a visible difference in page load speed?
Comment 11 Maciej Stachowiak 2020-06-05 00:26:34 PDT
Additional question: is there anything like this observed for Mac Safari, or only iOS?
Comment 12 Paul Calvano 2020-06-05 06:19:10 PDT
Created attachment 401149 [details]
iOS and Mac OSX Browser Performance Comparison

This series of graphs compares the page load times on Mobile Safari (iOS), Chrome Mobile (Android), and Safari/Chrome/Firefox on Mac OSX for an e-commerce site. The performance degradation for Mobile Safari 13.1 appears to be impacted both in the browser as well as the WKWebView.  The performance in Chrome Mobile is shown as well so that you can see that the site performance remained consistent.

I do not see any degradation on Mac.
Comment 13 Paul Calvano 2020-06-05 06:21:01 PDT
@Maciej - I'm still working on getting you some URLs.   In the meantime, I've uploaded a graph from an e-commerce site showing comparisons across different browsers.   This appears to affect Mobile Safari and WKWebView on iOS, but not Safari on Mac OS X.
Comment 14 Paul Calvano 2020-06-05 06:33:35 PDT
Created attachment 401152 [details]
iOS and Mac OSX Browser Performance Comparison

Actually it does look like OS X is impacted for some sites.   Here's the same graphs from a different e-commerce site.
Comment 15 Gaurav Saxena 2020-06-05 07:27:49 PDT
(In reply to Maciej Stachowiak from comment #10)
> (In reply to Gaurav Saxena from comment #9)
> > Thanks for looking in to this issue. 
> > 
> > Few website urls where we see the impact:
> > https://www.bell.ca/mobility
> > https://www.bell.ca/Mobility/Smartphones_and_mobile_internet_devices
> > https://support.bell.ca/
> 
> Thanks for sharing some URLs. Are you able to reproduce this locally? Does
> visiting these pages with older and newer iOS show a visible difference in
> page load speed?

Welcome Maciej!

Attaching graphs (attachment_v0605_1010) which shows page load times for different iOS versions. 

Desktop MAC Safari page load time impact/degradation is up to 0.7 secs.
Comment 16 Gaurav Saxena 2020-06-05 07:29:32 PDT
Created attachment 401155 [details]
Page load times across different iOS versions and trend for MAC Safari browser
Comment 17 Maciej Stachowiak 2020-06-05 11:08:10 PDT
Thanks for sharing the data. What I'm really wondering is, if you try this yourself from iOS devices or Macs, can you reproduce the slowdown? It seems dramatic enough in the telemetry that it should be visible. I'm assuming these graphs are for load complete, not anything intermediate like first paint.
Comment 18 Gaurav Saxena 2020-06-05 11:40:46 PDT
(In reply to Maciej Stachowiak from comment #17)
> Thanks for sharing the data. What I'm really wondering is, if you try this
> yourself from iOS devices or Macs, can you reproduce the slowdown? It seems
> dramatic enough in the telemetry that it should be visible. I'm assuming
> these graphs are for load complete, not anything intermediate like first
> paint.

Welcome!
Yes, these graphs are for page load times.
Comment 19 Paul Calvano 2020-06-09 07:09:00 PDT
Here's a few more sites that are affected.

  www.michaelkors.com
  www.michaelkors.co.uk

The performance regression is similar to the one Guarav @ Bell Canada shared, as well as some of the anonymous examples I shared last week.
Comment 20 Gaurav Saxena 2020-06-11 12:38:33 PDT
Hi Support Team,

Can you please advise on the next steps for this issue?
Comment 21 Chris Dumez 2020-06-11 14:31:03 PDT
We are actively investigating.
Comment 22 Maciej Stachowiak 2020-06-11 14:53:12 PDT
We've been able to reproduce the issue internally. In our testing, this seems to affect subsequent visits much more than the first visit. Is anyone able to confirm that in their telemetry?

Also, sites powered by Akamai the only sites affected? If there's non-Akamai examples, it would be valuable to know.
Comment 23 Paul Calvano 2020-06-11 20:21:24 PDT
Thanks!  Great to hear that you've been able to reproduce it internally! 

mPulse doesn't track across sessions, so I don't have the ability to confirm whether this affects subsequent visits more than the first visit.

I don't believe that this issue only affects sites using Akamai, although I don't have examples to quantify that. The examples provided so far were using data from Akamai's real user measurement service, but other RUM services should be able to measure the degradation we are seeing.
Comment 24 Gaurav Saxena 2020-06-12 04:49:51 PDT
(In reply to Maciej Stachowiak from comment #22)
> We've been able to reproduce the issue internally. In our testing, this
> seems to affect subsequent visits much more than the first visit. Is anyone
> able to confirm that in their telemetry?
> 
> Also, sites powered by Akamai the only sites affected? If there's non-Akamai
> examples, it would be valuable to know.

Thanks team for the update.
Glad to hear that you are able to reproduce this performance degradation internally. 

Below website is not monitored via Akamai and we can still see same performance degradation. 
https://support.bell.ca/
Comment 25 Cliff Crocker 2020-06-12 11:51:30 PDT
Created attachment 401758 [details]
p75 iPhone - loadeventstart - customer A - US Retailer - SpeedCurve LUX
Comment 26 Cliff Crocker 2020-06-12 11:52:45 PDT
Created attachment 401759 [details]
p75 iPhone - loadeventstart - customer B - US Retailer - SpeedCurve LUX
Comment 27 Cliff Crocker 2020-06-12 11:55:05 PDT
Created attachment 401760 [details]
p75 iPhone - loadeventstart - customer C - US Retailer - SpeedCurve LUX
Comment 28 Cliff Crocker 2020-06-12 11:56:13 PDT
Thanks to Paul/all for identifying this. While we don't see teh degradation for all of our customers, we have seen similar behavior for some of our US retailers as shown in attachments.
Comment 29 Chris Dumez 2020-06-12 12:02:07 PDT
We believe we've identified the change that caused this. We will look into addressing the issue shortly.
Comment 30 Gaurav Saxena 2020-06-12 12:10:07 PDT
(In reply to Chris Dumez from comment #29)
> We believe we've identified the change that caused this. We will look into
> addressing the issue shortly.

Thanks Chris!

This is great news. Glad that we could help in identifying and reporting the issue. 

Looking forward for the fix. 

-Gaurav
Comment 31 Paul Calvano 2020-06-15 13:53:59 PDT
Hello!  I noticed that the subject was updated to reflect that this affects sites that use many media queries. Looking at the HTTP Archive, we can see that as of last year the median website has 14 media queries. The p90 was 45. (see https://almanac.httparchive.org/en/2019/css#media-queries) 

Would it be helpful if I run a query against the HTTP Archive to get you a list of websites that currently contain a large number of media queries?
Comment 32 Chris Dumez 2020-06-16 10:19:10 PDT
Antti fixed this in <https://trac.webkit.org/changeset/263092>. I just did a side-by-side comparison on michaelkors.com after the fix and the regression looked fully recovered.
Comment 33 Gaurav Saxena 2020-06-16 10:50:45 PDT
(In reply to Chris Dumez from comment #32)
> Antti fixed this in <https://trac.webkit.org/changeset/263092>. I just did a
> side-by-side comparison on michaelkors.com after the fix and the regression
> looked fully recovered.

Thanks Chris! 

We will monitor performance on our websites and update the results.
Comment 34 Chris Dumez 2020-06-16 10:56:51 PDT
(In reply to Gaurav Saxena from comment #33)
> (In reply to Chris Dumez from comment #32)
> > Antti fixed this in <https://trac.webkit.org/changeset/263092>. I just did a
> > side-by-side comparison on michaelkors.com after the fix and the regression
> > looked fully recovered.
> 
> Thanks Chris! 
> 
> We will monitor performance on our websites and update the results.

It may take a little while for the fix to ship. We cannot comment on when the fix will ship but we will try to update this bug when it does ship.
Comment 35 Gaurav Saxena 2020-06-16 11:00:05 PDT
(In reply to Chris Dumez from comment #34)
> (In reply to Gaurav Saxena from comment #33)
> > (In reply to Chris Dumez from comment #32)
> > > Antti fixed this in <https://trac.webkit.org/changeset/263092>. I just did a
> > > side-by-side comparison on michaelkors.com after the fix and the regression
> > > looked fully recovered.
> > 
> > Thanks Chris! 
> > 
> > We will monitor performance on our websites and update the results.
> 
> It may take a little while for the fix to ship. We cannot comment on when
> the fix will ship but we will try to update this bug when it does ship.

Thanks! 

Once the fix is shipped we will monitor performance of Bell Canada website and update this thread.
Comment 36 Paul Calvano 2020-08-04 11:39:43 PDT
Do you know if this fix will be shipped with Safari 14?
Comment 37 Alexey Proskuryakov 2020-08-04 11:47:14 PDT
This fix already shipped in iOS 13.6 and macOS 10.15.6.
Comment 38 Paul Calvano 2020-08-04 15:33:07 PDT
Awesome, thanks!
Comment 39 Gaurav Saxena 2020-08-04 15:34:34 PDT
Created attachment 405951 [details]
iOS13.6_iOS14.0 response time improved.
Comment 40 Gaurav Saxena 2020-08-04 15:35:26 PDT
Hi Alexey,

Thanks! 

iOS13.6 and iOS 14.0 - Response time improved and comparable to iOS13.3

Hence, closing this issue.