SlideShare a Scribd company logo
October 27, 2011

Deep Dive Frontend
      Optimization
              Jonathan Klein
              @jonathanklein
        www.jonathanklein.net
Agenda
  Who I am
  Why Frontend Performance?
  Reducing HTTP Requests
  CSS
    Automation
  Images
    Automation
  Monitoring Performance
Who is this Guy?

• Senior Software Engineer/Performance Guy at Wayfair

• Organizer - Boston Web Performance Meetup Group

• Organizer - #WPOChat (monthly Twitter chat)




• Wayfair Stats:
   1.   ~1400 requests/sec for static content
   2.   ~400 requests/sec for dynamic content
   3.   ~10 million unique visitors per month
   4.   On a typical Monday we serve 75,000,000 static files



                                                               3
Why Frontend Performance?
Focusing on Frontend Performance…

• Reduces Requests to Backend

• Reduces Bandwidth Usage

• Makes Site Faster (oh right!)
  1. 80-90% of load time takes place on the client
  2. For Mobile  97%




                                                     5
Reducing HTTP Requests




  Reducing HTTP requests is the #1
    thing you can do to improve
            performance




                                     6
So How Do We Do It?
CSS




      Only Serve ONE CSS file on each page*




            *Okay, there are always exceptions



                                                 9
AUTOMATE!
Automation Techniques

1. Specify what files you want on the page
   •    $css_files = array(‘foo’, ‘bar’, ‘baz’);


2. Build URL in code
   •   http://some.image.domain/combine/foo-bar-baz.css



3. Rewrite the URL when request arrives
   •   http://some.image.domain/scripts/combine.php?files=foo-bar-baz&type=css



4. Combine on the server
   •   Cache in memory (APC)




                                                                                 11
More CSS Tips

1. Put CSS Files at the top

2. Minify (remove comments and whitespace)
   1. http://developer.yahoo.com/yui/compressor/



3. Gzip

4. Yeah, automate these as well




                                                   12
Images
Start By Eliminating Them

• Use Sprites:




       .classname {
           background: url(sprite.png) no-repeat 0 -432px;
       }



                                                             14
Can also use dataURIs

• Base64 Encoded String
     1. http://www.nczonline.net/blog/2009/10/27/data-uris-explained/
     2. NO SUPPORT in IE < 8 (use MHTML)
         • http://www.phpied.com/inline-mhtml-data-uris/

• No request at all

• This…

• Turns into this:
•   data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAANCAMAAABFNRROAAADAFBMVEVVJD5pLk2EOF+HZ3q0n6rLusPt5+ry6
    fL///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAZcu0MAAAAOElEQVQI15XNMQ4AIAhDUSqivf+J
    hahBExf/9tKhIncle8lSANgV0RJZy5a4aFNebHnCpselQX4bYBYA4TNfSuwAAAAASUVORK5CYII=




                                                                                                                  15
Automation

function encode_image($image_path) {
        $base64_string = apc_fetch($image_path);

       if (empty($base64_string)) {
                $image_data = file_get_contents($image_path);
                $base64_string = base64_encode($image_data);
                apc_store($image_path, $base64_string);
       }

       return $base64_string;
}




                                                                17
Smush Your Images!

• Lossless Image Compression:
  1. http://www.smushit.com/ysmush.it/




• Lossy Image Compression
  1. 90% JPEG vs. 100% JPEG - You can’t tell the difference




                                                              18
BEFORE

977KB
AFTER

385KB
Monitoring and Testing
Measuring and Monitoring

  •   Google Webmaster Tools
  •   WebPagetest (www.webpagetest.org)
  •   Yottaa.com
  •   Firebug
  •   YSlow
  •   PageSpeed
  •   Dynatrace Ajax Edition




                                          22
Measuring and Monitoring

  •   Google Webmaster Tools
  •   WebPagetest (www.webpagetest.org)
  •   Yottaa.com
  •   Firebug
  •   YSlow
  •   PageSpeed
  •   Dynatrace Ajax Edition




                                          23
http://blog.patrickmeenan.com/2011/10/testing-for-frontend-spof.html
Resources

