SlideShare ist ein Scribd-Unternehmen logo
1 von 39
Downloaden Sie, um offline zu lesen
Part II: Front
                End
             Performance



Konstantin
Käfer
What’s Performance?


                  Loading


     Perception             Measurement


                  Running


2                                     Konstantin Käfer
Styles, scripts and images
            account for
     over 80% of load time.


3                          Konstantin Käfer
Back-             Other
              Images
    grounds            Media



     HTML      CSS     Scripts




4                                Konstantin Käfer
Distribution (time)

                                              Images
     HTML


                                     Back-
                CSS       Scripts               +
                                    grounds    Media


            Time spent generating
              the page in Drupal




5                                                Konstantin Käfer
1   Introduction ✔

    2   Tools & Measurement

    3   Speed optimization

    4   Beyond YSlow


6                             Konstantin Käfer
Measure to prove
    optimization success.



7                           Konstantin Käfer
Overall load time?



8                        Konstantin Käfer
Page size?



9                Konstantin Käfer
Time until DOM is loaded?



10                           Konstantin Käfer
Time until page is rendered?



11                             Konstantin Käfer
Time until page
      is functional?



12                     Konstantin Käfer
Firebug’s Net panel




13                         Konstantin Käfer
YSlow
         Rates a webpage based on 13 criteria
     ‣

         Determines overall load time
     ‣

         Provides optimization suggestions
     ‣

         Graphs, Numbers & Figures
     ‣




14                                              Konstantin Käfer
YSlow is not everything.



15                              Konstantin Käfer
Other tools
         AOL Page Test
     ‣
         online version: http://webpagetest.org

         IBM Page Detailer
     ‣
         http://www.alphaworks.ibm.com/tech/pagedetailer

         Pingdom
     ‣
         http://tools.pingdom.com

         WebKit’s Web Inspector
     ‣
         Safari 4 Beta or WebKit nightly from http://webkit.org

         Web Debugging Proxies
     ‣
         http://charlesproxy.com, http://fiddlertool.com
16                                                           Konstantin Käfer
Waterfall diagrams




     Start   Connect   First byte   Last byte
17                                     Konstantin Käfer
1   Introduction ✔

     2   Tools & Measurement ✔

     3   Speed optimization

     4   Beyond YSlow


18                               Konstantin Käfer
1. Reduce requests
         Every file produces an HTTP request
     ‣

          60s

          45s

                                           Requests
          30s
                                           Size
          15s

           0s
                0   10     20     30


         Fewer requests is better than smaller size
     ‣

         HTTP 1.1: 2 components per host in parallel
     ‣
19                                                     Konstantin Käfer
1. Reduce requests
         Sprites
     ‣

         – Many images into one file
         – Shift into view with background-position

         Aggregate scripts and styles
     ‣

         – Built into Drupal
         – Sophisticated: http://drupal.org/project/sf_cache

         No redirects
     ‣


20                                                             Konstantin Käfer
1. Reduce requests
         Caching (see 3.)
     ‣

         Use CSS instead of images
     ‣

             -moz-border-radius:4px;
             -webkit-border-radius: 4px;
             border-radius: 4px;

         data: URLs in style sheets
     ‣

         –    url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAIAAAAC64paAAAAGXRFWHRTb2Z
             0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAR9JREFUeNrEk02ORUAUhRVNJEgYsgdGbIHFsSGmhhjZAzFCR
             CLx906io3UROu8N+g7vPR9V95wi67oy79bXuTXP8zAMfdP48jzvCRJoihyHPcA4xRd1+V5HoZhmqZ1XWuaZ
             tu267qWZSmKQghhKGCrZVmqqgqCQNd16g/ooI8pNOuhfuC2bX3fFwTh8nroYwrNBTxNUxzHhmHcrAf/hwb
             KHWa3ATYURVFRFDdwWZbYBZR75xvGbpMkefQmyzIoaRiuNE3zCGP/UNIw/FRV9RGGBkoaRhLg5yPsOA6U
             tM/vbfuXz0jCjc+YXvu8JwxJOCcMJ9oShtgfYXJ8VedsY0O4p+d5pmnKssyy7PGj5Pwk//6qyCfvmWU+qP+DXw
             IMADReKA+zC0X8AAAAAElFTkSuQmCC);



