Reading/Web/Lazy loading of images on all wikis

< Reading‎ | Web

As of Thursday, Aug 18, 00:05 AM UTC images on the mobile site of all Wikimedia projects are lazy loaded. The purpose of this page is to measure the impact this had on our users. In particular we were curious about English, Indonesian and Italian Wikipedia's.

Impact on bytes served to users edit

Comparison of sampled Wikipedia mobile web image and "core bytes" (essential HTML, JavaScript, and CSS) data transfer and pageviews 22-28 August 2016 (lazy loaded images generally on) against 8-14 August 2016 (lazy loading images only enabled on a relatively small set of wikis) suggested that lazy loading images saved approximately 43.63% in image data transfer, contributing to a 14.48% savings in the sum of image and core bytes.

Projected to 52 weeks, this suggests that some 450,000 GB of data transfer would be saved annually on mobile web Wikipedia due to image lazy loading.

The queries, BASH scripts, and resultant data are available as a zip file. Go to the region near cell P5690 in the ODS file for aggregate calculations.

Method for individual wikis edit

Our previous experiments showed that we prevented the shipping of unnecessary bytes to our users. To measure this, using Hive, we analyzed request logs 10 days preceding and following the change. Since the change happened on the 18th August, we looked at requests from the 8th onwards.

Given the time it takes to analyse the amount of data we are crunching here, a query for each day was run.

The query that was run looked at every request in our access log made to our image server where the referrer of that image request was a page that matched a URL of a page in the main namespace for that wiki:

select
month,
day,
substr(referer,1,26),
sum(response_size)
from
webrequest
where
year = 2016
and month = 8 and day = 7
and uri_host = 'upload.wikimedia.org'
and referer rlike '^https://id\.m\.wikipedia\.org/wiki/([^:])+$'
and content_type rlike '^image'
and agent_type = 'user'
and http_status = '200'
group by
month,
day,
substr(referer,1,26)
;

The above query was repeated for English Wikipedia.

Results edit

Bytes savings on Indonesian Wikipedia edit

Day of change is in bold.

day of week date total bytes of images shipped MB total bytes shipped (GB) page views (million) Δ bytes shipped compared to previous day (GB)
MON 07/08/16 97494015192 97494.01519 97.49401519
TUE 08/08/16 103654929616 103654.9296 103.6549296 5.3 6.160914424
WED 09/08/16 100296100098 100296.1001 100.2961001 5.4 -3.358829518
THUR 10/08/16 96713044037 96713.04404 96.71304404 5.2 -3.583056061
FRI 11/08/16 91334881816 91334.88182 91.33488182 4.9 -5.378162221
SAT 12/08/16 81084331368 81084.33137 81.08433137 4.1 -10.25055045
SUN 13/08/16 69321689051 69321.68905 69.32168905 3.4 -11.76264232
MON 14/08/16 81217571248 81217.57125 81.21757125 4 11.8958822
TUE 15/08/16 82680945506 82680.94551 82.68094551 4.2 1.463374258
WED 16/08/16 75591292241 75591.29224 75.59129224 3.8 -7.089653265
THUR 17/08/16 87703049407 87703.04941 87.70304941 4.1 12.11175717
FRI 18/08/16 84731320752 84731.32075 84.73132075 4.5 -2.971728655
SAT 19/08/16 59483625343 59483.62534 59.48362534 4.1 -25.24769541
SUN 20/08/16 44027821340 44027.82134 44.02782134 3.4 -15.455804
MON 21/08/16 52147459414 52147.45941 52.14745941 4.1 8.119638074
TUE 22/08/16 58203553559 58203.55356 58.20355356 4.8 6.056094145
WED 23/08/16 61647558200 61647.5582 61.6475582 5.1 3.444004641
THUR 24/08/16 61075354983 61075.35498 61.07535498 5.1 -0.572203217
FRI 25/08/16 60221200940 60221.20094 60.22120094 4.9 -0.854154043
SAT 26/08/16 53493810141 53493.81014 53.49381014 4.3 -6.727390799
SUN 27/08/16 45471485258 45471.48526 45.47148526 3.6 -8.022324883
MON 28/08/16 55564328478 55564.32848 55.56432848 4.3 10.09284322
Period Bytes shipped in GB
10th-16th 577.9437553
20th-26th 390.8167586
Bytes shipped decrease % decrease
187.1269967 32.37806361

Bytes savings on English Wikipedia edit

Day of change is in bold.