• http://www.webperformancecentral.com/wiki/WebPagetes
  t/Optimization_Help

• http://developer.yahoo.com/performance/

• http://code.google.com/speed/

• High Performance Websites (Book)

• Even Faster Websites (Book)



                                                         29
Questions?



             We’re Hiring!
        www.wayfair.com/careers

              Get In Touch:
www.meetup.com/Web-Performance-Boston/
          jklein@wayfair.com
            @jonathanklein




                                         30

More Related Content

What's hot

Progressive Downloads and Rendering - take #2
Progressive Downloads and Rendering - take #2Progressive Downloads and Rendering - take #2
Progressive Downloads and Rendering - take #2
Stoyan Stefanov
 
PHPDay 2013 - High Performance PHP
PHPDay 2013 - High Performance PHPPHPDay 2013 - High Performance PHP
PHPDay 2013 - High Performance PHP
Jonathan Klein
 
Front end performance tip
Front end performance tipFront end performance tip
Front end performance tip
Steve Yu
 
2013 10-02-html5-performance-aarhus
2013 10-02-html5-performance-aarhus2013 10-02-html5-performance-aarhus
2013 10-02-html5-performance-aarhus
SC5.io
 
Theming Wordpress with Adobe
Theming Wordpress with AdobeTheming Wordpress with Adobe
Theming Wordpress with Adobe
Grace Solivan
 
Are Today’s Good Practices… Tomorrow’s Performance Anti-Patterns?
Are Today’s Good Practices… Tomorrow’s Performance Anti-Patterns?Are Today’s Good Practices… Tomorrow’s Performance Anti-Patterns?
Are Today’s Good Practices… Tomorrow’s Performance Anti-Patterns?
Andy Davies
 
Optimizing wp
Optimizing wpOptimizing wp
Optimizing wp
Mark Kelnar
 
Front end performance optimization
Front end performance optimizationFront end performance optimization
Front end performance optimization
Stevie T
 
WordPress Performance 101
WordPress Performance 101WordPress Performance 101
WordPress Performance 101
Bora Yalcin
 
Faster web pages
Faster web pagesFaster web pages
Faster web pages
David Rodenas
 
HTML5 and CSS3 Techniques You Can Use Today
HTML5 and CSS3 Techniques You Can Use TodayHTML5 and CSS3 Techniques You Can Use Today
HTML5 and CSS3 Techniques You Can Use Today
Todd Anglin
 
BDUG Responsive Web Theming - 7/23/12
BDUG Responsive Web Theming - 7/23/12BDUG Responsive Web Theming - 7/23/12
BDUG Responsive Web Theming - 7/23/12
ucbdrupal
 
Pinkoi Platform
Pinkoi PlatformPinkoi Platform
Pinkoi Platform
mikeleeme
 
Performance.now() fast but not furious
Performance.now()   fast but not furiousPerformance.now()   fast but not furious
Performance.now() fast but not furious
Anna Migas
 
Page Performance
Page PerformancePage Performance
Page Performance
atorreno
 
WordPress Optimization - WordCampLA 09-10-11
WordPress Optimization - WordCampLA 09-10-11WordPress Optimization - WordCampLA 09-10-11
WordPress Optimization - WordCampLA 09-10-11
Justin Dorfman
 
Pagespeed what, why, and how it works
Pagespeed   what, why, and how it worksPagespeed   what, why, and how it works
Pagespeed what, why, and how it worksIlya Grigorik
 
Make JavaScript Faster
Make JavaScript FasterMake JavaScript Faster
Make JavaScript Faster
Steve Souders
 
WordCamp Sheffield 2014 Theme Workflow Presentation
WordCamp Sheffield 2014 Theme Workflow PresentationWordCamp Sheffield 2014 Theme Workflow Presentation
WordCamp Sheffield 2014 Theme Workflow Presentation
Jonny Allbut
 
Making the web faster
Making the web fasterMaking the web faster
Making the web faster
Patrick Meenan
 

What's hot (20)

