real world experiences with http/2 (michael gooding, javier garza from akamai)
TRANSCRIPT
HTTP/2 (h2) in the real world
Michael Gooding@Michael_G_81
Javier Garza@jjaviergarza
©2016 AKAMAI | FASTER FORWARDTM
18Feb2015
©2016 AKAMAI | FASTER FORWARDTM
ConflictinUkrainecontinued
Picture:AFP/GettyImages
©2016 AKAMAI | FASTER FORWARDTM
HeavysnowinIstanbulcausesairportclosure
Picture:AFP/GettyImages
©2016 AKAMAI | FASTER FORWARDTM
RelativesofmissingflightMH370passengersprotestinMalaysia
Picture:AFP/GettyImages
©2016 AKAMAI | FASTER FORWARDTM
PeopleinFinlandcelebratedChineseNewYear
Picture:EPA
©2016 AKAMAI | FASTER FORWARDTM
InHollandaTigercubgoesoutsideforthefirsttime!
Picture:Europics
©2016 AKAMAI | FASTER FORWARDTM
©2016 AKAMAI | FASTER FORWARDTM
©2016 AKAMAI | FASTER FORWARDTM
MichaelGooding:PerformanceSpecialistJavierGarza:EnterpriseArchitect(h2evangelist)1. H2Performance
i. Measurementii. Renderingiii. Smallfilesiv. Sprites
2. Summary
©2016 AKAMAI | FASTER FORWARDTM
Performancei. Measurementii. Renderingiii. Smallfilesiv. Sprites
©2016 AKAMAI | FASTER FORWARDTM
AkamaiRealUserMonitoring(RUM)1.Billionsbeaconscollectedperday2.Somesitesseegoodimprovements3.Somesitesdon’t!4.3rd Partycontentwatersdownbenefit5.A/Btesting6.Browsersbehavedifferently7.Networkconditionsvaryresults
©2016 AKAMAI | FASTER FORWARDTM
Avoid data theft and downtime by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks.
Networkvariationsfornon-cellularconnections
seconds
%users
h1 h2
©2016 AKAMAI | FASTER FORWARDTM
Avoid data theft and downtime by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks.
Networkvariationsforcellularconnections
seconds
%users
h1 h2
©2016 AKAMAI | FASTER FORWARDTM
Avoid data theft and downtime by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks.
ReallatencyvsSimulatedlatency,h1vsh2,ChromevsFirefox
1.Testrealcitieswithreallatency2.Testusingsyntheticlatencyfromdulles3.UsingChromeandFirefoxagents(h2on/off)4.TensofthousandsofWPTtests
UsingWebpagetest.org (WPT)tomeasureLatency
©2016 AKAMAI | FASTER FORWARDTM
Avoid data theft and downtime by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks.
UsingWPTtomeasure(RealvsSimulated)Latency
Lessonslearned:
• Can’ttrustsimulatedlatency
• Differencebetweenrealandsimulatedchangesbybrowsertoo
• BetterstickwithRUMtesting(moreworktocleanresults)
©2016 AKAMAI | FASTER FORWARDTM
Avoid data theft and downtime by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks.
UsingWPTtomeasurePacketLoss
Source: http://conferences.oreilly.com/velocity/devops-web-performance-ny/public/schedule/detail/51303 - https://goo.gl/MPndFs
h2performancesufferswithpacketloss
0%packetloss 2%packetloss h1 h2
0%packetloss 2%packetloss
©2016 AKAMAI | FASTER FORWARDTM
Avoid data theft and downtime by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks.
Otherresearchstudiesonpacketloss
h2helpswithalotofsmallobjects TCPslowstartimpactsasingleconnectionwhendeliveringmorebytes
Source: https://www.akamai.com/us/en/multimedia/documents/technical-publication/http2-performance-in-cellular-networks.pdf > https://goo.gl/y0NYha
©2016 AKAMAI | FASTER FORWARDTM
Performancei. Measurementii. Renderingiii. Smallfilesiv. Sprites
©2016 AKAMAI | FASTER FORWARDTM
Avoid data theft and downtime by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks.
Performance- Rendering
h1
h2
h1
h2
4 sec
©2016 AKAMAI | FASTER FORWARDTM
What’stheproblem?Renderingwithdifferentprioritisation
©2016 AKAMAI | FASTER FORWARDTM
Avoid data theft and downtime by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks.
Performance- Rendering:Sharding
h1
h2
1Domain
Allonsameconnection
2nd connectionopened
/js/css
www.website.com
/js/css
www.website.com
dns connection ssl ttfb d/load
©2016 AKAMAI | FASTER FORWARDTM
Avoid data theft and downtime by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks.
Performance- Rendering:Sharding
cdn.website.com/jscdn.website.com/csswww.website.com
cdn.website.com/jscdn.website.com/csswww.website.com
h1
h2
2 Domains
h2
1Certificate
2Certificates
cdn.website.com/jscdn.website.com/csswww.website.com
dns connection ssl ttfb d/load
©2016 AKAMAI | FASTER FORWARDTM
Avoid data theft and downtime by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks.
Performance– Rendering:Shardingexample
h2after
h2before
Simpleimprovementbynotmakingconnection
©2016 AKAMAI | FASTER FORWARDTM
Avoid data theft and downtime by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks.
Performance– Rendering:Shardingexample
h2after
h2before
©2016 AKAMAI | FASTER FORWARDTM
Avoid data theft and downtime by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks.
Performance– Rendering:Progressivejpegs
h2
normaljpeg
progressiveNormaljpegsjust60%loaded
©2016 AKAMAI | FASTER FORWARDTM
Avoid data theft and downtime by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks.
Performance– Rendering:Progressivejpegexample
h2after
h2before
©2016 AKAMAI | FASTER FORWARDTM
Avoid data theft and downtime by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks.
Performance– Rendering:DIYprioritisation
<imgonload="addImages();"src="tshirt12_thumb.jpg">
<script>functionaddImages(){;
var img=document.createElement("img");img.src="tshirt2.jpg";document.getElementById("imgholder").appendChild(img);
}</script>
Differentorderandloadedwithdependency
©2016 AKAMAI | FASTER FORWARDTM
Avoid data theft and downtime by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks.
Performance– Renderingexample
Largeimagefillsbandwidth
©2016 AKAMAI | FASTER FORWARDTM
Avoid data theft and downtime by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks.
Performance– Renderingexample
progjpg
h2before
jspriority
©2016 AKAMAI | FASTER FORWARDTM
Avoid data theft and downtime by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks.
Performance– RenderingexamplewithPush
2 sec1 sec
Push
progjpg
©2016 AKAMAI | FASTER FORWARDTM
Avoid data theft and downtime by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks.
Performance– RenderingexampleServerPush
h2push
progjpg
©2016 AKAMAI | FASTER FORWARDTM
Avoid data theft and downtime by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks.
Performance– Rendering:Serverpushbadexample
h2push
h2before
©2016 AKAMAI | FASTER FORWARDTM
RenderingSummary1. Keepcriticalcontentonsamedomain2. Ifyouneedtoshardtobalanceh1usethesamecert3. Progressivejpgscanhelprendering4. UseJavaScriptifyouneedtodelayresources5. Useserverpushwhereyoucan
©2016 AKAMAI | FASTER FORWARDTM
Performancei. Measurementii. Renderingiii. Smallfilesiv. Sprites
©2016 AKAMAI | FASTER FORWARDTM
Avoid data theft and downtime by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks.
Performance– Smallfiles:CSSCSSbytesdownloaded(gzip off)
H2issmallerbecauseofheadercompression
h1 h2
#offiles
bytes
©2016 AKAMAI | FASTER FORWARDTM
Avoid data theft and downtime by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks.
Performance– Smallfiles:CSSh2performancecomparison h
#offiles
time
©2016 AKAMAI | FASTER FORWARDTM
Avoid data theft and downtime by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks.
Performance– Smallfiles:CSSh2performancecomparison- Chrome h
#offiles
time
h1 h2
H2isfaster,especiallyasyouincreasethenumberoffiles
Smallernumberoffilesisfastertoload
©2016 AKAMAI | FASTER FORWARDTM
Avoid data theft and downtime by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks.
Performance– Smallfiles:CSSh2performancecomparison- Firefox h
#offiles
time
h1 h2
H2isslowerinFFafter~100files
Smallernumberoffilesisfastertoloadforh1andh2
©2016 AKAMAI | FASTER FORWARDTM
Avoid data theft and downtime by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks.
Performance– Smallfiles:CSSh2performancecomparison– SafariMobile h
#offiles
time
h1 h2
H2isfaster,especiallyasyouincreasethenumberoffiles
Smallernumberoffilesisfastertoload
©2016 AKAMAI | FASTER FORWARDTM
Avoid data theft and downtime by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks.
Performance– Smallfiles:CSSh2performancecomparison– ChromeMobile h
#offiles
time
h1 h2
H2isfaster,butstruggles>500files
©2016 AKAMAI | FASTER FORWARDTM
Avoid data theft and downtime by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks.
Performance– Smallfiles:CSSToomanyfilescausesproblemsinChrome
???
©2016 AKAMAI | FASTER FORWARDTM
Avoid data theft and downtime by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks.
Performance– Smallfilesexample
Networknotmuchdifferent
h2after
h2before
©2016 AKAMAI | FASTER FORWARDTM
Avoid data theft and downtime by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks.
Performance– Smallfilesexample
h2after
h2before
Resultinbrowserisbig
©2016 AKAMAI | FASTER FORWARDTM
Avoid data theft and downtime by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks.
Performance– Smallfiles:JSh2performancecomparison h
#offiles
time
©2016 AKAMAI | FASTER FORWARDTM
Avoid data theft and downtime by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks.
Performance– Smallfiles:JSWhataboutrendering? h
h1 h2
©2016 AKAMAI | FASTER FORWARDTM
Avoid data theft and downtime by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks.
Performance– Smallfiles:JSexample
Networkresultsprettysimilar
h2after
h2before
©2016 AKAMAI | FASTER FORWARDTM
Avoid data theft and downtime by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks.
Performance– Smallfiles:JSexample
Fasterrenderinginbrowser
h2after
h2before
©2016 AKAMAI | FASTER FORWARDTM
SmallfilesSummary1. h2ismoreefficientinmostbrowsers2. NOTfasterdealingwithmanyfiles3. Keepcombiningfiles,sameash14. 2or3isok,basedonfrequencyofchange
©2016 AKAMAI | FASTER FORWARDTM
Performancei. Measurementii. Renderingiii. Smallfilesiv. Sprites
©2016 AKAMAI | FASTER FORWARDTM
Avoid data theft and downtime by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks.
Performance– ImageSpritesh2performancecomparison h
#offiles
time
mob-SafariX
©2016 AKAMAI | FASTER FORWARDTM
Avoid data theft and downtime by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks.
Performance– ImageSpritesh2performancecomparison- Chrome h
#offiles
time
h1 h2
Differencebetweenh1andh2isalmostnonexistentforimages
Smallernumberoffilesisfastertoloadforbothprotocols
©2016 AKAMAI | FASTER FORWARDTM
Avoid data theft and downtime by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks.
Performance– ImageSpritesh2performancecomparison- Firefox h
#offiles
time
h1 h2
h2isonlyslightlyslowerinFF
Smallernumberoffilesisfastertoloadforh1andh2
©2016 AKAMAI | FASTER FORWARDTM
Avoid data theft and downtime by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks.
Performance– ImageSpritesh2performancecomparison– SafariMobile h
#offiles
time
h1 h2
h2justbreaks>200files
Smallernumberoffilesisfastertoload
©2016 AKAMAI | FASTER FORWARDTM
Avoid data theft and downtime by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks.
Performance– ImageSpritesh2performancecomparison– SafariMobile h h2
HardertodebugoniPhone,couldbe:1. Maxstreams2. Memory3. CPU
©2016 AKAMAI | FASTER FORWARDTM
Avoid data theft and downtime by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks.
Performance– ImageSpritesh2performancecomparison– ChromeMobile h
#offiles
time
h1 h2
h2performanceismixedforChromeMobile
©2016 AKAMAI | FASTER FORWARDTM
Avoid data theft and downtime by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks.
Performance– ImageSpritesVisualexperienceofloadingthepage
h1 h2
©2016 AKAMAI | FASTER FORWARDTM
Avoid data theft and downtime by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks.
Performance– ImageSprites
Otherconsiderations1. Managementcomplexity2. Caching3. Imagesusedinsprite
©2016 AKAMAI | FASTER FORWARDTM
Avoid data theft and downtime by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks.
Performance– ImageSpritesexample
©2016 AKAMAI | FASTER FORWARDTM
Avoid data theft and downtime by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks.
Performance– ImageSpritesexample
h2images
h2sprite
Loaddifferencemuchlesswithsprite
©2016 AKAMAI | FASTER FORWARDTM
Avoid data theft and downtime by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks.
Performance– ImageSpritesexample
#ofimagesused
Load
time(m
s)
#sprite19{background:url('images/sprite.png')no-repeat-17px0;}
#image19{background:url('sprite/sprite19.png')no-repeat;}
0
70
140
sprite 1 5 10 20 30 40
code
imgused
©2016 AKAMAI | FASTER FORWARDTM
SpriteSummary1. Keepusingspritesforperformance,especiallymobile2. Ifyouareonlyusingafewimagesfilesareok3. Thinkaboutmanagementcost4. Thinkaboutfrequencyofchange5. Mobiledecodingtimescanbeslowandhasissueswith
largenumbersoffiles
©2016 AKAMAI | FASTER FORWARDTM
Mostofthetimesh2improvesperformanceDon’tgiveupifitdoesn’tAnti-patternsaren’tanti-patterns
1. Don’tshardcriticalcontent2. Keepcombiningfiles3. Keepusingsprites(ifyouuseenoughimages)
EverythingisevolvingFAST(servers,browsers,QUIC)
©2016 AKAMAI | FASTER FORWARDTM
Avoid data theft and downtime by extending the security perimeter outside the data-center and protect from increasing frequency, scale and sophistication of web attacks.
Shamelessplug
https://goo.gl/3ZVNN8
©2016 AKAMAI | FASTER FORWARDTM
1. Turnh2on2. Measure3. Experiment4. Share
Whatifwecouldsave1secondoneverypagethiswomanviewsinaday?(50pageviews/day)
©2016 AKAMAI | FASTER FORWARDTM
1sec/pagex50/dayx365=5hours/year
5 sec/page=25hours/year
Questions?
Michael Gooding@Michael_G_81
uk.linkedin.com/in/mgooding1981
Javier Garza@jjaviergarza
www.linkedin.com/in/jjgarza