SlideShare una empresa de Scribd logo
1 de 42
Descargar para leer sin conexión
Optimizing Your
Frontend Performance
Thomas Weinert
About Me
   Application Developer
     ▹   PHP
     ▹   XSLT/XPath
     ▹   (some) Javascript

    papaya CMS
     ▹   PHP based Content Management System
     ▹   uses XSLT for Templates


Thomas Weinert, papaya Software GmbH
How to scale you webpage?
   Hardware
   Backend

    Frontend




Thomas Weinert, papaya Software GmbH
Hardware
   More hardware
   Better hardware

    Moores Law
     ▹   Transistors doubling every 18 months
     ▹   Transistors != Performance
   Distributed systems are complex
   Think about environment

Thomas Weinert, papaya Software GmbH
Backend
   External data sources are slow
     ▹   SQL
     ▹   Files
     ▹   Network

    Locking is slower

    Memory is faster
     ▹   but less secure


Thomas Weinert, papaya Software GmbH
Mini/Micro Optimisations
   Myths
     ▹   echo vs. print
     ▹   ' vs. quot;

    Objects vs. functions vs. linear source

    Template systems




Thomas Weinert, papaya Software GmbH
Mini/Micro Optimisations




                        DON'T DO IT


Thomas Weinert, papaya Software GmbH
Yahoo!
   Yahoo!'s Exceptional Performance team
     ▹   Yahoo!'s Exceptional Performance team evangelizes
         best practices for improving web performance.
         They conduct research, build tools, write articles
         and blogs, and speak at conferences. Their best
         practices center around the rules for high
         performance web sites.
     ▹   http://developer.yahoo.com/performance/



Thomas Weinert, papaya Software GmbH
Results
   80% of the end-user response time is spent on
    the front-end.




Thomas Weinert, papaya Software GmbH
Firebug
   Firefox extension
   Analyze and manipulate
     ▹   requests, page structure, CSS

    Javascript debugger




Thomas Weinert, papaya Software GmbH
YSlow
   Why (is your web page) slow
   Set of rules

    Firebug extension




Thomas Weinert, papaya Software GmbH
Yslow: Performance View




Thomas Weinert, papaya Software GmbH
Yslow: Stats




Thomas Weinert, papaya Software GmbH
Yslow: Components




Thomas Weinert, papaya Software GmbH
Yslow: Tools
   Print View
   JSLint




Thomas Weinert, papaya Software GmbH
Make Fewer HTTP Requests
   Combined files
     ▹   CSS
     ▹   JavaScript

    CSS sprites




Thomas Weinert, papaya Software GmbH
Combined files
   Release process
   CSS
     ▹   Consider URLs

    JavaScript
     ▹   Minify
     ▹   Obfuscate



Thomas Weinert, papaya Software GmbH
CSS Sprites
   Elements with fixed size
   Background image

    Disable repeat

    Negative positions




Thomas Weinert, papaya Software GmbH
CSS Icons
   Raster of icons
   No repeat

    Fixed size
    <div> or <span>




Thomas Weinert, papaya Software GmbH
CSS Backgrounds
   Gradient
   Repeat in one
    direction




Thomas Weinert, papaya Software GmbH
Minify Javascript
   Most JS libraries provide a minified version
   YUI Compressor: http://developer.yahoo.com/
    yui/compressor/
     ▹   JS and CSS

    Packer
     ▹   Webpage, .Net, Perl, PHP
     ▹   http://dean.edwards.name/packer/


Thomas Weinert, papaya Software GmbH
#2 Use A CDN
   Content Delivery Network
     ▹   Akamai Technologies
     ▹   Mirror Image Internet
     ▹   Limelight Networks

    Bring the content to your users
     ▹   Geographic distance
     ▹   Physics is still here
   Only for large sites
   Dynamic content is complex
Thomas Weinert, papaya Software GmbH
Headers
   Expires
   Cache-Control
     ▹   Session-Management

    304 Not Modified




Thomas Weinert, papaya Software GmbH
Expires
   Apache mod_expire

    <IfModule mod_expires.c>
        ExpiresDefault quot;access plus 1 monthquot;
        ExpiresActive on
    </IfModule>




Thomas Weinert, papaya Software GmbH
Cache-Control
   nocache
     ▹   no caching
     ▹   default for sessions

    private
     ▹   cacheable in browser cache

    public
     ▹   cacheable in browser cache and proxies