Progressive Downloads and Rendering - take #2
Progressive Downloads and Rendering - take #2Progressive Downloads and Rendering - take #2
Progressive Downloads and Rendering - take #2
 
PHPDay 2013 - High Performance PHP
PHPDay 2013 - High Performance PHPPHPDay 2013 - High Performance PHP
PHPDay 2013 - High Performance PHP
 
Front end performance tip
Front end performance tipFront end performance tip
Front end performance tip
 
2013 10-02-html5-performance-aarhus
2013 10-02-html5-performance-aarhus2013 10-02-html5-performance-aarhus
2013 10-02-html5-performance-aarhus
 
Theming Wordpress with Adobe
Theming Wordpress with AdobeTheming Wordpress with Adobe
Theming Wordpress with Adobe
 
Are Today’s Good Practices… Tomorrow’s Performance Anti-Patterns?
Are Today’s Good Practices… Tomorrow’s Performance Anti-Patterns?Are Today’s Good Practices… Tomorrow’s Performance Anti-Patterns?
Are Today’s Good Practices… Tomorrow’s Performance Anti-Patterns?
 
Optimizing wp
Optimizing wpOptimizing wp
Optimizing wp
 
Front end performance optimization
Front end performance optimizationFront end performance optimization
Front end performance optimization
 
WordPress Performance 101
WordPress Performance 101WordPress Performance 101
WordPress Performance 101
 
Faster web pages
Faster web pagesFaster web pages
Faster web pages
 
HTML5 and CSS3 Techniques You Can Use Today
HTML5 and CSS3 Techniques You Can Use TodayHTML5 and CSS3 Techniques You Can Use Today
HTML5 and CSS3 Techniques You Can Use Today
 
BDUG Responsive Web Theming - 7/23/12
BDUG Responsive Web Theming - 7/23/12BDUG Responsive Web Theming - 7/23/12
BDUG Responsive Web Theming - 7/23/12
 
Pinkoi Platform
Pinkoi PlatformPinkoi Platform
Pinkoi Platform
 
Performance.now() fast but not furious
Performance.now()   fast but not furiousPerformance.now()   fast but not furious
Performance.now() fast but not furious
 
Page Performance
Page PerformancePage Performance
Page Performance
 
WordPress Optimization - WordCampLA 09-10-11
WordPress Optimization - WordCampLA 09-10-11WordPress Optimization - WordCampLA 09-10-11
WordPress Optimization - WordCampLA 09-10-11
 
Pagespeed what, why, and how it works
Pagespeed   what, why, and how it worksPagespeed   what, why, and how it works
Pagespeed what, why, and how it works
 
Make JavaScript Faster
Make JavaScript FasterMake JavaScript Faster
Make JavaScript Faster
 
WordCamp Sheffield 2014 Theme Workflow Presentation
WordCamp Sheffield 2014 Theme Workflow PresentationWordCamp Sheffield 2014 Theme Workflow Presentation
WordCamp Sheffield 2014 Theme Workflow Presentation
 
Making the web faster
Making the web fasterMaking the web faster
Making the web faster
 

Viewers also liked

UXFest - RUM Distillation 101
UXFest - RUM Distillation 101UXFest - RUM Distillation 101
UXFest - RUM Distillation 101
Jonathan Klein
 
Riding rails for 10 years
Riding rails for 10 yearsRiding rails for 10 years
Riding rails for 10 yearsjduff
 
Edge Conf Rendering Performance Panel
Edge Conf Rendering Performance PanelEdge Conf Rendering Performance Panel
Edge Conf Rendering Performance Panel
Jonathan Klein
 
JSDay 2013 - Practical Responsive Web Design
JSDay 2013 - Practical Responsive Web DesignJSDay 2013 - Practical Responsive Web Design
JSDay 2013 - Practical Responsive Web Design
Jonathan Klein
 
DIY Synthetic: Private WebPagetest Magic
DIY Synthetic: Private WebPagetest MagicDIY Synthetic: Private WebPagetest Magic
DIY Synthetic: Private WebPagetest Magic
Jonathan Klein
 
