SlideShare a Scribd company logo
1 of 77
"Never
underestimate the
        — CEO Eric Schmidt announcing
        Google Instant in September 2010
The Low-Hanging
      Fruit
    The 20 / 80 rule
I. Serve up lighter files

II. Trim back on HTTP

III. Keep things a-movin’
    (avoid blocking)
SERVE UP
Lighter Files
The HTTP Waterfall
Image Optimization
Images are often >50% of a page’s total weight!
Leaner JPEGs
Leaner JPEGs:
   Quality
Leaner JPEGs:
 Progressive
Leaner JPEGs:
  Metadata
Leaner JPEGs:
     Metadata
     command line ahoy!



> jpegtran -copy none -optimize
        src.jpg dest.jpg
Professional PNGs
Professional PNGs:
     bit depth
Professional PNGs:
       8bit
Professional PNGs:
 8bit alpha woes?
•8bit PNGs CAN have full alpha
 support!

•Use Adobe Fireworks instead
•Or run them through pngquant
Professional PNGs:
   PNGQUANT
     command line ahoy!




  > pngquant 256 whatever.png
Professional PNGs:
    PNGCRUSH
     command line ahoy!



 > pngcrush -rem alla -reduce
  -brute source.png dest.png
smush.it
That’s the URL!
animated GIFs are
      back
    gifsicle can help
Slimmer Text Fil
                         The Rudimentary Approach


•   class=“whatever”
    → class=whatever

•   http://www.utexas.edu/law/whatever.html
    → /law/whatever.html

•   <script type=“text/javascript”>
    → <script>

•   Use CSS shorthand!
Slimmer Text Fil
                  Minify your scripts and other text




jquery-1.6.3.js                          jquery-1.6.3.min.js
Slimmer Text Fil
            Minify your scripts and other text



• YUICompressor
• Google's Closure Compiler
• Dojo ShrinkSafe
• Packer
• JSMin
Slimmer Text Fil
                       Serious bandwidth savings with gzip


For Apache 2.x*:
<ifModule mod_deflate.c>

    AddOutputFilterByType DEFLATE text/html text/css application/x-javascript

</ifModule>




                                          * Note: don’t do this on Web Central…
Trim Back on
HTTP Requests
The Problem with
 HTTP Requests
 HTTP/1.1 specifies 2 maximum
 simultaneous TCP connections




    Source: HTTP/1.1 specification, RFC 2616 8.1.4
    http://www.w3.org/Protocols/rfc2616/rfc2616-
    sec8.html#sec8
The Problem with
 HTTP Requests
 HTTP/1.1 specifies 2 maximum
 simultaneous TCP connections

         (per domain)


    Source: HTTP/1.1 specification, RFC 2616 8.1.4
    http://www.w3.org/Protocols/rfc2616/rfc2616-
    sec8.html#sec8
HTTP Waterfall
     IE7




generated with http://
www.webpagetest.org/
HTTP Waterfall -
  Chrome 14
Remove Duplicates
                &
Fold print and
media query styles
Fold print and
   media query styles