Thomas Weinert, papaya Software GmbH
304 Not Modified
   Send Etag and Modfication date
     ▹   Etag: quot;some hashquot;
     ▹   Last-Modified: Thu, 12 Sep 2008 11:00:00 GMT
   Request headers
     ▹   If-Modified-Since: Tue, 12 Sep 2008 11:00:00 GMT
     ▹   If-None-Match: quot;some hashquot;

    Response headers
     ▹   HTTP/1.1 304 Not Modified
Thomas Weinert, papaya Software GmbH
HTTPFox
   Firefox Extension
   Log of all HTTP requests

    Not only displayed content




Thomas Weinert, papaya Software GmbH
Gzip Components
   Gzip != Zip
     ▹   only compression
     ▹   no packaging
     ▹   tar.gz

    Good browser support
     ▹   Accept-Encoding: gzip, deflate
     ▹   Content-Encoding: gzip


Thomas Weinert, papaya Software GmbH
Gzip in Apache
   mod_gzip
   mod_deflate
     ▹   filter chain, works on dynamic content, too


     ▹   http://httpd.apache.org/docs/2.2/mod/mod_deflate.html




Thomas Weinert, papaya Software GmbH
Gzip In PHP 5
<?php
    ob_start('ob_gzhandler');
    ...




Thomas Weinert, papaya Software GmbH
Gzip In PHP 5
<?php
    if (function_exists('ob_gzhandler')) {
        ob_start('ob_gzhandler');
    }
    ...




Thomas Weinert, papaya Software GmbH
Configure ETags
   Browser still asks webserver
   Server specific
     ▹    CDN
     ▹    Load balancer with multiple servers
   Apache
     ▹    FileETag none

    IIS
     ▹    http://support.microsoft.com/?id=922733
Thomas Weinert, papaya Software GmbH
Split requests across
                                      domains
   HTTP 1.1 suggests 2 parallel requests per
    domain
   Separate content by function
     ▹   www.domain.tld
     ▹   themes.domain.tld
     ▹   usercontent.domain.tld (security)

    Optimisation tools change the option

    Consider cookie domains
Thomas Weinert, papaya Software GmbH
Reduce DNS Lookups
   DNS maps host names to ips
   Needs time
     ▹   20-120 milliseconds

    Cached in browser




Thomas Weinert, papaya Software GmbH
Avoid Redirects
   Obviously additional requests
   Only cached with explicit headers
     ▹   depends on webserver configuration



    http://www.domain.tld
     ▹   http://www.domain.tld/



Thomas Weinert, papaya Software GmbH
Put Stylesheets at the Top
   Progressive display of the page
   Page appears to load faster

    W3C specifications




Thomas Weinert, papaya Software GmbH
Put Scripts at the Bottom
   Scripts block parallel downloads
     ▹   defer attribute in MSIE

    onload() event
     ▹   used by most libraries



    Problem: document.write()
     ▹   Counter
     ▹   Banners
Thomas Weinert, papaya Software GmbH
Avoid CSS Expressions
   MSIE from version 5
     ▹   cross browser experience

    JavaScript inside CSS

    Evaluated
     ▹   page render
     ▹   resize
     ▹   scrolling
     ▹   mouse movements (hover)
Thomas Weinert, papaya Software GmbH
JavaScript And CSS Files
   Do not embed JS/CSS in your pages
     ▹   No <script>...</script>
     ▹   No <style>...</style>

    Separate caching headers

    Revision parameter (style.css?rev=1234)
     ▹   Get parameter
     ▹   Unique URL for browser


Thomas Weinert, papaya Software GmbH
Remove Duplicate Scripts
   Team size
   Standard scripts
     ▹   XMLRPC, JQuery, Prototype

    Script module for your template system

   $templatesystem->addScript('foo.js');



Thomas Weinert, papaya Software GmbH
Make Ajax Cacheable
   Often AJAX applications avoid caching
     ▹   http://some.domain.tld/ajax.file?t=randomvalue

    A lot of requests

    Use more static URLs




Thomas Weinert, papaya Software GmbH
References
   Slides: http://www.abasketfulofpapayas.de/
   Yahoo Performance Team
     ▹   http://developer.yahoo.com/performance/
   JS minimize
     ▹   http://developer.yahoo.com/yui/compressor/
     ▹   http://dean.edwards.name/packer/
   Apache GZIP
     ▹   http://httpd.apache.org/docs/2.2/mod/mod_deflate.html
   No Etag in IIS
     ▹   http://support.microsoft.com/?id=922733
Thomas Weinert, papaya Software GmbH

Más contenido relacionado

La actualidad más candente