PHP On Steroids
PHP On SteroidsPHP On Steroids
PHP On Steroids
Jonathan Oxer
 
BTV PHP - Building Fast Websites
BTV PHP - Building Fast WebsitesBTV PHP - Building Fast Websites
BTV PHP - Building Fast Websites
Jonathan Klein
 
Northeast PHP - High Performance PHP
Northeast PHP - High Performance PHPNortheast PHP - High Performance PHP
Northeast PHP - High Performance PHP
Jonathan Klein
 
Integrating React.js with PHP projects
Integrating React.js with PHP projectsIntegrating React.js with PHP projects
Integrating React.js with PHP projects
Ignacio Martín
 
PHP UK 2017 - Don't Lose Sleep - Secure Your REST
PHP UK 2017 - Don't Lose Sleep - Secure Your RESTPHP UK 2017 - Don't Lose Sleep - Secure Your REST
PHP UK 2017 - Don't Lose Sleep - Secure Your REST
Adam Englander
 
How Slow Load Times Hurt Your Bottom Line (And 17 Things You Can Do to Fix It)
How Slow Load Times Hurt Your Bottom Line (And 17 Things You Can Do to Fix It)How Slow Load Times Hurt Your Bottom Line (And 17 Things You Can Do to Fix It)
How Slow Load Times Hurt Your Bottom Line (And 17 Things You Can Do to Fix It)
Tammy Everts
 
How Shopify Scales Rails
How Shopify Scales RailsHow Shopify Scales Rails
How Shopify Scales Railsjduff
 
Improving PHP Application Performance with APC
Improving PHP Application Performance with APCImproving PHP Application Performance with APC
Improving PHP Application Performance with APC
vortexau
 

Viewers also liked (13)

UXFest - RUM Distillation 101
UXFest - RUM Distillation 101UXFest - RUM Distillation 101
UXFest - RUM Distillation 101
 
Riding rails for 10 years
Riding rails for 10 yearsRiding rails for 10 years
Riding rails for 10 years
 
Edge Conf Rendering Performance Panel
Edge Conf Rendering Performance PanelEdge Conf Rendering Performance Panel
Edge Conf Rendering Performance Panel
 
JSDay 2013 - Practical Responsive Web Design
JSDay 2013 - Practical Responsive Web DesignJSDay 2013 - Practical Responsive Web Design
JSDay 2013 - Practical Responsive Web Design
 
DIY Synthetic: Private WebPagetest Magic
DIY Synthetic: Private WebPagetest MagicDIY Synthetic: Private WebPagetest Magic
DIY Synthetic: Private WebPagetest Magic
 
PHP On Steroids
PHP On SteroidsPHP On Steroids
PHP On Steroids
 
BTV PHP - Building Fast Websites
BTV PHP - Building Fast WebsitesBTV PHP - Building Fast Websites
BTV PHP - Building Fast Websites
 
Northeast PHP - High Performance PHP
Northeast PHP - High Performance PHPNortheast PHP - High Performance PHP
Northeast PHP - High Performance PHP
 
Integrating React.js with PHP projects
Integrating React.js with PHP projectsIntegrating React.js with PHP projects
Integrating React.js with PHP projects
 
PHP UK 2017 - Don't Lose Sleep - Secure Your REST
PHP UK 2017 - Don't Lose Sleep - Secure Your RESTPHP UK 2017 - Don't Lose Sleep - Secure Your REST
PHP UK 2017 - Don't Lose Sleep - Secure Your REST
 
How Slow Load Times Hurt Your Bottom Line (And 17 Things You Can Do to Fix It)
How Slow Load Times Hurt Your Bottom Line (And 17 Things You Can Do to Fix It)How Slow Load Times Hurt Your Bottom Line (And 17 Things You Can Do to Fix It)
How Slow Load Times Hurt Your Bottom Line (And 17 Things You Can Do to Fix It)
 
How Shopify Scales Rails
How Shopify Scales RailsHow Shopify Scales Rails
How Shopify Scales Rails
 
Improving PHP Application Performance with APC
Improving PHP Application Performance with APCImproving PHP Application Performance with APC
Improving PHP Application Performance with APC
 