21                                                                                         Konstantin Käfer
2. Use a CDN
         Content Delivery Network
     ‣

         Lots of servers scattered around the world
     ‣

         Reduces roundtrip times (ping)
     ‣

         Comparably cheap: $0.07 - $0.80 per GB
     ‣

         –   http://www.simplecdn.com
         –   http://pantherexpress.com
         –   http://cachefly.com
         –   http://aws.amazon.com/cloudfront
         –   http://www.limelightnetworks.com
         –   http://www.akamai.com
22                                                    Konstantin Käfer
Round Trip Time
         HTTP is usually done over TCP/IP
     ‣

         Transmission Control Protocol
     ‣

         Stateful: Three Way Handshakes
     ‣

         Round trip time has high effect
     ‣




23                                          Konstantin Käfer
3. Caching
         Controlled by HTTP headers
     ‣

         Browsers check whether content is fresh
     ‣

         Set Expires header to a date in the far future
     ‣

         Change filenames/URLs when updating
     ‣




24                                                   Konstantin Käfer
4. GZip
         Compress text content (don’t use for images!)
     ‣

         Vastly reduces page size
     ‣

         NowPublic.com: 700 KB ➔ 300 KB
     ‣

         Compress scripts and styles as well
     ‣




25                                                  Konstantin Käfer
5. CSS to the top
         == in <head>
     ‣

         Page renders when all header CSS is loaded
     ‣

         Loading CSS later causes re-rendering and
     ‣
         Flash of Unstyled Content




26                                                    Konstantin Käfer
== right before </body>
     ‣

         Loading scripts blocks page rendering
     ‣

         Scripts are loaded sequentially!
     ‣
         (At least in most current browsers)

         Don’t use onfoo handlers in HTML code
     ‣

         Graceful degradation
     ‣



     6. Scripts to the bottom
27                                               Konstantin Käfer
7. Minify CSS and JS
         Remove comments and whitespace
     ‣

         Still savings, even with GZip
     ‣

         Drupal’s aggregator or sf_cache.module
     ‣




28                                                Konstantin Käfer
1   Introduction ✔

     2   Tools & Measurement ✔

     3   Speed optimization ✔

     4   Beyond YSlow


29                               Konstantin Käfer
8. Parallelization
         RFC: 2 requests per host name in parallel
     ‣

         Use multiple host names ➔ higher
     ‣
         parallelization
         (Don’t overdo it)

         Most current browsers use > 2 connections
     ‣

         http://stevesouders.com/ua/
     ‣




30                                                   Konstantin Käfer
HTTP connections
         “A single-user client SHOULD NOT maintain
     ‣
         more than 2 connections with any server
         or proxy.” (RFC 2616, 8.1.4)




                   1    2    3    4    5
31                                            Konstantin Käfer
9. Reduce image weight
         OptiPNG, PNGCrush, ...
     ‣

         – Removes invisible content
         – Lossless recompression

         JPEGtran/ImageMagick
     ‣

         – Remove color profiles, meta data, ...
         – Lossless JPEG operations

         http://smushit.com
     ‣


32                                                 Konstantin Käfer
10. Persistent HTTP
         HTTP supports persistent connections
     ‣

             multiple connections      persistent connection
                          server       client       server
                 client
                                    open
         open


         close
         open




                                                             time
         close
         open
                                    close


         close



33                                                                  Konstantin Käfer
10. Persistent HTTP
         AOL Pagetest has connection view
     ‣




34                                          Konstantin Käfer
10. Persistent HTTP
                    no pipelining              pipelining
                                                        server
                             server       client
                 client
                                      open
          open




                                                                 time
                                      close
          close




         Most web browsers don’t support it
     ‣
