Performance AutomationMaking pages faster automatically
Agenda Introduction
 What is performance automation
 Basic terminology and concepts
 Case Study
 History of performance automation
 Market overview and challenges
 Q&A
Web Performance
Making sites faster without changing code
Basic terminology and concepts
Waterfall chart11
Waterfall chartHTML12
Waterfall chartHTMLResources13
Waterfall chartStart RenderDocument CompleteFullyLoaded14
Waterfall component breakdownDNS lookupDNS LookupTakes one packet in each direction
Time is limited to the latency of the connection (DSL/Cable/etc) for the single round trip15
Waterfall component breakdownTCP ConnectionTCP Connection3 packets      - ClientServer (SYN)      - ServerClient   (SYN/ACK)      - ClientServer (ACK)Time is limited to the latency of the connection (DSL/Cable/etc) for the single round trip16
Waterfall component breakdownTime To First ByteTime to First ByteTime from the request packet (usually 1) to the first packet of the response
Includes the latency of the connect ion  (DSL/Cable/etc) for a single round trip
Also includes whatever server think time was involved in generating the response17
Waterfall component breakdownContent DownloadDownloadTime it takes for the entire content of the response to get to the browser
Mostly limited by the bandwidth limit of the connection (DSL/Cable/etc)18
First view vs Repeat View19
ConcurrencyConcurrencyBlocking script don't let the browser use available resources (network, connections, etc) to fetch more content from the server
The overall page load time and render time are both affected negativelyBlockingConcurrent20
Case Study: Automation in action
Methodology
Let’s Automate
A Few Points of ClarificationWe’ll use it to describe where performance pain points are, but that doesn’t mean the page actually has these problemsWhat we’re going to do:Improve performance incrementallyNot so good(slow)Awesome(fast)* The real Velocity site is somewhere in the middle!
Performance Summaryhttp://bit.ly/au01VY /
WaterfallFirst ViewRepeat View
Per Object
Content Analysis by Type
Content Analysis by Domain
Show Me Where It HurtsProblem Analysis
Performance ProblemsToo many connections (too much orange)
Too Many Connections97 Connections(almost one per request)
Too Many Connections
Performance ProblemsToo many connections (too much orange)Too many bytes (too much blue)
Too Many BytesBy TypeBy Domain
Performance ProblemsToo many connections (too much orange)Too many bytes (too much blue)Concurrency
ConcurrencyBrowsers can only open and use so many connections at oncewww.browserscope.org
Performance ProblemsToo many connections (too much orange)Too many bytes (too much blue)ConcurrencyBad Caching for repeat views
Bad Repeat ViewFull FetchesValidation
Bad Repeat ViewConnectionsBytes
Performance ProblemsToo many connections (too much orange)Too many bytes (too much blue)ConcurrencyBad Caching for repeat viewsNo CDN (the greens are too big)
The Green Problem #1: No CDNTTFB
Performance ProblemsToo many connections (too much orange)Too many bytes (too much blue)ConcurrencyBad Caching for repeat viewsNo CDN (the greens are too big)Too Many Roundtrips (too many greens)
The Green Problem #2: RoundtripsRepeat ViewFirst View80 Requests78 Requests27 Requests14 Requests
The Green Problem #2: RoundtripsEvery fetch still pays the HTTP overhead penalty  TTFB is still a problemExacerbated by concurrency issuesGetting worse as number of objects per page growsGenerally, the hardest problem to solve
Performance ProblemsToo many connectionsToo many bytes (too much blue)ConcurrencyBad Caching for repeat viewsNo CDN (the greens are too big)Too Many Roundtrips (too many greens)Others
Examples of Other ProblemsBlocking Javascript3rd party calls (http://stevesouders.com/p3pc/)
What it looks likehttp://bit.ly/velocity-original
Summary
Let’s Fix It!!
Set-Up
Testing EnvironmentWebPageTest Client(East Coast)O’Reilly Datacenter (West Coast)SERVICE (CLOUD)
Acceleration Methodology
Stepwise AccelerationStart from the beginning and fix the easy stuffStep by step acceleration of the pageApply techniques/methods/etc and see the resultTry to make it as fast as possible
Step 1: Low Hanging Fruit
Keep-AliveSolves the too-many connection problem (Less Orange!)Will help alleviate the TCP connection setup overhead97 Connections
CompressionAddresses the too-many-bytes problem (Less Blue!)We’ll compress textual content (html/css/etc)Not the only solution to less blue, but the easiest
WebPageTesthttp://bit.ly/cKkjGz
Before and After~17.8sec~10.5sec
What We Helped: Keep-Alive97 Connections   19 Connections
What We Helped: Compression
How Did We Do?OriginalKA+CompImprovementFirst View Repeat View52%71%34%94%31%51%23%75%40%62%
What it looks likehttp://bit.ly/velocity-keep-alives
Pros and ConsProsReally easy to doSingle configuration switches in servers, proxies, or load balancersGood benefit seen right awayConsCompression has processing overheadOn their own they’re just not enough
Step 2: Repeat View Problem
Poor Client Side CachingOriginalKA+Comp
Problem Still Exists~6.2sec
How Do We Get Better CachingRFC 2616, Section 13Caching headers should be used on static (non-changing) objects, so they can be cached browser-side And by intermediate caching proxiesValidators are not enough
WebPageTesthttp://bit.ly/aCP3iX
Before and After~2.0sec~6.2sec
How Did We Do?KA+CompWith Good CachingImprovementRepeat View70%42%67%
Pros and ConsProsGood caching can have a major performance impact on repeat visits to a pageSometimes it’s easy to doBrowsers generally pay attention (although interpretation may vary slightly)ConsThe spec appears scaryInvalidation and stale content
Step 3: CDN
What Does a CDN do?Global network of proxy cachesGet cacheable content close to usersReduce TTFB (smaller greens)
TTFB Problem
WebPageTesthttp://bit.ly/a9ZJcF
Before and After~8.3sec~10.5sec
TTFB SavingsPer object TTFB savings of ~50%
How Did We Do?KA+Comp+CDNImprovementFirst View21%17%22%0.7 sec2.3 sec2.7 secSeconds Gained
What it looks likehttp://bit.ly/velocity-CDN
Pros and ConsProGood mitigation of the TTFB problemEstablished industry: lots of vendors to choose fromConsSometimes costlyMay require code change (CDN’ed objects should be written to the CDN domain)
Step 4: Steroids - the Hard Stuff
We Can Get Better!Still too many roundtripsStill too many bytesNot Fast Enough!!
What to do Next?Reduce RoundtripsCombine imagesCombine JavaScriptCombine CSSReduce Payload even moreMinify CSS and JavaScriptAdd Image CompressionIncrease ConcurrencyAdd a couple of domains to the mix
WebPageTesthttp://bit.ly/bbT3v4
Before and After~3.8sec~8.3sec
How Did We Do?+CDN81107+Strangeloop1137ImprovementFirst View19%30%54%45%31%0.5 sec4.6 sec4.1 secSeconds Gained
What it looks likehttp://bit.ly/velocity-awesomest
Pros and ConsProsMost significant benefit for the hardest part of the acceleration lifecycleAddress multiple performance points (somtimes multiple ones with the same technique)ConsIt’s not easyRegression
Other performance opportunities
3rd Party content & Javascript
AdditionalTCP based optimizations**Image credit: FastSoft[http://www.fastsoft.com/how-it-works/]
DNS based optimizations
Different BrowsersSafari MobileIE 7IE 8IE 6FireFox 3Chrome 4Chrome 5FireFox 2Safari 4
FlowConversion???3.8 Seconds11 Roundtrips
Performance automation market
19932002199920062000200719961995199820042003200920082010
History of performance automation“I will deliver what the server gives me as efficiently as possible to the browser.”“I will transform what the server gives me to optimize it for the user’s browser”DeliveryTransformation
Deliveryvs TransformationTransformation DeliveryOriginal9.5 seconds63 roundtrips5.7 seconds63 roundtrips2.1 seconds9 roundtrips
Delivery market

Web Performance Automation - NY Web Performance Meetup

Editor's Notes

  • #111 Optimizing web performance doesn’t just drive more traffic to a website. It also improves the user experience, increases revenue, and reduces operating costs. In 2010, there’s an important convergence happening between two previously divergent communities: The business community is aware of the direct relationship between site speed and business metrics. The technical community has a growing expertise and understanding of web performance issues.The gap between how sites currently perform and how users want sites to perform is still huge, but companies finally have the incentive – and access to tools – to bridge that gap. This year there’s a palpable urgency surrounding web performance optimization, as companies race to lead the pack in delivering sites that meet – and ideally, exceed – user expectations.