Similar to EscConf - Deep Dive Frontend Optimization

Cvcc performance tuning
Cvcc performance tuningCvcc performance tuning
Cvcc performance tuning
John McCaffrey
 
Rails Performance Tricks and Treats
Rails Performance Tricks and TreatsRails Performance Tricks and Treats
Rails Performance Tricks and TreatsMarshall Yount
 
20 tips for website performance
20 tips for website performance20 tips for website performance
20 tips for website performance
Andrew Siemer
 
10 Things You Can Do to Speed Up Your Web App Today
10 Things You Can Do to Speed Up Your Web App Today10 Things You Can Do to Speed Up Your Web App Today
10 Things You Can Do to Speed Up Your Web App Today
Chris Love
 
Windycityrails page performance
Windycityrails page performanceWindycityrails page performance
Windycityrails page performance
John McCaffrey
 
performance.ppt
performance.pptperformance.ppt
performance.ppt
fakeaccount225095
 
GDD Japan 2009 - Designing OpenSocial Apps For Speed and Scale
GDD Japan 2009 - Designing OpenSocial Apps For Speed and ScaleGDD Japan 2009 - Designing OpenSocial Apps For Speed and Scale
GDD Japan 2009 - Designing OpenSocial Apps For Speed and Scale
Patrick Chanezon
 
Web Performance Optimization (WPO)
Web Performance Optimization (WPO)Web Performance Optimization (WPO)
Web Performance Optimization (WPO)
Betclic Everest Group Tech Team
 
Does This Theme Make My Website Look Fat? (Wordcamp SLC 2013)
Does This Theme Make My Website Look Fat? (Wordcamp SLC 2013)Does This Theme Make My Website Look Fat? (Wordcamp SLC 2013)
Does This Theme Make My Website Look Fat? (Wordcamp SLC 2013)
Adam Dunford
 
腾讯大讲堂09 如何建设高性能网站
腾讯大讲堂09 如何建设高性能网站腾讯大讲堂09 如何建设高性能网站
腾讯大讲堂09 如何建设高性能网站George Ang
 
CSS and image optimization
CSS and image optimizationCSS and image optimization
CSS and image optimization
Stoyan Stefanov
 
Extreme Web Performance for Mobile Devices
Extreme Web Performance for Mobile DevicesExtreme Web Performance for Mobile Devices
Extreme Web Performance for Mobile Devices
Maximiliano Firtman
 
Hardcode SEO
Hardcode SEOHardcode SEO
Hardcode SEO
Michel Ozzello
 
Mobile Web Speed Bumps
Mobile Web Speed BumpsMobile Web Speed Bumps
Mobile Web Speed Bumps
Nicholas Zakas
 
腾讯大讲堂09 如何建设高性能网站
腾讯大讲堂09 如何建设高性能网站腾讯大讲堂09 如何建设高性能网站
腾讯大讲堂09 如何建设高性能网站areyouok
 
腾讯大讲堂09 如何建设高性能网站
腾讯大讲堂09 如何建设高性能网站腾讯大讲堂09 如何建设高性能网站
腾讯大讲堂09 如何建设高性能网站
topgeek
 
Web Performance Optimization
Web Performance OptimizationWeb Performance Optimization
Web Performance Optimization
Patrick Meenan
 
Why your slow loading website is costing you sales and how to fix it
Why your slow loading website is costing you sales and how to fix itWhy your slow loading website is costing you sales and how to fix it
Why your slow loading website is costing you sales and how to fix it
Robert Flournoy
 
Why your slow loading website is costing you sales and how to fix it
Why your slow loading website is costing you sales and how to fix itWhy your slow loading website is costing you sales and how to fix it
Why your slow loading website is costing you sales and how to fix it
strommen
 
A web perf dashboard up & running in 90 minutes presentation
A web perf dashboard up & running in 90 minutes presentationA web perf dashboard up & running in 90 minutes presentation
A web perf dashboard up & running in 90 minutes presentation
Justin Dorfman
 