day of week date total bytes of images shipped MB total bytes shipped (GB) Δ bytes shipped compared to previous day (GB)
Tue 08/08/16 1485023830511 1485023.831 1485.023831
Wed 09/08/16 1469288212438 1469288.212 1469.288212 -15.73561807
Thur 10/08/16 1482140100469 1482140.1 1482.1401 12.85188803
Fri 11/08/16 1432380463648 1432380.464 1432.380464 -49.75963682
Sat 12/08/16 1384374343012 1384374.343 1384.374343 -48.00612064
Sun 13/08/16 1479537714179 1479537.714 1479.537714 95.16337117
Mon 14/08/16 1585197209977 1585197.21 1585.19721 105.6594958
Tue 15/08/16 1500168634240 1500168.634 1500.168634 -85.02857574
Wed 16/08/16 1403200226744 1403200.227 1403.200227 -96.9684075
Thur 17/08/16 1386034454782 1386034.455 1386.034455 -17.16577196
Fri 18/08/16 1315374266038 1315374.266 1315.374266 -70.66018874
Sat 19/08/16 839485726330 839485.7263 839.4857263 -475.8885397
Sun 20/08/16 750550486193 750550.4862 750.5504862 -88.93524014
Mon 21/08/16 855300935561 855300.9356 855.3009356 104.7504494
Tue 22/08/16 756576719784 756576.7198 756.5767198 -98.72421578
Wed 23/08/16 744093746725 744093.7467 744.0937467 -12.48297306
Thur 24/08/16 727435780010 727435.78 727.43578 -16.65796671
Fri 25/08/16 747075525560 747075.5256 747.0755256 19.63974555
Sat 26/08/16 700577850257 700577.8503 700.5778503 -46.4976753
Sun 27/08/16 743670756859 743670.7569 743.6707569 43.0929066
Mon 28/08/16 834224283188 834224.2832 834.2242832 90.55352633
Period Bytes shipped in GB
10th-16th 10333.08668
20th-26th 5420.51892
Bytes shipped decrease % decrease
4912.567758 47.54211313

Impact on frontend performance edit

Method edit

To measure impact we took a look at data we had collected via real users via the NavigationTiming API over a 20 day period (10 days before and after the change) were taken of 3 wikis using the following query:

select
left(timestamp,8) as ts,
event_isAnon,
event_lazyLoadImages,
event_isHttp2,
event_loadEventEnd-event_responseStart as roughLoadTimeInitialLagExcluded,
event_responseEnd-event_responseStart as roughNetworkTimeInitialLagExcluded,
event_requestStart,
event_responseStart,
event_responseEnd,
event_firstPaint,
event_domInteractive,
event_domComplete,
event_loadEventStart,
event_loadEventEnd,
webHost,
event_originCountry,
event_mediaWikiVersion
from NavigationTiming_15485142
where
timestamp > '20160808'
and timestamp < '20160829'
and event_action = 'view'
and event_mobileMode = 'stable'
and event_namespaceId = 0
and event_redirectCount is null
and event_loadEventEnd is not null
and event_domComplete is not null
and event_domInteractive is not null
and event_responseStart is not null
and wiki in ('idwiki', 'enwiki', 'itwiki')
order by
wiki,
event_isAnon,
event_lazyLoadImages,
event_isHttp2,
ts
;

Results edit

Impact on fully loaded time on Indonesian Wikipedia edit

timestamp median 90th percentile 95th percentile sample size
20160808 3746.5 12093.3 19175.1 1138
20160809 3837 13308 19538 1157
20160810 3914.5 13566.8 24330.15 1134
20160811 3522 11573.6 18568.2 1047
20160812 3986 14272 24293.5 931
20160813 3576 12089 20956.9 790
20160814 3607 13938 25047.15 880
20160815 3611 12175.6 22761.3 979
20160816 3519.5 10802.5 19511 836
20160817 3427 12215.1 20508 960
20160818 3830.5 13384.7 20205.65 994
20160819 3709 11679.2 17443.9 847
20160820 3258 9129.2 15364.1 759
20160821 3275 11438.8 19056.5 879
20160822 3636 11402 17172 1011
20160823 3466 10702.4 16551.4 1023
20160824 3560 11415 18013 1151
20160825 3363 9960.4 14464.6 979
20160826 3784.5 12910 21955.5 856
20160827 3564 12675 19353.5 771
20160828 3462 12838.5 21686.75 956

Impact on fully loaded time on English Wikipedia edit

timestamp median 90th percentile 95th percentile sample size
20160808 1431 5049.8 8133.8 50913
20160809 1521 5470.8 8926 48393
20160810 1518 5527.1 9024.05 48780
20160811 1532 5500 9009.05 47320
20160812 1542 5505 8778.5 48491
20160813 1510 5287 8434.8 53962
20160814 1478 5163 8340 58381
20160815 1506 5318 8621.2 51125
20160816 1504 5266 8425.1 46519
20160817 1559 5429.4 8857.7 46147
20160818 1577 5441 8706.1 44907
20160819 1527 5223 8238.6 46133
20160820 1454 4717 7320 50771
20160821 1426 4660.4 7138 57449
20160822 1426 4833.6 7576.3 46935
20160823 1470 4973 7640 44021
20160824 1463 5018.5 7741 43776
20160825 1479 5028 7925 43880
20160826 1441 4959.2 7668.6 43929
20160827 1383 4576 7159 49271
20160828 1343 4504 6979.55 56310