Roy foubister (hosting high traffic sites on a tight budget)
Roy foubister (hosting high traffic sites on a tight budget)Roy foubister (hosting high traffic sites on a tight budget)
Roy foubister (hosting high traffic sites on a tight budget)WordCamp Cape Town
 
High-Performance Magento in the Cloud
High-Performance Magento in the CloudHigh-Performance Magento in the Cloud
High-Performance Magento in the CloudAOE
 
Scale ColdFusion with Terracotta Distributed Caching for Ehchache
Scale ColdFusion with Terracotta Distributed Caching for EhchacheScale ColdFusion with Terracotta Distributed Caching for Ehchache
Scale ColdFusion with Terracotta Distributed Caching for EhchacheColdFusionConference
 
Running and Scaling Magento on AWS
Running and Scaling Magento on AWSRunning and Scaling Magento on AWS
Running and Scaling Magento on AWSAOE
 
KScope14 Oracle EPM Troubleshooting
KScope14 Oracle EPM TroubleshootingKScope14 Oracle EPM Troubleshooting
KScope14 Oracle EPM TroubleshootingAlithya
 
Nevmug Lighthouse Automation7.1
Nevmug   Lighthouse   Automation7.1Nevmug   Lighthouse   Automation7.1
Nevmug Lighthouse Automation7.1csharney
 
Tuning the Performance of Your ColdFusion Environment to Racecar Specs!
Tuning the Performance of Your ColdFusion Environment to Racecar Specs!Tuning the Performance of Your ColdFusion Environment to Racecar Specs!
Tuning the Performance of Your ColdFusion Environment to Racecar Specs!Hostway|HOSTING
 
The Care and Feeding of Your WordPress Website - Hosting, Updates, Backups, S...
The Care and Feeding of Your WordPress Website - Hosting, Updates, Backups, S...The Care and Feeding of Your WordPress Website - Hosting, Updates, Backups, S...
The Care and Feeding of Your WordPress Website - Hosting, Updates, Backups, S...Cindy Cullen
 
CQ5.x Maintenance Webinar 2013
CQ5.x Maintenance Webinar 2013CQ5.x Maintenance Webinar 2013
CQ5.x Maintenance Webinar 2013Andrew Khoury
 
Securing Your WordPress Website - WordCamp Sydney 2012
Securing Your WordPress Website - WordCamp Sydney 2012Securing Your WordPress Website - WordCamp Sydney 2012
Securing Your WordPress Website - WordCamp Sydney 2012Vlad Lasky
 
Administrivia: Golden Tips for Making JIRA Hum
Administrivia: Golden Tips for Making JIRA HumAdministrivia: Golden Tips for Making JIRA Hum
Administrivia: Golden Tips for Making JIRA HumAtlassian
 
WebPagetest Power Users - Velocity 2014
WebPagetest Power Users - Velocity 2014WebPagetest Power Users - Velocity 2014
WebPagetest Power Users - Velocity 2014Patrick Meenan
 
Magento Performance Improvements with Client Side Optimizations
Magento Performance Improvements with Client Side OptimizationsMagento Performance Improvements with Client Side Optimizations
Magento Performance Improvements with Client Side OptimizationsPINT Inc
 
Securing Your WordPress Website - WordCamp GC 2011
Securing Your WordPress Website - WordCamp GC 2011Securing Your WordPress Website - WordCamp GC 2011
Securing Your WordPress Website - WordCamp GC 2011Vlad Lasky
 
Open Mic Webcast: IBM Sametime Audio Video Troubleshooting - 04 May 2016
Open Mic Webcast: IBM Sametime Audio Video Troubleshooting - 04 May 2016Open Mic Webcast: IBM Sametime Audio Video Troubleshooting - 04 May 2016
Open Mic Webcast: IBM Sametime Audio Video Troubleshooting - 04 May 2016Gunawan T Wicaksono
 
Accelerate your ColdFusion Applications using Caching
Accelerate your ColdFusion Applications using CachingAccelerate your ColdFusion Applications using Caching
Accelerate your ColdFusion Applications using CachingColdFusionConference
 

La actualidad más candente (17)

Roy foubister (hosting high traffic sites on a tight budget)
Roy foubister (hosting high traffic sites on a tight budget)Roy foubister (hosting high traffic sites on a tight budget)
Roy foubister (hosting high traffic sites on a tight budget)
 
High-Performance Magento in the Cloud
High-Performance Magento in the CloudHigh-Performance Magento in the Cloud
High-Performance Magento in the Cloud
 