35                                                                      Konstantin Käfer
11. Lazy initialization
         JavaScript takes time to initialize
     ‣

         – Libraries such as jQuery also count
         – Defer setup work

         Only load content above the fold
     ‣

         – jQuery plugin
         – Useful on image-heavy sites




36                                               Konstantin Käfer
12. Microoptimization
         “Premature optimization is the root of all evil”
     ‣
                                                    —Donald Knuth

         Only if you have optimized everything else
     ‣


         Strategies
     ‣

         – Move components to cookieless host
         – Remove ETags
         – Load order (see http://stevesouders.com/cuzillion/)


37                                                           Konstantin Käfer
Thanks! Questions?



        Konstantin Käfer
          mail@kkaefer.com




38                           Konstantin Käfer
Ressources
     – High Performance Websites, Steve Souders, 2007.
     – http://stevesouders.com/examples/rules.php
     – http://developer.yahoo.com/performance/
     – http://yuiblog.com/blog/category/performance
     – http://sites.google.com/site/io/even-faster-web-sites
     – http://slideshare.net/jeresig/performance-improvements-
       in-browsers



39                                                             Konstantin Käfer

Weitere ähnliche Inhalte

Was ist angesagt?

Integrated Cache on Netscaler
Integrated Cache on NetscalerIntegrated Cache on Netscaler
Integrated Cache on NetscalerMark Hillick
 
5 things you didn't know nginx could do
5 things you didn't know nginx could do5 things you didn't know nginx could do
5 things you didn't know nginx could dosarahnovotny
 
Using HAProxy to Scale MySQL
Using HAProxy to Scale MySQLUsing HAProxy to Scale MySQL
Using HAProxy to Scale MySQLBill Sickles
 
Introduction to Haproxy
Introduction to HaproxyIntroduction to Haproxy
Introduction to HaproxyShaopeng He
 
Apache httpd 2.4: The Cloud Killer App
Apache httpd 2.4: The Cloud Killer AppApache httpd 2.4: The Cloud Killer App
Apache httpd 2.4: The Cloud Killer AppJim Jagielski
 
Varnish Configuration Step by Step
Varnish Configuration Step by StepVarnish Configuration Step by Step
Varnish Configuration Step by StepKim Stefan Lindholm
 
Converting Your Dev Environment to a Docker Stack - php[world]
Converting Your Dev Environment to a Docker Stack - php[world]Converting Your Dev Environment to a Docker Stack - php[world]
Converting Your Dev Environment to a Docker Stack - php[world]Dana Luther
 
Nginx - Tips and Tricks.
Nginx - Tips and Tricks.Nginx - Tips and Tricks.
Nginx - Tips and Tricks.Harish S
 
A Node.JS bag of goodies for analyzing Web Traffic
A Node.JS bag of goodies for analyzing Web TrafficA Node.JS bag of goodies for analyzing Web Traffic
A Node.JS bag of goodies for analyzing Web TrafficPhilip Tellis
 
Extending functionality in nginx, with modules!
Extending functionality in nginx, with modules!Extending functionality in nginx, with modules!
Extending functionality in nginx, with modules!Trygve Vea
 
5 things you didn't know nginx could do velocity
5 things you didn't know nginx could do   velocity5 things you didn't know nginx could do   velocity
5 things you didn't know nginx could do velocitysarahnovotny
 
Load Balancing with Nginx
Load Balancing with NginxLoad Balancing with Nginx
Load Balancing with NginxMarian Marinov
 
Learn nginx in 90mins
Learn nginx in 90minsLearn nginx in 90mins
Learn nginx in 90minsLarry Cai
 
Nginx Internals
Nginx InternalsNginx Internals
Nginx InternalsJoshua Zhu
 
Load Balancing Applications with NGINX in a CoreOS Cluster
Load Balancing Applications with NGINX in a CoreOS ClusterLoad Balancing Applications with NGINX in a CoreOS Cluster
Load Balancing Applications with NGINX in a CoreOS ClusterKevin Jones
 
Using NGINX as an Effective and Highly Available Content Cache
Using NGINX as an Effective and Highly Available Content CacheUsing NGINX as an Effective and Highly Available Content Cache
Using NGINX as an Effective and Highly Available Content CacheKevin Jones
 

Was ist angesagt? (17)

Integrated Cache on Netscaler
Integrated Cache on NetscalerIntegrated Cache on Netscaler
Integrated Cache on Netscaler
 
5 things you didn't know nginx could do
5 things you didn't know nginx could do5 things you didn't know nginx could do
5 things you didn't know nginx could do
 
Using HAProxy to Scale MySQL
Using HAProxy to Scale MySQLUsing HAProxy to Scale MySQL
Using HAProxy to Scale MySQL
 
Introduction to Haproxy
Introduction to HaproxyIntroduction to Haproxy
Introduction to Haproxy
 
Apache httpd 2.4: The Cloud Killer App
Apache httpd 2.4: The Cloud Killer AppApache httpd 2.4: The Cloud Killer App
Apache httpd 2.4: The Cloud Killer App
 
Varnish Configuration Step by Step
Varnish Configuration Step by StepVarnish Configuration Step by Step
Varnish Configuration Step by Step
 
How to monitor NGINX
How to monitor NGINXHow to monitor NGINX
How to monitor NGINX
 
Converting Your Dev Environment to a Docker Stack - php[world]
Converting Your Dev Environment to a Docker Stack - php[world]Converting Your Dev Environment to a Docker Stack - php[world]
Converting Your Dev Environment to a Docker Stack - php[world]
 
Nginx - Tips and Tricks.
Nginx - Tips and Tricks.Nginx - Tips and Tricks.
Nginx - Tips and Tricks.
 
A Node.JS bag of goodies for analyzing Web Traffic
A Node.JS bag of goodies for analyzing Web TrafficA Node.JS bag of goodies for analyzing Web Traffic
A Node.JS bag of goodies for analyzing Web Traffic
 
Extending functionality in nginx, with modules!
Extending functionality in nginx, with modules!Extending functionality in nginx, with modules!
Extending functionality in nginx, with modules!
 
5 things you didn't know nginx could do velocity
5 things you didn't know nginx could do   velocity5 things you didn't know nginx could do   velocity
5 things you didn't know nginx could do velocity
 
Load Balancing with Nginx
Load Balancing with NginxLoad Balancing with Nginx
Load Balancing with Nginx
 
Learn nginx in 90mins
Learn nginx in 90minsLearn nginx in 90mins
Learn nginx in 90mins
 
Nginx Internals
Nginx InternalsNginx Internals
Nginx Internals
 
Load Balancing Applications with NGINX in a CoreOS Cluster
Load Balancing Applications with NGINX in a CoreOS ClusterLoad Balancing Applications with NGINX in a CoreOS Cluster
Load Balancing Applications with NGINX in a CoreOS Cluster
 
Using NGINX as an Effective and Highly Available Content Cache
Using NGINX as an Effective and Highly Available Content CacheUsing NGINX as an Effective and Highly Available Content Cache
Using NGINX as an Effective and Highly Available Content Cache
 

Andere mochten auch

Web 20 Business Models 1225341206538880 8
Web 20 Business Models 1225341206538880 8Web 20 Business Models 1225341206538880 8
Web 20 Business Models 1225341206538880 8apostolicow
 
B G Magazine artist profile Gabe Lanza
B G Magazine artist profile Gabe LanzaB G Magazine artist profile Gabe Lanza
B G Magazine artist profile Gabe Lanzaguest82bdd1f
 
El Plc Y Sus Aplicaciones Verticales Para Hospitales
El Plc Y Sus Aplicaciones Verticales Para HospitalesEl Plc Y Sus Aplicaciones Verticales Para Hospitales
El Plc Y Sus Aplicaciones Verticales Para HospitalesJosep Pocalles
 
Our Solar System
Our Solar SystemOur Solar System
Our Solar Systemtnbrooks
 
Front end performance (RailsWayCon 2009 short talk)
Front end performance (RailsWayCon 2009 short talk)Front end performance (RailsWayCon 2009 short talk)
Front end performance (RailsWayCon 2009 short talk)Ralph von der Heyden
 
Developing JavaScript Widgets
Developing JavaScript WidgetsDeveloping JavaScript Widgets
Developing JavaScript WidgetsKonstantin Käfer
 
Instant Dynamic Forms with #states
Instant Dynamic Forms with #statesInstant Dynamic Forms with #states
Instant Dynamic Forms with #statesKonstantin Käfer
 
AngularJS Anatomy & Directives
AngularJS Anatomy & DirectivesAngularJS Anatomy & Directives
AngularJS Anatomy & DirectivesDigikrit
 

Andere mochten auch (9)

Web 20 Business Models 1225341206538880 8
Web 20 Business Models 1225341206538880 8Web 20 Business Models 1225341206538880 8
Web 20 Business Models 1225341206538880 8
 
B G Magazine artist profile Gabe Lanza
B G Magazine artist profile Gabe LanzaB G Magazine artist profile Gabe Lanza
B G Magazine artist profile Gabe Lanza
 
El Plc Y Sus Aplicaciones Verticales Para Hospitales
El Plc Y Sus Aplicaciones Verticales Para HospitalesEl Plc Y Sus Aplicaciones Verticales Para Hospitales
El Plc Y Sus Aplicaciones Verticales Para Hospitales
 
Our Solar System
Our Solar SystemOur Solar System
Our Solar System
 
Front end performance (RailsWayCon 2009 short talk)
Front end performance (RailsWayCon 2009 short talk)Front end performance (RailsWayCon 2009 short talk)
Front end performance (RailsWayCon 2009 short talk)
 
Developing JavaScript Widgets
Developing JavaScript WidgetsDeveloping JavaScript Widgets
Developing JavaScript Widgets
 
Instant Dynamic Forms with #states
Instant Dynamic Forms with #statesInstant Dynamic Forms with #states
Instant Dynamic Forms with #states
 
Front End Performance
Front End PerformanceFront End Performance
Front End Performance
 
AngularJS Anatomy & Directives
AngularJS Anatomy & DirectivesAngularJS Anatomy & Directives
AngularJS Anatomy & Directives
 

Ähnlich wie Front End Performance Optimization Techniques

What's New in Web Development
What's New in Web DevelopmentWhat's New in Web Development
What's New in Web DevelopmentKonstantin Käfer
 
WordCamp RVA 2011 - Performance & Tuning.pdf
WordCamp RVA 2011 - Performance & Tuning.pdfWordCamp RVA 2011 - Performance & Tuning.pdf
WordCamp RVA 2011 - Performance & Tuning.pdfcodearachnid_test
 
WordCamp RVA 2011 - Performance & Tuning.pdf
WordCamp RVA 2011 - Performance & Tuning.pdfWordCamp RVA 2011 - Performance & Tuning.pdf
WordCamp RVA 2011 - Performance & Tuning.pdfcodearachnid_test
 
From One to a Cluster
From One to a ClusterFrom One to a Cluster
From One to a Clusterguestd34230
 
WordCamp RVA 2011 - Performance & Tuning
WordCamp RVA 2011 - Performance & TuningWordCamp RVA 2011 - Performance & Tuning
WordCamp RVA 2011 - Performance & TuningTimothy Wood
 
Web Performance Part 3 "Server-side tips"
Web Performance Part 3  "Server-side tips"Web Performance Part 3  "Server-side tips"
Web Performance Part 3 "Server-side tips"Binary Studio
 
WordPress performance tuning
WordPress performance tuningWordPress performance tuning
WordPress performance tuningVladimír Smitka
 
High performance website
High performance websiteHigh performance website
High performance websiteChamnap Chhorn
 
Design a scalable site: Problem and solutions
Design a scalable site: Problem and solutionsDesign a scalable site: Problem and solutions
Design a scalable site: Problem and solutionsChau Thanh
 
PAC 2019 virtual Mark Tomlinson
PAC 2019 virtual Mark TomlinsonPAC 2019 virtual Mark Tomlinson
PAC 2019 virtual Mark TomlinsonNeotys
 
ASP.NET Scalability - NxtGen Oxford
ASP.NET Scalability - NxtGen OxfordASP.NET Scalability - NxtGen Oxford
ASP.NET Scalability - NxtGen OxfordPhil Pursglove
 
appborg, coffeesurgeon, moof, logging-system
appborg, coffeesurgeon, moof, logging-systemappborg, coffeesurgeon, moof, logging-system
appborg, coffeesurgeon, moof, logging-systemendian7000
 

Ähnlich wie Front End Performance Optimization Techniques (20)

What's New in Web Development
What's New in Web DevelopmentWhat's New in Web Development
What's New in Web Development
 
#Webperf Choreography
#Webperf Choreography#Webperf Choreography
#Webperf Choreography
 
WordCamp RVA 2011 - Performance & Tuning.pdf
WordCamp RVA 2011 - Performance & Tuning.pdfWordCamp RVA 2011 - Performance & Tuning.pdf
WordCamp RVA 2011 - Performance & Tuning.pdf
 
WordCamp RVA
WordCamp RVAWordCamp RVA
WordCamp RVA
 
WordCamp RVA
WordCamp RVAWordCamp RVA
WordCamp RVA
 
WordCamp RVA 2011 - Performance & Tuning.pdf
WordCamp RVA 2011 - Performance & Tuning.pdfWordCamp RVA 2011 - Performance & Tuning.pdf
WordCamp RVA 2011 - Performance & Tuning.pdf
 
From One to a Cluster
From One to a ClusterFrom One to a Cluster
From One to a Cluster
 
WordCamp RVA 2011 - Performance & Tuning
WordCamp RVA 2011 - Performance & TuningWordCamp RVA 2011 - Performance & Tuning
WordCamp RVA 2011 - Performance & Tuning
 
Web Performance Part 3 "Server-side tips"
Web Performance Part 3  "Server-side tips"Web Performance Part 3  "Server-side tips"
Web Performance Part 3 "Server-side tips"
 
WordPress performance tuning
WordPress performance tuningWordPress performance tuning
WordPress performance tuning
 
performance.ppt
performance.pptperformance.ppt
performance.ppt
 
Capistrano
CapistranoCapistrano
Capistrano
 
Making the web faster
Making the web fasterMaking the web faster
Making the web faster
 
High performance website
High performance websiteHigh performance website
High performance website
 
Design a scalable site: Problem and solutions
Design a scalable site: Problem and solutionsDesign a scalable site: Problem and solutions
Design a scalable site: Problem and solutions
 
PAC 2019 virtual Mark Tomlinson
PAC 2019 virtual Mark TomlinsonPAC 2019 virtual Mark Tomlinson
PAC 2019 virtual Mark Tomlinson
 
ASP.NET Scalability - NxtGen Oxford
ASP.NET Scalability - NxtGen OxfordASP.NET Scalability - NxtGen Oxford
ASP.NET Scalability - NxtGen Oxford
 
re7jweiss
re7jweissre7jweiss
re7jweiss
 
appborg, coffeesurgeon, moof, logging-system
appborg, coffeesurgeon, moof, logging-systemappborg, coffeesurgeon, moof, logging-system
appborg, coffeesurgeon, moof, logging-system
 
Http2 in practice
Http2 in practiceHttp2 in practice
Http2 in practice
 

Kürzlich hochgeladen

A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 

Kürzlich hochgeladen (20)

A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 

Front End Performance Optimization Techniques

  • 1. Part II: Front End Performance Konstantin Käfer
  • 2. What’s Performance? Loading Perception Measurement Running 2 Konstantin Käfer
  • 3. Styles, scripts and images account for over 80% of load time. 3 Konstantin Käfer
  • 4. Back- Other Images grounds Media HTML CSS Scripts 4 Konstantin Käfer
  • 5. Distribution (time) Images HTML Back- CSS Scripts + grounds Media Time spent generating the page in Drupal 5 Konstantin Käfer
  • 6. 1 Introduction ✔ 2 Tools & Measurement 3 Speed optimization 4 Beyond YSlow 6 Konstantin Käfer
  • 7. Measure to prove optimization success. 7 Konstantin Käfer
  • 8. Overall load time? 8 Konstantin Käfer
  • 9. Page size? 9 Konstantin Käfer
  • 10. Time until DOM is loaded? 10 Konstantin Käfer
  • 11. Time until page is rendered? 11 Konstantin Käfer
  • 12. Time until page is functional? 12 Konstantin Käfer
  • 13. Firebug’s Net panel 13 Konstantin Käfer
  • 14. YSlow Rates a webpage based on 13 criteria ‣ Determines overall load time ‣ Provides optimization suggestions ‣ Graphs, Numbers & Figures ‣ 14 Konstantin Käfer
  • 15. YSlow is not everything. 15 Konstantin Käfer
  • 16. Other tools AOL Page Test ‣ online version: http://webpagetest.org IBM Page Detailer ‣ http://www.alphaworks.ibm.com/tech/pagedetailer Pingdom ‣ http://tools.pingdom.com WebKit’s Web Inspector ‣ Safari 4 Beta or WebKit nightly from http://webkit.org Web Debugging Proxies ‣ http://charlesproxy.com, http://fiddlertool.com 16 Konstantin Käfer
  • 17. Waterfall diagrams Start Connect First byte Last byte 17 Konstantin Käfer
  • 18. 1 Introduction ✔ 2 Tools & Measurement ✔ 3 Speed optimization 4 Beyond YSlow 18 Konstantin Käfer
  • 19. 1. Reduce requests Every file produces an HTTP request ‣ 60s 45s Requests 30s Size 15s 0s 0 10 20 30 Fewer requests is better than smaller size ‣ HTTP 1.1: 2 components per host in parallel ‣ 19 Konstantin Käfer
  • 20. 1. Reduce requests Sprites ‣ – Many images into one file – Shift into view with background-position Aggregate scripts and styles ‣ – Built into Drupal – Sophisticated: http://drupal.org/project/sf_cache No redirects ‣ 20 Konstantin Käfer
  • 21. 1. Reduce requests Caching (see 3.) ‣ Use CSS instead of images ‣ -moz-border-radius:4px; -webkit-border-radius: 4px; border-radius: 4px; data: URLs in style sheets ‣ – url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAIAAAAC64paAAAAGXRFWHRTb2Z 0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAR9JREFUeNrEk02ORUAUhRVNJEgYsgdGbIHFsSGmhhjZAzFCR CLx906io3UROu8N+g7vPR9V95wi67oy79bXuTXP8zAMfdP48jzvCRJoihyHPcA4xRd1+V5HoZhmqZ1XWuaZ tu267qWZSmKQghhKGCrZVmqqgqCQNd16g/ooI8pNOuhfuC2bX3fFwTh8nroYwrNBTxNUxzHhmHcrAf/hwb KHWa3ATYURVFRFDdwWZbYBZR75xvGbpMkefQmyzIoaRiuNE3zCGP/UNIw/FRV9RGGBkoaRhLg5yPsOA6U tM/vbfuXz0jCjc+YXvu8JwxJOCcMJ9oShtgfYXJ8VedsY0O4p+d5pmnKssyy7PGj5Pwk//6qyCfvmWU+qP+DXw IMADReKA+zC0X8AAAAAElFTkSuQmCC); 21 Konstantin Käfer
  • 22. 2. Use a CDN Content Delivery Network ‣ Lots of servers scattered around the world ‣ Reduces roundtrip times (ping) ‣ Comparably cheap: $0.07 - $0.80 per GB ‣ – http://www.simplecdn.com – http://pantherexpress.com – http://cachefly.com – http://aws.amazon.com/cloudfront – http://www.limelightnetworks.com – http://www.akamai.com 22 Konstantin Käfer
  • 23. Round Trip Time HTTP is usually done over TCP/IP ‣ Transmission Control Protocol ‣ Stateful: Three Way Handshakes ‣ Round trip time has high effect ‣ 23 Konstantin Käfer
  • 24. 3. Caching Controlled by HTTP headers ‣ Browsers check whether content is fresh ‣ Set Expires header to a date in the far future ‣ Change filenames/URLs when updating ‣ 24 Konstantin Käfer
  • 25. 4. GZip Compress text content (don’t use for images!) ‣ Vastly reduces page size ‣ NowPublic.com: 700 KB ➔ 300 KB ‣ Compress scripts and styles as well ‣ 25 Konstantin Käfer
  • 26. 5. CSS to the top == in <head> ‣ Page renders when all header CSS is loaded ‣ Loading CSS later causes re-rendering and ‣ Flash of Unstyled Content 26 Konstantin Käfer
  • 27. == right before </body> ‣ Loading scripts blocks page rendering ‣ Scripts are loaded sequentially! ‣ (At least in most current browsers) Don’t use onfoo handlers in HTML code ‣ Graceful degradation ‣ 6. Scripts to the bottom 27 Konstantin Käfer
  • 28. 7. Minify CSS and JS Remove comments and whitespace ‣ Still savings, even with GZip ‣ Drupal’s aggregator or sf_cache.module ‣ 28 Konstantin Käfer
  • 29. 1 Introduction ✔ 2 Tools & Measurement ✔ 3 Speed optimization ✔ 4 Beyond YSlow 29 Konstantin Käfer
  • 30. 8. Parallelization RFC: 2 requests per host name in parallel ‣ Use multiple host names ➔ higher ‣ parallelization (Don’t overdo it) Most current browsers use > 2 connections ‣ http://stevesouders.com/ua/ ‣ 30 Konstantin Käfer
  • 31. HTTP connections “A single-user client SHOULD NOT maintain ‣ more than 2 connections with any server or proxy.” (RFC 2616, 8.1.4) 1 2 3 4 5 31 Konstantin Käfer
  • 32. 9. Reduce image weight OptiPNG, PNGCrush, ... ‣ – Removes invisible content – Lossless recompression JPEGtran/ImageMagick ‣ – Remove color profiles, meta data, ... – Lossless JPEG operations http://smushit.com ‣ 32 Konstantin Käfer
  • 33. 10. Persistent HTTP HTTP supports persistent connections ‣ multiple connections persistent connection server client server client open open close open time close open close close 33 Konstantin Käfer
  • 34. 10. Persistent HTTP AOL Pagetest has connection view ‣ 34 Konstantin Käfer
  • 35. 10. Persistent HTTP no pipelining pipelining server server client client open open time close close Most web browsers don’t support it ‣ 35 Konstantin Käfer
  • 36. 11. Lazy initialization JavaScript takes time to initialize ‣ – Libraries such as jQuery also count – Defer setup work Only load content above the fold ‣ – jQuery plugin – Useful on image-heavy sites 36 Konstantin Käfer
  • 37. 12. Microoptimization “Premature optimization is the root of all evil” ‣ —Donald Knuth Only if you have optimized everything else ‣ Strategies ‣ – Move components to cookieless host – Remove ETags – Load order (see http://stevesouders.com/cuzillion/) 37 Konstantin Käfer
  • 38. Thanks! Questions? Konstantin Käfer mail@kkaefer.com 38 Konstantin Käfer
  • 39. Ressources – High Performance Websites, Steve Souders, 2007. – http://stevesouders.com/examples/rules.php – http://developer.yahoo.com/performance/ – http://yuiblog.com/blog/category/performance – http://sites.google.com/site/io/even-faster-web-sites – http://slideshare.net/jeresig/performance-improvements- in-browsers 39 Konstantin Käfer