Similar to EscConf - Deep Dive Frontend Optimization (20)

Cvcc performance tuning
Cvcc performance tuningCvcc performance tuning
Cvcc performance tuning
 
Rails Performance Tricks and Treats
Rails Performance Tricks and TreatsRails Performance Tricks and Treats
Rails Performance Tricks and Treats
 
20 tips for website performance
20 tips for website performance20 tips for website performance
20 tips for website performance
 
10 Things You Can Do to Speed Up Your Web App Today
10 Things You Can Do to Speed Up Your Web App Today10 Things You Can Do to Speed Up Your Web App Today
10 Things You Can Do to Speed Up Your Web App Today
 
Windycityrails page performance
Windycityrails page performanceWindycityrails page performance
Windycityrails page performance
 
performance.ppt
performance.pptperformance.ppt
performance.ppt
 
GDD Japan 2009 - Designing OpenSocial Apps For Speed and Scale
GDD Japan 2009 - Designing OpenSocial Apps For Speed and ScaleGDD Japan 2009 - Designing OpenSocial Apps For Speed and Scale
GDD Japan 2009 - Designing OpenSocial Apps For Speed and Scale
 
Web Performance Optimization (WPO)
Web Performance Optimization (WPO)Web Performance Optimization (WPO)
Web Performance Optimization (WPO)
 
Does This Theme Make My Website Look Fat? (Wordcamp SLC 2013)
Does This Theme Make My Website Look Fat? (Wordcamp SLC 2013)Does This Theme Make My Website Look Fat? (Wordcamp SLC 2013)
Does This Theme Make My Website Look Fat? (Wordcamp SLC 2013)
 
腾讯大讲堂09 如何建设高性能网站
腾讯大讲堂09 如何建设高性能网站腾讯大讲堂09 如何建设高性能网站
腾讯大讲堂09 如何建设高性能网站
 
CSS and image optimization
CSS and image optimizationCSS and image optimization
CSS and image optimization
 
Extreme Web Performance for Mobile Devices
Extreme Web Performance for Mobile DevicesExtreme Web Performance for Mobile Devices
Extreme Web Performance for Mobile Devices
 
Hardcode SEO
Hardcode SEOHardcode SEO
Hardcode SEO
 
Mobile Web Speed Bumps
Mobile Web Speed BumpsMobile Web Speed Bumps
Mobile Web Speed Bumps
 
腾讯大讲堂09 如何建设高性能网站
腾讯大讲堂09 如何建设高性能网站腾讯大讲堂09 如何建设高性能网站
腾讯大讲堂09 如何建设高性能网站
 
腾讯大讲堂09 如何建设高性能网站
腾讯大讲堂09 如何建设高性能网站腾讯大讲堂09 如何建设高性能网站
腾讯大讲堂09 如何建设高性能网站
 
Web Performance Optimization
Web Performance OptimizationWeb Performance Optimization
Web Performance Optimization
 
Why your slow loading website is costing you sales and how to fix it
Why your slow loading website is costing you sales and how to fix itWhy your slow loading website is costing you sales and how to fix it
Why your slow loading website is costing you sales and how to fix it
 
Why your slow loading website is costing you sales and how to fix it
Why your slow loading website is costing you sales and how to fix itWhy your slow loading website is costing you sales and how to fix it
Why your slow loading website is costing you sales and how to fix it
 
A web perf dashboard up & running in 90 minutes presentation
A web perf dashboard up & running in 90 minutes presentationA web perf dashboard up & running in 90 minutes presentation
A web perf dashboard up & running in 90 minutes presentation
 

Recently uploaded

To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Product School
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
Product School
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
Bhaskar Mitra
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Elena Simperl
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 

Recently uploaded (20)

To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 