Scale ColdFusion with Terracotta Distributed Caching for Ehchache
Scale ColdFusion with Terracotta Distributed Caching for EhchacheScale ColdFusion with Terracotta Distributed Caching for Ehchache
Scale ColdFusion with Terracotta Distributed Caching for Ehchache
 
Running and Scaling Magento on AWS
Running and Scaling Magento on AWSRunning and Scaling Magento on AWS
Running and Scaling Magento on AWS
 
KScope14 Oracle EPM Troubleshooting
KScope14 Oracle EPM TroubleshootingKScope14 Oracle EPM Troubleshooting
KScope14 Oracle EPM Troubleshooting
 
Nevmug Lighthouse Automation7.1
Nevmug   Lighthouse   Automation7.1Nevmug   Lighthouse   Automation7.1
Nevmug Lighthouse Automation7.1
 
Tuning the Performance of Your ColdFusion Environment to Racecar Specs!
Tuning the Performance of Your ColdFusion Environment to Racecar Specs!Tuning the Performance of Your ColdFusion Environment to Racecar Specs!
Tuning the Performance of Your ColdFusion Environment to Racecar Specs!
 
The Care and Feeding of Your WordPress Website - Hosting, Updates, Backups, S...
The Care and Feeding of Your WordPress Website - Hosting, Updates, Backups, S...The Care and Feeding of Your WordPress Website - Hosting, Updates, Backups, S...
The Care and Feeding of Your WordPress Website - Hosting, Updates, Backups, S...
 
Corkgdg video
Corkgdg videoCorkgdg video
Corkgdg video
 
CQ5.x Maintenance Webinar 2013
CQ5.x Maintenance Webinar 2013CQ5.x Maintenance Webinar 2013
CQ5.x Maintenance Webinar 2013
 
Securing Your WordPress Website - WordCamp Sydney 2012
Securing Your WordPress Website - WordCamp Sydney 2012Securing Your WordPress Website - WordCamp Sydney 2012
Securing Your WordPress Website - WordCamp Sydney 2012
 
Administrivia: Golden Tips for Making JIRA Hum
Administrivia: Golden Tips for Making JIRA HumAdministrivia: Golden Tips for Making JIRA Hum
Administrivia: Golden Tips for Making JIRA Hum
 
WebPagetest Power Users - Velocity 2014
WebPagetest Power Users - Velocity 2014WebPagetest Power Users - Velocity 2014
WebPagetest Power Users - Velocity 2014
 
Magento Performance Improvements with Client Side Optimizations
Magento Performance Improvements with Client Side OptimizationsMagento Performance Improvements with Client Side Optimizations
Magento Performance Improvements with Client Side Optimizations
 
Securing Your WordPress Website - WordCamp GC 2011
Securing Your WordPress Website - WordCamp GC 2011Securing Your WordPress Website - WordCamp GC 2011
Securing Your WordPress Website - WordCamp GC 2011
 
Open Mic Webcast: IBM Sametime Audio Video Troubleshooting - 04 May 2016
Open Mic Webcast: IBM Sametime Audio Video Troubleshooting - 04 May 2016Open Mic Webcast: IBM Sametime Audio Video Troubleshooting - 04 May 2016
Open Mic Webcast: IBM Sametime Audio Video Troubleshooting - 04 May 2016
 
Accelerate your ColdFusion Applications using Caching
Accelerate your ColdFusion Applications using CachingAccelerate your ColdFusion Applications using Caching
Accelerate your ColdFusion Applications using Caching
 

Destacado

Decoupling Objects With Standard Interfaces
Decoupling Objects With Standard InterfacesDecoupling Objects With Standard Interfaces
Decoupling Objects With Standard InterfacesThomas Weinert
 
Deliver Files With PHP
Deliver Files With PHPDeliver Files With PHP
Deliver Files With PHPThomas Weinert
 
Controlling Arduino With PHP
Controlling Arduino With PHPControlling Arduino With PHP
Controlling Arduino With PHPThomas Weinert
 
Asynchronous I/O in PHP
Asynchronous I/O in PHPAsynchronous I/O in PHP
Asynchronous I/O in PHPThomas Weinert
 
PHPUG CGN: Controlling Arduino With PHP
PHPUG CGN: Controlling Arduino With PHPPHPUG CGN: Controlling Arduino With PHP
PHPUG CGN: Controlling Arduino With PHPThomas Weinert
 

Destacado (6)

Decoupling Objects With Standard Interfaces
Decoupling Objects With Standard InterfacesDecoupling Objects With Standard Interfaces
Decoupling Objects With Standard Interfaces
 