<link rel="stylesheet" href="styles.css" />
<link rel="stylesheet" href="print.css" />
Fold print and
media query styles
/* Print styles in styles.css
@media print {
    body {
        background: #fff;
    }
}
CSS Image Sprites
CSS Image Sprites
use




      PS: Maybe use CSS opacity
      to cut down on the number
      of button states in an image
      sprite?
Data URIs
background-image: url("data:image/png;base64,xKfsiO…ssseAdd==");
Data URIs
Data URIs
•   Prevents the opening of an additional TCP request
Data URIs
•   Prevents the opening of an additional TCP request

•   Faster download than a separate image request
Data URIs
•   Prevents the opening of an additional TCP request

•   Faster download than a separate image request

•   Can be created on the fly in PHP with
    base64_encode()
Data URIs
•   Prevents the opening of an additional TCP request

•   Faster download than a separate image request

•   Can be created on the fly in PHP with
    base64_encode()

•   Are only cached if included inside of a stylesheet
    (not inline)
Data URIs
•   Prevents the opening of an additional TCP request

•   Faster download than a separate image request

•   Can be created on the fly in PHP with
    base64_encode()

•   Are only cached if included inside of a stylesheet
    (not inline)

•   ~30% larger than “real” image files
    (~2% if gzip is enabled)
Data URIs
•   Prevents the opening of an additional TCP request

•   Faster download than a separate image request

•   Can be created on the fly in PHP with
    base64_encode()

•   Are only cached if included inside of a stylesheet
    (not inline)

•   ~30% larger than “real” image files
    (~2% if gzip is enabled)

•   Wide browser support, but no IE 7 or older
    (and IE8 only supports up to 32KB of data)
Cache: Far-Future
    Expires
Cache: Far-Future
    Expires
Cache: Far-Future
        Expires
          Stick this in your .htaccess


<IfModule mod_expires.c>
ExpiresActive on
	 <FilesMatch ".(gif|jpg|png|js|css)$">
	    ExpiresDefault "access plus 5 years"
	 </FilesMatch>
</IfModule>
Cache: Far-Future
    Expires
Wait, why are they still seeing that version?!
Cache: Far-Future
         Expires
      Wait, why are they still seeing that version?!


• A good practice, but users might end up with old
  versions of styles and scripts…
Cache: Far-Future
         Expires
      Wait, why are they still seeing that version?!


• A good practice, but users might end up with old
  versions of styles and scripts…

• To force a fresh download you can rename the file
  (I hope you’ve got a CMS or build process that
   makes this easy!)
Cache: ETags
Cache: Disable
    ETags
 Another one for your .htaccess



 FileETag none
Cache: Disable
    ETags
 Another one for your .htaccess



 FileETag none


               Recommended by Microsoft and
               Apache!
               http://support.microsoft.com/?
               id=922733
               http://www.apacheweek.com/issues/
               02-0-18
Stay in Motion
(avoid resource
 blocking)
Blocking (IE7
  example)
What can cause
  blocking?
What can cause
           blocking? in
•   External scripts cause blocking,
    case of a document.write() and to
    ensure proper order of execution
What can cause
           blocking? in
•   External scripts cause blocking,
    case of a document.write() and to
    ensure proper order of execution

•Inline <script> can hang things up
What can cause
           blocking? in
•   External scripts cause blocking,
    case of a document.write() and to
    ensure proper order of execution

•Inline <script> can hang things up
•Scripts often don’t execute until
    stylesheets are finished downloading
What can cause
           blocking? in
•   External scripts cause blocking,
    case of a document.write() and to
    ensure proper order of execution

•Inline <script> can hang things up
•Scripts often don’t execute until
    stylesheets are finished downloading

•CSS @import causes blocking
    in older IE
What can cause
           blocking? in
•   External scripts cause blocking,
    case of a document.write() and to
    ensure proper order of execution

•Inline <script> can hang things up
•Scripts often don’t execute until
    stylesheets are finished downloading

•CSS @import causes blocking
    in older IE

•iframes can block onload from firing
Cuzillion
http://stevesouders.com/cuzillion/
How do we get
 around this?
How do we get
      around this?
•   Put stylesheets in the <head> using a
    <link> tag instead of @import
How do we get
      around this?
•   Put stylesheets in the <head> using a
    <link> tag instead of @import

•   Put your scripts as close to the
    </body> tag as possible (in most
    circumstances)
How do we get
      around this?
•   Put stylesheets in the <head> using a
    <link> tag instead of @import

•   Put your scripts as close to the
    </body> tag as possible (in most
    circumstances)

•   Use a script loader like LabJS or HeadJS
How do we get
      around this?
•   Put stylesheets in the <head> using a
    <link> tag instead of @import

•   Put your scripts as close to the
    </body> tag as possible (in most
    circumstances)

•   Use a script loader like LabJS or HeadJS

•   Use non-blocking script insertion
    techniques like XHR Injection **
Asynchronous
        Script Insertion
(function () {
    var ga   = document.createElement('script'),

        s     = document.getElementsByTagName('script')[0];

    ga.type   = 'text/javascript';
    ga.async = true;

    ga.src    = ('https:' === document.location.protocol ?
                'https://ssl' :
                'http://www') +
                '.google-analytics.com/ga.js';

    s.parentNode.insertBefore(ga, s);

}());
Forward-looking
  approaches
Forward-looking
     approaches
• <script  defer>
 (wide browser support, but
  execution order?)
Forward-looking
     approaches
• <script  defer>
 (wide browser support, but
  execution order?)

• <script async>
 (HTML5, widening support, but no IE)
Forward-looking
     approaches
• <script  defer>
 (wide browser support, but
  execution order?)

• <script async>
 (HTML5, widening support, but no IE)

• Web Workers
 (Multi-threaded JS processing! But no IE…)
DEMO

YSlow   PageSpeed
Going on an HTTP Diet: Front-End Web Performance

More Related Content

What's hot

The Need for Speed - SMX Sydney 2013
The Need for Speed - SMX Sydney 2013The Need for Speed - SMX Sydney 2013
The Need for Speed - SMX Sydney 2013Bastian Grimm
 
HTML5 Real-Time and Connectivity
HTML5 Real-Time and ConnectivityHTML5 Real-Time and Connectivity
HTML5 Real-Time and ConnectivityPeter Lubbers
 
A Forgotten HTTP Invisibility Cloak
A Forgotten HTTP Invisibility CloakA Forgotten HTTP Invisibility Cloak
A Forgotten HTTP Invisibility CloakSoroush Dalili
 
ClubAJAX Basics - Server Communication
ClubAJAX Basics - Server CommunicationClubAJAX Basics - Server Communication
ClubAJAX Basics - Server CommunicationMike Wilcox
 
Nuts and Bolts of WebSocket Devoxx 2014
Nuts and Bolts of WebSocket Devoxx 2014Nuts and Bolts of WebSocket Devoxx 2014
Nuts and Bolts of WebSocket Devoxx 2014Arun Gupta
 
Minimize website page loading time – 20+ advanced SEO tips
Minimize website page loading time – 20+ advanced SEO tipsMinimize website page loading time – 20+ advanced SEO tips
Minimize website page loading time – 20+ advanced SEO tipsCgColors
 
HTML5 vs Silverlight
HTML5 vs SilverlightHTML5 vs Silverlight
HTML5 vs SilverlightMatt Casto
 
Rails security: above and beyond the defaults
Rails security: above and beyond the defaultsRails security: above and beyond the defaults
Rails security: above and beyond the defaultsMatias Korhonen
 
Re-thinking Performance tuning with HTTP2
Re-thinking Performance tuning with HTTP2Re-thinking Performance tuning with HTTP2
Re-thinking Performance tuning with HTTP2Vinci Rufus
 
Search in WordPress - how it works and howto customize it
Search in WordPress - how it works and howto customize itSearch in WordPress - how it works and howto customize it
Search in WordPress - how it works and howto customize itOtto Kekäläinen
 
High Performance WordPress
High Performance WordPressHigh Performance WordPress
High Performance WordPressvnsavage
 
cache concepts and varnish-cache
cache concepts and varnish-cachecache concepts and varnish-cache
cache concepts and varnish-cacheMarc Cortinas Val
 
Profiling php applications
Profiling php applicationsProfiling php applications
Profiling php applicationsJustin Carmony
 
Blazing Data With Redis (and LEGOS!)
Blazing Data With Redis (and LEGOS!)Blazing Data With Redis (and LEGOS!)
Blazing Data With Redis (and LEGOS!)Justin Carmony
 
Connecting to Web Services on Android
Connecting to Web Services on AndroidConnecting to Web Services on Android
Connecting to Web Services on Androidsullis
 
WordPress security for everyone
WordPress security for everyoneWordPress security for everyone
WordPress security for everyoneVladimír Smitka
 
Racing The Web - Hackfest 2016
Racing The Web - Hackfest 2016Racing The Web - Hackfest 2016
Racing The Web - Hackfest 2016Aaron Hnatiw
 
Happy Browser, Happy User! WordSesh 2019
Happy Browser, Happy User! WordSesh 2019Happy Browser, Happy User! WordSesh 2019
Happy Browser, Happy User! WordSesh 2019Katie Sylor-Miller
 

What's hot (20)

The Need for Speed - SMX Sydney 2013
The Need for Speed - SMX Sydney 2013The Need for Speed - SMX Sydney 2013
The Need for Speed - SMX Sydney 2013
 
HTML5 Real-Time and Connectivity
HTML5 Real-Time and ConnectivityHTML5 Real-Time and Connectivity
HTML5 Real-Time and Connectivity
 
A Forgotten HTTP Invisibility Cloak
A Forgotten HTTP Invisibility CloakA Forgotten HTTP Invisibility Cloak
A Forgotten HTTP Invisibility Cloak
 
Flash And Dom
Flash And DomFlash And Dom
Flash And Dom
 
ClubAJAX Basics - Server Communication
ClubAJAX Basics - Server CommunicationClubAJAX Basics - Server Communication
ClubAJAX Basics - Server Communication
 
Nuts and Bolts of WebSocket Devoxx 2014
Nuts and Bolts of WebSocket Devoxx 2014Nuts and Bolts of WebSocket Devoxx 2014
Nuts and Bolts of WebSocket Devoxx 2014
 
Minimize website page loading time – 20+ advanced SEO tips
Minimize website page loading time – 20+ advanced SEO tipsMinimize website page loading time – 20+ advanced SEO tips
Minimize website page loading time – 20+ advanced SEO tips
 
HTML5 vs Silverlight
HTML5 vs SilverlightHTML5 vs Silverlight
HTML5 vs Silverlight
 
Rails security: above and beyond the defaults
Rails security: above and beyond the defaultsRails security: above and beyond the defaults
Rails security: above and beyond the defaults
 
Re-thinking Performance tuning with HTTP2
Re-thinking Performance tuning with HTTP2Re-thinking Performance tuning with HTTP2
Re-thinking Performance tuning with HTTP2
 
Search in WordPress - how it works and howto customize it
Search in WordPress - how it works and howto customize itSearch in WordPress - how it works and howto customize it
Search in WordPress - how it works and howto customize it
 
High Performance WordPress
High Performance WordPressHigh Performance WordPress
High Performance WordPress
 
cache concepts and varnish-cache
cache concepts and varnish-cachecache concepts and varnish-cache
cache concepts and varnish-cache
 
Profiling php applications
Profiling php applicationsProfiling php applications
Profiling php applications
 
Blazing Data With Redis (and LEGOS!)
Blazing Data With Redis (and LEGOS!)Blazing Data With Redis (and LEGOS!)
Blazing Data With Redis (and LEGOS!)
 
Connecting to Web Services on Android
Connecting to Web Services on AndroidConnecting to Web Services on Android
Connecting to Web Services on Android
 
WordPress security for everyone
WordPress security for everyoneWordPress security for everyone
WordPress security for everyone
 
Scaling Django
Scaling DjangoScaling Django
Scaling Django
 
Racing The Web - Hackfest 2016
Racing The Web - Hackfest 2016Racing The Web - Hackfest 2016
Racing The Web - Hackfest 2016
 
Happy Browser, Happy User! WordSesh 2019
Happy Browser, Happy User! WordSesh 2019Happy Browser, Happy User! WordSesh 2019
Happy Browser, Happy User! WordSesh 2019
 

Viewers also liked

生命經驗傳承 人生經驗比賽
生命經驗傳承 人生經驗比賽生命經驗傳承 人生經驗比賽
生命經驗傳承 人生經驗比賽edwardshen
 
Apples’ iPhone, iPod touch and iPad Application Programming - CLASS 1
Apples’ iPhone, iPod touch and iPad Application Programming - CLASS 1Apples’ iPhone, iPod touch and iPad Application Programming - CLASS 1
Apples’ iPhone, iPod touch and iPad Application Programming - CLASS 1Violeta Salas
 
Mobile Marketing and Social Campaigns
Mobile Marketing and Social CampaignsMobile Marketing and Social Campaigns
Mobile Marketing and Social CampaignsVioleta Salas
 
Class 02 Objective C
Class 02   Objective CClass 02   Objective C
Class 02 Objective CVioleta Salas
 
Find your true passion and do what you love to do
Find your true passion and do what you love to doFind your true passion and do what you love to do
Find your true passion and do what you love to doVioleta Salas
 
Self discipline - Brian Tracy
Self discipline - Brian TracySelf discipline - Brian Tracy
Self discipline - Brian TracyVioleta Salas
 
стратегии международной рекламы
стратегии международной рекламыстратегии международной рекламы
стратегии международной рекламыdutik
 
Mobile marketing & Business
Mobile marketing & Business Mobile marketing & Business
Mobile marketing & Business Violeta Salas
 
Concerto Omaggio A Beatrice Antonioni
Concerto Omaggio A Beatrice AntonioniConcerto Omaggio A Beatrice Antonioni
Concerto Omaggio A Beatrice AntonioniAngela Amato
 
Popular Music And Teaching Issues Power Point Presentation
Popular Music And Teaching Issues Power Point PresentationPopular Music And Teaching Issues Power Point Presentation
Popular Music And Teaching Issues Power Point PresentationAngela Amato
 
Popular Music And Teaching Issues
Popular Music And Teaching IssuesPopular Music And Teaching Issues
Popular Music And Teaching IssuesAngela Amato
 
Sheila Nelson-Principi Fondamentali Del Metodo Didattico
Sheila Nelson-Principi Fondamentali Del Metodo DidatticoSheila Nelson-Principi Fondamentali Del Metodo Didattico
Sheila Nelson-Principi Fondamentali Del Metodo DidatticoAngela Amato
 
Tesi di Laurea-MA Music
Tesi di Laurea-MA MusicTesi di Laurea-MA Music
Tesi di Laurea-MA MusicAngela Amato
 
Julie Franki Creative Portfolio
Julie Franki Creative PortfolioJulie Franki Creative Portfolio
Julie Franki Creative Portfoliojfranki
 
Presentation Tr Turkish Translation Of Legal Obligations
Presentation Tr Turkish Translation Of Legal ObligationsPresentation Tr Turkish Translation Of Legal Obligations
Presentation Tr Turkish Translation Of Legal Obligationspaul Billinge
 

Viewers also liked (20)

生命經驗傳承 人生經驗比賽
生命經驗傳承 人生經驗比賽生命經驗傳承 人生經驗比賽
生命經驗傳承 人生經驗比賽
 
Winning Customers
Winning CustomersWinning Customers
Winning Customers
 
Apples’ iPhone, iPod touch and iPad Application Programming - CLASS 1
Apples’ iPhone, iPod touch and iPad Application Programming - CLASS 1Apples’ iPhone, iPod touch and iPad Application Programming - CLASS 1
Apples’ iPhone, iPod touch and iPad Application Programming - CLASS 1
 
Mobile Marketing and Social Campaigns
Mobile Marketing and Social CampaignsMobile Marketing and Social Campaigns
Mobile Marketing and Social Campaigns
 
Class 02 Objective C
Class 02   Objective CClass 02   Objective C
Class 02 Objective C
 
Find your true passion and do what you love to do
Find your true passion and do what you love to doFind your true passion and do what you love to do
Find your true passion and do what you love to do
 
Self discipline - Brian Tracy
Self discipline - Brian TracySelf discipline - Brian Tracy
Self discipline - Brian Tracy
 
стратегии международной рекламы
стратегии международной рекламыстратегии международной рекламы
стратегии международной рекламы
 
Mobile marketing & Business
Mobile marketing & Business Mobile marketing & Business
Mobile marketing & Business
 
Concerto Omaggio A Beatrice Antonioni
Concerto Omaggio A Beatrice AntonioniConcerto Omaggio A Beatrice Antonioni
Concerto Omaggio A Beatrice Antonioni
 
Popular Music And Teaching Issues Power Point Presentation
Popular Music And Teaching Issues Power Point PresentationPopular Music And Teaching Issues Power Point Presentation
Popular Music And Teaching Issues Power Point Presentation
 
Popular Music And Teaching Issues
Popular Music And Teaching IssuesPopular Music And Teaching Issues
Popular Music And Teaching Issues
 
Sheila Nelson-Principi Fondamentali Del Metodo Didattico
Sheila Nelson-Principi Fondamentali Del Metodo DidatticoSheila Nelson-Principi Fondamentali Del Metodo Didattico
Sheila Nelson-Principi Fondamentali Del Metodo Didattico
 
Tesi di Laurea-MA Music
Tesi di Laurea-MA MusicTesi di Laurea-MA Music
Tesi di Laurea-MA Music
 
Pptdeck
PptdeckPptdeck
Pptdeck
 
Temere
TemereTemere
Temere
 
Julie Franki Creative Portfolio
Julie Franki Creative PortfolioJulie Franki Creative Portfolio
Julie Franki Creative Portfolio
 
Ebfm Slides 2009
Ebfm Slides 2009Ebfm Slides 2009
Ebfm Slides 2009
 
Presentation Tr Turkish Translation Of Legal Obligations
Presentation Tr Turkish Translation Of Legal ObligationsPresentation Tr Turkish Translation Of Legal Obligations
Presentation Tr Turkish Translation Of Legal Obligations
 
Professional Portfolio Of Mohamed Ebrahim
Professional Portfolio Of Mohamed EbrahimProfessional Portfolio Of Mohamed Ebrahim
Professional Portfolio Of Mohamed Ebrahim
 

Similar to Going on an HTTP Diet: Front-End Web Performance

Client Side Performance @ Xero
Client Side Performance @ XeroClient Side Performance @ Xero
Client Side Performance @ XeroCraig Walker
 
Progressive downloads and rendering (Stoyan Stefanov)
Progressive downloads and rendering (Stoyan Stefanov)Progressive downloads and rendering (Stoyan Stefanov)
Progressive downloads and rendering (Stoyan Stefanov)Ontico
 
Progressive Downloads and Rendering - take #2
Progressive Downloads and Rendering - take #2Progressive Downloads and Rendering - take #2
Progressive Downloads and Rendering - take #2Stoyan Stefanov
 
CTU June 2011 - Things that Every ASP.NET Developer Should Know
CTU June 2011 - Things that Every ASP.NET Developer Should KnowCTU June 2011 - Things that Every ASP.NET Developer Should Know
CTU June 2011 - Things that Every ASP.NET Developer Should KnowSpiffy
 
High Performance Web Pages - 20 new best practices
High Performance Web Pages - 20 new best practicesHigh Performance Web Pages - 20 new best practices
High Performance Web Pages - 20 new best practicesStoyan Stefanov
 
10 Tips to make your Website lightning-fast - SMX Stockholm 2012
10 Tips to make your Website lightning-fast - SMX Stockholm 201210 Tips to make your Website lightning-fast - SMX Stockholm 2012
10 Tips to make your Website lightning-fast - SMX Stockholm 2012Bastian Grimm
 
Developing High Performance Web Apps - CodeMash 2011
Developing High Performance Web Apps - CodeMash 2011Developing High Performance Web Apps - CodeMash 2011
Developing High Performance Web Apps - CodeMash 2011Timothy Fisher
 
Optimization of modern web applications
Optimization of modern web applicationsOptimization of modern web applications
Optimization of modern web applicationsEugene Lazutkin
 
High performance website
High performance websiteHigh performance website
High performance websiteChamnap Chhorn
 
DrupalCampLA 2011 - Drupal frontend-optimizing
DrupalCampLA 2011 - Drupal frontend-optimizingDrupalCampLA 2011 - Drupal frontend-optimizing
DrupalCampLA 2011 - Drupal frontend-optimizingAshok Modi
 
AD113 Speed Up Your Applications w/ Nginx and PageSpeed
AD113  Speed Up Your Applications w/ Nginx and PageSpeedAD113  Speed Up Your Applications w/ Nginx and PageSpeed
AD113 Speed Up Your Applications w/ Nginx and PageSpeededm00se
 
WordPress At Scale. WordCamp Dhaka 2019
WordPress At Scale. WordCamp Dhaka 2019WordPress At Scale. WordCamp Dhaka 2019
WordPress At Scale. WordCamp Dhaka 2019Anam Ahmed
 
Jinx - Malware 2.0
Jinx - Malware 2.0Jinx - Malware 2.0
Jinx - Malware 2.0Itzik Kotler
 
Responsive content
Responsive contentResponsive content
Responsive contenthonzie
 
Html5 shubelal
Html5 shubelalHtml5 shubelal
Html5 shubelalShub
 
Presentation on Instant page speed optimization
Presentation on Instant page speed optimizationPresentation on Instant page speed optimization
Presentation on Instant page speed optimizationSanjeev Kumar Jaiswal
 

Similar to Going on an HTTP Diet: Front-End Web Performance (20)

Client Side Performance @ Xero
Client Side Performance @ XeroClient Side Performance @ Xero
Client Side Performance @ Xero
 
Progressive downloads and rendering (Stoyan Stefanov)
Progressive downloads and rendering (Stoyan Stefanov)Progressive downloads and rendering (Stoyan Stefanov)
Progressive downloads and rendering (Stoyan Stefanov)
 
Progressive Downloads and Rendering - take #2
Progressive Downloads and Rendering - take #2Progressive Downloads and Rendering - take #2
Progressive Downloads and Rendering - take #2
 
High-Speed HTML5
High-Speed HTML5High-Speed HTML5
High-Speed HTML5
 
CTU June 2011 - Things that Every ASP.NET Developer Should Know
CTU June 2011 - Things that Every ASP.NET Developer Should KnowCTU June 2011 - Things that Every ASP.NET Developer Should Know
CTU June 2011 - Things that Every ASP.NET Developer Should Know
 
High Performance Web Pages - 20 new best practices
High Performance Web Pages - 20 new best practicesHigh Performance Web Pages - 20 new best practices
High Performance Web Pages - 20 new best practices
 
10 Tips to make your Website lightning-fast - SMX Stockholm 2012
10 Tips to make your Website lightning-fast - SMX Stockholm 201210 Tips to make your Website lightning-fast - SMX Stockholm 2012
10 Tips to make your Website lightning-fast - SMX Stockholm 2012
 
Developing High Performance Web Apps - CodeMash 2011
Developing High Performance Web Apps - CodeMash 2011Developing High Performance Web Apps - CodeMash 2011
Developing High Performance Web Apps - CodeMash 2011
 
Optimization of modern web applications
Optimization of modern web applicationsOptimization of modern web applications
Optimization of modern web applications
 
High performance website
High performance websiteHigh performance website
High performance website
 
performance.ppt
performance.pptperformance.ppt
performance.ppt
 
DrupalCampLA 2011 - Drupal frontend-optimizing
DrupalCampLA 2011 - Drupal frontend-optimizingDrupalCampLA 2011 - Drupal frontend-optimizing
DrupalCampLA 2011 - Drupal frontend-optimizing
 
AD113 Speed Up Your Applications w/ Nginx and PageSpeed
AD113  Speed Up Your Applications w/ Nginx and PageSpeedAD113  Speed Up Your Applications w/ Nginx and PageSpeed
AD113 Speed Up Your Applications w/ Nginx and PageSpeed
 
WordPress At Scale. WordCamp Dhaka 2019
WordPress At Scale. WordCamp Dhaka 2019WordPress At Scale. WordCamp Dhaka 2019
WordPress At Scale. WordCamp Dhaka 2019
 
[In Control 2010] HTML5
[In Control 2010] HTML5[In Control 2010] HTML5
[In Control 2010] HTML5
 
Jinx - Malware 2.0
Jinx - Malware 2.0Jinx - Malware 2.0
Jinx - Malware 2.0
 
Responsive content
Responsive contentResponsive content
Responsive content
 
Html5 shubelal
Html5 shubelalHtml5 shubelal
Html5 shubelal
 
Codeigniter
CodeigniterCodeigniter
Codeigniter
 
Presentation on Instant page speed optimization
Presentation on Instant page speed optimizationPresentation on Instant page speed optimization
Presentation on Instant page speed optimization
 

Recently uploaded

Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
ChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps ProductivityChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps ProductivityVictorSzoltysek
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxRemote DBA Services
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
Quantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation ComputingQuantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation ComputingWSO2
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
JavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate GuideJavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate GuidePixlogix Infotech
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAnitaRaj43
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...WSO2
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Zilliz
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 

Recently uploaded (20)

Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
ChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps ProductivityChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps Productivity
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Quantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation ComputingQuantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation Computing
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
JavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate GuideJavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate Guide
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by Anitaraj
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 

Going on an HTTP Diet: Front-End Web Performance

  • 1.
  • 2. "Never underestimate the — CEO Eric Schmidt announcing Google Instant in September 2010
  • 3.
  • 4.
  • 5.
  • 6. The Low-Hanging Fruit The 20 / 80 rule
  • 7. I. Serve up lighter files II. Trim back on HTTP III. Keep things a-movin’ (avoid blocking)
  • 10. Image Optimization Images are often >50% of a page’s total weight!
  • 12. Leaner JPEGs: Quality
  • 14. Leaner JPEGs: Metadata
  • 15. Leaner JPEGs: Metadata command line ahoy! > jpegtran -copy none -optimize src.jpg dest.jpg
  • 17. Professional PNGs: bit depth
  • 19. Professional PNGs: 8bit alpha woes? •8bit PNGs CAN have full alpha support! •Use Adobe Fireworks instead •Or run them through pngquant
  • 20. Professional PNGs: PNGQUANT command line ahoy! > pngquant 256 whatever.png
  • 21. Professional PNGs: PNGCRUSH command line ahoy! > pngcrush -rem alla -reduce -brute source.png dest.png
  • 23. animated GIFs are back gifsicle can help
  • 24. Slimmer Text Fil The Rudimentary Approach • class=“whatever” → class=whatever • http://www.utexas.edu/law/whatever.html → /law/whatever.html • <script type=“text/javascript”> → <script> • Use CSS shorthand!
  • 25. Slimmer Text Fil Minify your scripts and other text jquery-1.6.3.js jquery-1.6.3.min.js
  • 26. Slimmer Text Fil Minify your scripts and other text • YUICompressor • Google's Closure Compiler • Dojo ShrinkSafe • Packer • JSMin
  • 27. Slimmer Text Fil Serious bandwidth savings with gzip For Apache 2.x*: <ifModule mod_deflate.c> AddOutputFilterByType DEFLATE text/html text/css application/x-javascript </ifModule> * Note: don’t do this on Web Central…
  • 28. Trim Back on HTTP Requests
  • 29. The Problem with HTTP Requests HTTP/1.1 specifies 2 maximum simultaneous TCP connections Source: HTTP/1.1 specification, RFC 2616 8.1.4 http://www.w3.org/Protocols/rfc2616/rfc2616- sec8.html#sec8
  • 30. The Problem with HTTP Requests HTTP/1.1 specifies 2 maximum simultaneous TCP connections (per domain) Source: HTTP/1.1 specification, RFC 2616 8.1.4 http://www.w3.org/Protocols/rfc2616/rfc2616- sec8.html#sec8
  • 31. HTTP Waterfall IE7 generated with http:// www.webpagetest.org/
  • 32. HTTP Waterfall - Chrome 14
  • 34. Fold print and media query styles
  • 35. Fold print and media query styles <link rel="stylesheet" href="styles.css" /> <link rel="stylesheet" href="print.css" />
  • 36. Fold print and media query styles /* Print styles in styles.css @media print { body { background: #fff; } }
  • 39. use PS: Maybe use CSS opacity to cut down on the number of button states in an image sprite?
  • 42. Data URIs • Prevents the opening of an additional TCP request
  • 43. Data URIs • Prevents the opening of an additional TCP request • Faster download than a separate image request
  • 44. Data URIs • Prevents the opening of an additional TCP request • Faster download than a separate image request • Can be created on the fly in PHP with base64_encode()
  • 45. Data URIs • Prevents the opening of an additional TCP request • Faster download than a separate image request • Can be created on the fly in PHP with base64_encode() • Are only cached if included inside of a stylesheet (not inline)
  • 46. Data URIs • Prevents the opening of an additional TCP request • Faster download than a separate image request • Can be created on the fly in PHP with base64_encode() • Are only cached if included inside of a stylesheet (not inline) • ~30% larger than “real” image files (~2% if gzip is enabled)
  • 47. Data URIs • Prevents the opening of an additional TCP request • Faster download than a separate image request • Can be created on the fly in PHP with base64_encode() • Are only cached if included inside of a stylesheet (not inline) • ~30% larger than “real” image files (~2% if gzip is enabled) • Wide browser support, but no IE 7 or older (and IE8 only supports up to 32KB of data)
  • 48. Cache: Far-Future Expires
  • 49. Cache: Far-Future Expires
  • 50. Cache: Far-Future Expires Stick this in your .htaccess <IfModule mod_expires.c> ExpiresActive on <FilesMatch ".(gif|jpg|png|js|css)$"> ExpiresDefault "access plus 5 years" </FilesMatch> </IfModule>
  • 51. Cache: Far-Future Expires Wait, why are they still seeing that version?!
  • 52. Cache: Far-Future Expires Wait, why are they still seeing that version?! • A good practice, but users might end up with old versions of styles and scripts…
  • 53. Cache: Far-Future Expires Wait, why are they still seeing that version?! • A good practice, but users might end up with old versions of styles and scripts… • To force a fresh download you can rename the file (I hope you’ve got a CMS or build process that makes this easy!)
  • 55. Cache: Disable ETags Another one for your .htaccess FileETag none
  • 56. Cache: Disable ETags Another one for your .htaccess FileETag none Recommended by Microsoft and Apache! http://support.microsoft.com/? id=922733 http://www.apacheweek.com/issues/ 02-0-18
  • 57. Stay in Motion (avoid resource blocking)
  • 58. Blocking (IE7 example)
  • 59. What can cause blocking?
  • 60. What can cause blocking? in • External scripts cause blocking, case of a document.write() and to ensure proper order of execution
  • 61. What can cause blocking? in • External scripts cause blocking, case of a document.write() and to ensure proper order of execution •Inline <script> can hang things up
  • 62. What can cause blocking? in • External scripts cause blocking, case of a document.write() and to ensure proper order of execution •Inline <script> can hang things up •Scripts often don’t execute until stylesheets are finished downloading
  • 63. What can cause blocking? in • External scripts cause blocking, case of a document.write() and to ensure proper order of execution •Inline <script> can hang things up •Scripts often don’t execute until stylesheets are finished downloading •CSS @import causes blocking in older IE
  • 64. What can cause blocking? in • External scripts cause blocking, case of a document.write() and to ensure proper order of execution •Inline <script> can hang things up •Scripts often don’t execute until stylesheets are finished downloading •CSS @import causes blocking in older IE •iframes can block onload from firing
  • 66. How do we get around this?
  • 67. How do we get around this? • Put stylesheets in the <head> using a <link> tag instead of @import
  • 68. How do we get around this? • Put stylesheets in the <head> using a <link> tag instead of @import • Put your scripts as close to the </body> tag as possible (in most circumstances)
  • 69. How do we get around this? • Put stylesheets in the <head> using a <link> tag instead of @import • Put your scripts as close to the </body> tag as possible (in most circumstances) • Use a script loader like LabJS or HeadJS
  • 70. How do we get around this? • Put stylesheets in the <head> using a <link> tag instead of @import • Put your scripts as close to the </body> tag as possible (in most circumstances) • Use a script loader like LabJS or HeadJS • Use non-blocking script insertion techniques like XHR Injection **
  • 71. Asynchronous Script Insertion (function () { var ga = document.createElement('script'), s = document.getElementsByTagName('script')[0]; ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' === document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; s.parentNode.insertBefore(ga, s); }());
  • 73. Forward-looking approaches • <script defer> (wide browser support, but execution order?)
  • 74. Forward-looking approaches • <script defer> (wide browser support, but execution order?) • <script async> (HTML5, widening support, but no IE)
  • 75. Forward-looking approaches • <script defer> (wide browser support, but execution order?) • <script async> (HTML5, widening support, but no IE) • Web Workers (Multi-threaded JS processing! But no IE…)
  • 76. DEMO YSlow PageSpeed

Editor's Notes

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n
  39. \n
  40. \n
  41. \n
  42. \n
  43. \n
  44. \n
  45. \n
  46. \n
  47. \n
  48. \n
  49. \n
  50. \n
  51. \n
  52. \n
  53. \n
  54. \n
  55. \n
  56. \n
  57. \n
  58. \n
  59. \n
  60. \n
  61. \n
  62. \n
  63. \n
  64. \n
  65. \n
  66. \n
  67. \n