EscConf - Deep Dive Frontend Optimization

  • 1. October 27, 2011 Deep Dive Frontend Optimization Jonathan Klein @jonathanklein www.jonathanklein.net
  • 2. Agenda Who I am Why Frontend Performance? Reducing HTTP Requests CSS  Automation Images  Automation Monitoring Performance
  • 3. Who is this Guy? • Senior Software Engineer/Performance Guy at Wayfair • Organizer - Boston Web Performance Meetup Group • Organizer - #WPOChat (monthly Twitter chat) • Wayfair Stats: 1. ~1400 requests/sec for static content 2. ~400 requests/sec for dynamic content 3. ~10 million unique visitors per month 4. On a typical Monday we serve 75,000,000 static files 3
  • 5. Focusing on Frontend Performance… • Reduces Requests to Backend • Reduces Bandwidth Usage • Makes Site Faster (oh right!) 1. 80-90% of load time takes place on the client 2. For Mobile  97% 5
  • 6. Reducing HTTP Requests Reducing HTTP requests is the #1 thing you can do to improve performance 6
  • 7.
  • 8. So How Do We Do It?
  • 9. CSS Only Serve ONE CSS file on each page* *Okay, there are always exceptions 9
  • 11. Automation Techniques 1. Specify what files you want on the page • $css_files = array(‘foo’, ‘bar’, ‘baz’); 2. Build URL in code • http://some.image.domain/combine/foo-bar-baz.css 3. Rewrite the URL when request arrives • http://some.image.domain/scripts/combine.php?files=foo-bar-baz&type=css 4. Combine on the server • Cache in memory (APC) 11
  • 12. More CSS Tips 1. Put CSS Files at the top 2. Minify (remove comments and whitespace) 1. http://developer.yahoo.com/yui/compressor/ 3. Gzip 4. Yeah, automate these as well 12
  • 14. Start By Eliminating Them • Use Sprites: .classname { background: url(sprite.png) no-repeat 0 -432px; } 14
  • 15. Can also use dataURIs • Base64 Encoded String 1. http://www.nczonline.net/blog/2009/10/27/data-uris-explained/ 2. NO SUPPORT in IE < 8 (use MHTML) • http://www.phpied.com/inline-mhtml-data-uris/ • No request at all • This… • Turns into this: • data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAANCAMAAABFNRROAAADAFBMVEVVJD5pLk2EOF+HZ3q0n6rLusPt5+ry6 fL///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAZcu0MAAAAOElEQVQI15XNMQ4AIAhDUSqivf+J hahBExf/9tKhIncle8lSANgV0RJZy5a4aFNebHnCpselQX4bYBYA4TNfSuwAAAAASUVORK5CYII= 15
  • 16.
  • 17. Automation function encode_image($image_path) { $base64_string = apc_fetch($image_path); if (empty($base64_string)) { $image_data = file_get_contents($image_path); $base64_string = base64_encode($image_data); apc_store($image_path, $base64_string); } return $base64_string; } 17
  • 18. Smush Your Images! • Lossless Image Compression: 1. http://www.smushit.com/ysmush.it/ • Lossy Image Compression 1. 90% JPEG vs. 100% JPEG - You can’t tell the difference 18
  • 22. Measuring and Monitoring • Google Webmaster Tools • WebPagetest (www.webpagetest.org) • Yottaa.com • Firebug • YSlow • PageSpeed • Dynatrace Ajax Edition 22
  • 23. Measuring and Monitoring • Google Webmaster Tools • WebPagetest (www.webpagetest.org) • Yottaa.com • Firebug • YSlow • PageSpeed • Dynatrace Ajax Edition 23
  • 24.
  • 25.
  • 26.
  • 27.
  • 29. Resources • http://www.webperformancecentral.com/wiki/WebPagetes t/Optimization_Help • http://developer.yahoo.com/performance/ • http://code.google.com/speed/ • High Performance Websites (Book) • Even Faster Websites (Book) 29
  • 30. Questions? We’re Hiring! www.wayfair.com/careers Get In Touch: www.meetup.com/Web-Performance-Boston/ jklein@wayfair.com @jonathanklein 30

Editor's Notes

  1. Can do more with less hardware, saves you money. Saves you money on bandwidth as well. Since your site is faster you make more money.
  2. Can do more with less hardware, saves you money. Saves you money on bandwidth as well. Since your site is faster you make more money.
  3. This is a way to do automatic spriting – base64 encode the images