Deliver Files With PHP
Deliver Files With PHPDeliver Files With PHP
Deliver Files With PHP
 
Controlling Arduino With PHP
Controlling Arduino With PHPControlling Arduino With PHP
Controlling Arduino With PHP
 
Asynchronous I/O in PHP
Asynchronous I/O in PHPAsynchronous I/O in PHP
Asynchronous I/O in PHP
 
PHPUG CGN: Controlling Arduino With PHP
PHPUG CGN: Controlling Arduino With PHPPHPUG CGN: Controlling Arduino With PHP
PHPUG CGN: Controlling Arduino With PHP
 
Lumberjack XPath 101
Lumberjack XPath 101Lumberjack XPath 101
Lumberjack XPath 101
 

Similar a Optimizing Your Frontend Performance

Caching and tuning fun for high scalability @ PHPTour
Caching and tuning fun for high scalability @ PHPTourCaching and tuning fun for high scalability @ PHPTour
Caching and tuning fun for high scalability @ PHPTourWim Godden
 
Caching and tuning fun for high scalability @ FOSDEM 2012
Caching and tuning fun for high scalability @ FOSDEM 2012Caching and tuning fun for high scalability @ FOSDEM 2012
Caching and tuning fun for high scalability @ FOSDEM 2012Wim Godden
 
Caching and tuning fun for high scalability @ phpBenelux 2011
Caching and tuning fun for high scalability @ phpBenelux 2011Caching and tuning fun for high scalability @ phpBenelux 2011
Caching and tuning fun for high scalability @ phpBenelux 2011Wim Godden
 
Caching and tuning fun for high scalability @ FrOSCon 2011
Caching and tuning fun for high scalability @ FrOSCon 2011Caching and tuning fun for high scalability @ FrOSCon 2011
Caching and tuning fun for high scalability @ FrOSCon 2011Wim Godden
 
Caching and tuning fun for high scalability
Caching and tuning fun for high scalabilityCaching and tuning fun for high scalability
Caching and tuning fun for high scalabilityWim Godden
 
Website releases made easy with the PEAR installer, OSCON 2009
Website releases made easy with the PEAR installer, OSCON 2009Website releases made easy with the PEAR installer, OSCON 2009
Website releases made easy with the PEAR installer, OSCON 2009Helgi Þormar Þorbjörnsson
 
Apache and PHP: Why httpd.conf is your new BFF!
Apache and PHP: Why httpd.conf is your new BFF!Apache and PHP: Why httpd.conf is your new BFF!
Apache and PHP: Why httpd.conf is your new BFF!Jeff Jones
 
HTTP cache @ PUG Rome 03-29-2011
HTTP cache @ PUG Rome 03-29-2011HTTP cache @ PUG Rome 03-29-2011
HTTP cache @ PUG Rome 03-29-2011Alessandro Nadalin
 
Profiling PHP with Xdebug / Webgrind
Profiling PHP with Xdebug / WebgrindProfiling PHP with Xdebug / Webgrind
Profiling PHP with Xdebug / WebgrindSam Keen
 
High Performance Ajax Applications
High Performance Ajax ApplicationsHigh Performance Ajax Applications
High Performance Ajax ApplicationsSiarhei Barysiuk
 
Web performance - Analysing Heart.co.uk
Web performance - Analysing Heart.co.ukWeb performance - Analysing Heart.co.uk
Web performance - Analysing Heart.co.ukgareth53
 
Magento caching
Magento cachingMagento caching
Magento cachingYireo
 
Making dynamic sites scale like static sites
Making dynamic sites scale like static sitesMaking dynamic sites scale like static sites
Making dynamic sites scale like static sitesWim Godden
 
Web performance optimization
Web performance optimizationWeb performance optimization
Web performance optimizationKaliop-slide
 
Caching and tuning fun for high scalability
Caching and tuning fun for high scalabilityCaching and tuning fun for high scalability
Caching and tuning fun for high scalabilityWim Godden
 

Similar a Optimizing Your Frontend Performance (20)

Caching and tuning fun for high scalability @ PHPTour
Caching and tuning fun for high scalability @ PHPTourCaching and tuning fun for high scalability @ PHPTour
Caching and tuning fun for high scalability @ PHPTour
 
Caching and tuning fun for high scalability @ FOSDEM 2012
Caching and tuning fun for high scalability @ FOSDEM 2012Caching and tuning fun for high scalability @ FOSDEM 2012
Caching and tuning fun for high scalability @ FOSDEM 2012
 
Caching and tuning fun for high scalability @ phpBenelux 2011
Caching and tuning fun for high scalability @ phpBenelux 2011Caching and tuning fun for high scalability @ phpBenelux 2011
Caching and tuning fun for high scalability @ phpBenelux 2011
 
Caching and tuning fun for high scalability @ FrOSCon 2011
Caching and tuning fun for high scalability @ FrOSCon 2011Caching and tuning fun for high scalability @ FrOSCon 2011
Caching and tuning fun for high scalability @ FrOSCon 2011
 
Magee Dday2 Fixing App Performance Italiano
Magee Dday2 Fixing App Performance ItalianoMagee Dday2 Fixing App Performance Italiano
Magee Dday2 Fixing App Performance Italiano
 
Caching and tuning fun for high scalability
Caching and tuning fun for high scalabilityCaching and tuning fun for high scalability
Caching and tuning fun for high scalability
 
Website releases made easy with the PEAR installer, OSCON 2009
Website releases made easy with the PEAR installer, OSCON 2009Website releases made easy with the PEAR installer, OSCON 2009
Website releases made easy with the PEAR installer, OSCON 2009
 
Qcon
QconQcon
Qcon
 
Apache and PHP: Why httpd.conf is your new BFF!
Apache and PHP: Why httpd.conf is your new BFF!Apache and PHP: Why httpd.conf is your new BFF!
Apache and PHP: Why httpd.conf is your new BFF!
 
HTTP cache @ PUG Rome 03-29-2011
HTTP cache @ PUG Rome 03-29-2011HTTP cache @ PUG Rome 03-29-2011
HTTP cache @ PUG Rome 03-29-2011
 
Profiling PHP with Xdebug / Webgrind
Profiling PHP with Xdebug / WebgrindProfiling PHP with Xdebug / Webgrind
Profiling PHP with Xdebug / Webgrind
 
High Performance Ajax Applications
High Performance Ajax ApplicationsHigh Performance Ajax Applications
High Performance Ajax Applications
 
Web performance - Analysing Heart.co.uk
Web performance - Analysing Heart.co.ukWeb performance - Analysing Heart.co.uk
Web performance - Analysing Heart.co.uk
 
Magento caching
Magento cachingMagento caching
Magento caching
 
Making dynamic sites scale like static sites
Making dynamic sites scale like static sitesMaking dynamic sites scale like static sites
Making dynamic sites scale like static sites
 
Websites Performance Highlights
Websites Performance HighlightsWebsites Performance Highlights
Websites Performance Highlights
 
Caching 101
Caching 101Caching 101
Caching 101
 
Web performance optimization
Web performance optimizationWeb performance optimization
Web performance optimization
 
Caching and tuning fun for high scalability
Caching and tuning fun for high scalabilityCaching and tuning fun for high scalability
Caching and tuning fun for high scalability
 
PHP 5.3/6
PHP 5.3/6PHP 5.3/6
PHP 5.3/6
 

Más de Thomas Weinert

Optimizing Your Frontend Performance
Optimizing Your Frontend PerformanceOptimizing Your Frontend Performance
Optimizing Your Frontend PerformanceThomas Weinert
 
Experiences With Pre Commit Hooks
Experiences With Pre Commit HooksExperiences With Pre Commit Hooks
Experiences With Pre Commit HooksThomas Weinert
 
The Lumber Mill - XSLT For Your Templates
The Lumber Mill  - XSLT For Your TemplatesThe Lumber Mill  - XSLT For Your Templates
The Lumber Mill - XSLT For Your TemplatesThomas Weinert
 
The Lumber Mill Xslt For Your Templates
The Lumber Mill   Xslt For Your TemplatesThe Lumber Mill   Xslt For Your Templates
The Lumber Mill Xslt For Your TemplatesThomas Weinert
 
Optimizing Your Frontend Performance
Optimizing Your Frontend PerformanceOptimizing Your Frontend Performance
Optimizing Your Frontend PerformanceThomas Weinert
 

Más de Thomas Weinert (7)

FluentDom
FluentDomFluentDom
FluentDom
 
Optimizing Your Frontend Performance
Optimizing Your Frontend PerformanceOptimizing Your Frontend Performance
Optimizing Your Frontend Performance
 
Experiences With Pre Commit Hooks
Experiences With Pre Commit HooksExperiences With Pre Commit Hooks
Experiences With Pre Commit Hooks
 
The Lumber Mill - XSLT For Your Templates
The Lumber Mill  - XSLT For Your TemplatesThe Lumber Mill  - XSLT For Your Templates
The Lumber Mill - XSLT For Your Templates
 
The Lumber Mill Xslt For Your Templates
The Lumber Mill   Xslt For Your TemplatesThe Lumber Mill   Xslt For Your Templates
The Lumber Mill Xslt For Your Templates
 
SVN Hook
SVN HookSVN Hook
SVN Hook
 
Optimizing Your Frontend Performance
Optimizing Your Frontend PerformanceOptimizing Your Frontend Performance
Optimizing Your Frontend Performance
 

Último

Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 

Último (20)

Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 

Optimizing Your Frontend Performance

  • 2. About Me  Application Developer ▹ PHP ▹ XSLT/XPath ▹ (some) Javascript  papaya CMS ▹ PHP based Content Management System ▹ uses XSLT for Templates Thomas Weinert, papaya Software GmbH
  • 3. How to scale you webpage?  Hardware  Backend  Frontend Thomas Weinert, papaya Software GmbH
  • 4. Hardware  More hardware  Better hardware  Moores Law ▹ Transistors doubling every 18 months ▹ Transistors != Performance  Distributed systems are complex  Think about environment Thomas Weinert, papaya Software GmbH
  • 5. Backend  External data sources are slow ▹ SQL ▹ Files ▹ Network  Locking is slower  Memory is faster ▹ but less secure Thomas Weinert, papaya Software GmbH
  • 6. Mini/Micro Optimisations  Myths ▹ echo vs. print ▹ ' vs. quot;  Objects vs. functions vs. linear source  Template systems Thomas Weinert, papaya Software GmbH
  • 7. Mini/Micro Optimisations DON'T DO IT Thomas Weinert, papaya Software GmbH
  • 8. Yahoo!  Yahoo!'s Exceptional Performance team ▹ Yahoo!'s Exceptional Performance team evangelizes best practices for improving web performance. They conduct research, build tools, write articles and blogs, and speak at conferences. Their best practices center around the rules for high performance web sites. ▹ http://developer.yahoo.com/performance/ Thomas Weinert, papaya Software GmbH
  • 9. Results  80% of the end-user response time is spent on the front-end. Thomas Weinert, papaya Software GmbH
  • 10. Firebug  Firefox extension  Analyze and manipulate ▹ requests, page structure, CSS  Javascript debugger Thomas Weinert, papaya Software GmbH
  • 11. YSlow  Why (is your web page) slow  Set of rules  Firebug extension Thomas Weinert, papaya Software GmbH
  • 12. Yslow: Performance View Thomas Weinert, papaya Software GmbH
  • 13. Yslow: Stats Thomas Weinert, papaya Software GmbH
  • 14. Yslow: Components Thomas Weinert, papaya Software GmbH
  • 15. Yslow: Tools  Print View  JSLint Thomas Weinert, papaya Software GmbH
  • 16. Make Fewer HTTP Requests  Combined files ▹ CSS ▹ JavaScript  CSS sprites Thomas Weinert, papaya Software GmbH
  • 17. Combined files  Release process  CSS ▹ Consider URLs  JavaScript ▹ Minify ▹ Obfuscate Thomas Weinert, papaya Software GmbH
  • 18. CSS Sprites  Elements with fixed size  Background image  Disable repeat  Negative positions Thomas Weinert, papaya Software GmbH
  • 19. CSS Icons  Raster of icons  No repeat  Fixed size <div> or <span> Thomas Weinert, papaya Software GmbH
  • 20. CSS Backgrounds  Gradient  Repeat in one direction Thomas Weinert, papaya Software GmbH
  • 21. Minify Javascript  Most JS libraries provide a minified version  YUI Compressor: http://developer.yahoo.com/ yui/compressor/ ▹ JS and CSS  Packer ▹ Webpage, .Net, Perl, PHP ▹ http://dean.edwards.name/packer/ Thomas Weinert, papaya Software GmbH
  • 22. #2 Use A CDN  Content Delivery Network ▹ Akamai Technologies ▹ Mirror Image Internet ▹ Limelight Networks  Bring the content to your users ▹ Geographic distance ▹ Physics is still here  Only for large sites  Dynamic content is complex Thomas Weinert, papaya Software GmbH
  • 23. Headers  Expires  Cache-Control ▹ Session-Management  304 Not Modified Thomas Weinert, papaya Software GmbH
  • 24. Expires  Apache mod_expire <IfModule mod_expires.c> ExpiresDefault quot;access plus 1 monthquot; ExpiresActive on </IfModule> Thomas Weinert, papaya Software GmbH
  • 25. Cache-Control  nocache ▹ no caching ▹ default for sessions  private ▹ cacheable in browser cache  public ▹ cacheable in browser cache and proxies Thomas Weinert, papaya Software GmbH
  • 26. 304 Not Modified  Send Etag and Modfication date ▹ Etag: quot;some hashquot; ▹ Last-Modified: Thu, 12 Sep 2008 11:00:00 GMT  Request headers ▹ If-Modified-Since: Tue, 12 Sep 2008 11:00:00 GMT ▹ If-None-Match: quot;some hashquot;  Response headers ▹ HTTP/1.1 304 Not Modified Thomas Weinert, papaya Software GmbH
  • 27. HTTPFox  Firefox Extension  Log of all HTTP requests  Not only displayed content Thomas Weinert, papaya Software GmbH
  • 28. Gzip Components  Gzip != Zip ▹ only compression ▹ no packaging ▹ tar.gz  Good browser support ▹ Accept-Encoding: gzip, deflate ▹ Content-Encoding: gzip Thomas Weinert, papaya Software GmbH
  • 29. Gzip in Apache  mod_gzip  mod_deflate ▹ filter chain, works on dynamic content, too ▹ http://httpd.apache.org/docs/2.2/mod/mod_deflate.html Thomas Weinert, papaya Software GmbH
  • 30. Gzip In PHP 5 <?php ob_start('ob_gzhandler'); ... Thomas Weinert, papaya Software GmbH
  • 31. Gzip In PHP 5 <?php if (function_exists('ob_gzhandler')) { ob_start('ob_gzhandler'); } ... Thomas Weinert, papaya Software GmbH
  • 32. Configure ETags  Browser still asks webserver  Server specific ▹ CDN ▹ Load balancer with multiple servers  Apache ▹ FileETag none  IIS ▹ http://support.microsoft.com/?id=922733 Thomas Weinert, papaya Software GmbH
  • 33. Split requests across domains  HTTP 1.1 suggests 2 parallel requests per domain  Separate content by function ▹ www.domain.tld ▹ themes.domain.tld ▹ usercontent.domain.tld (security)  Optimisation tools change the option  Consider cookie domains Thomas Weinert, papaya Software GmbH
  • 34. Reduce DNS Lookups  DNS maps host names to ips  Needs time ▹ 20-120 milliseconds  Cached in browser Thomas Weinert, papaya Software GmbH
  • 35. Avoid Redirects  Obviously additional requests  Only cached with explicit headers ▹ depends on webserver configuration  http://www.domain.tld ▹ http://www.domain.tld/ Thomas Weinert, papaya Software GmbH
  • 36. Put Stylesheets at the Top  Progressive display of the page  Page appears to load faster  W3C specifications Thomas Weinert, papaya Software GmbH
  • 37. Put Scripts at the Bottom  Scripts block parallel downloads ▹ defer attribute in MSIE  onload() event ▹ used by most libraries  Problem: document.write() ▹ Counter ▹ Banners Thomas Weinert, papaya Software GmbH
  • 38. Avoid CSS Expressions  MSIE from version 5 ▹ cross browser experience  JavaScript inside CSS  Evaluated ▹ page render ▹ resize ▹ scrolling ▹ mouse movements (hover) Thomas Weinert, papaya Software GmbH
  • 39. JavaScript And CSS Files  Do not embed JS/CSS in your pages ▹ No <script>...</script> ▹ No <style>...</style>  Separate caching headers  Revision parameter (style.css?rev=1234) ▹ Get parameter ▹ Unique URL for browser Thomas Weinert, papaya Software GmbH
  • 40. Remove Duplicate Scripts  Team size  Standard scripts ▹ XMLRPC, JQuery, Prototype  Script module for your template system  $templatesystem->addScript('foo.js'); Thomas Weinert, papaya Software GmbH
  • 41. Make Ajax Cacheable  Often AJAX applications avoid caching ▹ http://some.domain.tld/ajax.file?t=randomvalue  A lot of requests  Use more static URLs Thomas Weinert, papaya Software GmbH
  • 42. References  Slides: http://www.abasketfulofpapayas.de/  Yahoo Performance Team ▹ http://developer.yahoo.com/performance/  JS minimize ▹ http://developer.yahoo.com/yui/compressor/ ▹ http://dean.edwards.name/packer/  Apache GZIP ▹ http://httpd.apache.org/docs/2.2/mod/mod_deflate.html  No Etag in IIS ▹ http://support.microsoft.com/?id=922733 Thomas Weinert, papaya Software GmbH