• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
The Need For Speed
 

The Need For Speed

on

  • 4,489 views

 

Statistics

Views

Total Views
4,489
Views on SlideShare
3,168
Embed Views
1,321

Actions

Likes
2
Downloads
27
Comments
1

12 Embeds 1,321

http://www.andysnotebook.com 883
http://andydavies.me 213
http://feeds.feedburner.com 72
http://andysnotebook.typepad.com 53
http://127.0.0.1 47
http://andysnotebook.com 37
http://www.linkedin.com 5
http://webcache.googleusercontent.com 3
http://192.168.1.151 3
http://translate.googleusercontent.com 2
http://cloud.feedly.com 2
http://reader.aol.com 1
More...

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel

11 of 1 previous next

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • Performance = How quickly something happens, i.e. whether it happens fast enough to satisfy users Scalability = Maintaining reliability and performance under load
  • Yahoo stats on the faster pages are the more users click
  • Amazon’s quote on how revenue falls as page load time falls Shopzilla
  • Water fall of http://guardian.co.uk produced by http://webpagetest.org via Frankfurt / IE8 / 1.5Mbps 191 Components!!! Main html content takes 788ms, but page doesn’t start rendering until 8s!!! Can also generate these with Firebug / Webkit Inspector / MSFast / AOL PageTest
  • Compress Make sure server sets the vary: accept-encoding header for both compressed and uncompressed content so proxy caches serve the correct version to client browsers Trade off between compression level and server CPU used – deflate uses less CPU (probably due to lack of CRC check), some thoughts that it also uses less CPU to decompress Minify Can only serve out compressed content if the request has Accept-Encoding: gzip, deflate some security products mangle this header! ( http://assets.en.oreilly.com/1/event/29/Beyond%20Gzipping%20Presentation.pdf ) Minifying CSS and JS reduces its size, plus it will still compress further is deflate/gzip is available Concise Markup Use HTML5 features e.g. <!doctype HTML>, drop type from stylesheet links and scripts. Watch out for inline styles, “divitis”, long identifiers, un-needed elements and attributes Remove unused styles Un-needed HTTP headers Some installations add extra server headers e.g. PHP and ASP.NET both add X-Powered-By they’re not needed by the client so can be removed
  • Image formats jpg – lossy images e.g. photos etc. png – everything you might have used a gif for in the past. gif – small loading animations, nothing else! Multiple types of png: Truecolour, Grayscale, Indexed, multiple levels of transparency – watch out for PNG8 transparency in Photoshop with IE6 Optimise Make sure the images are properly compressed – plenty of optimisation tools (smush.it, optipng, pngcrush etc) around Comparison of optimisers - http://www.phpied.com/give-png-a-chance / Gradients / Rounded corners Use CSS3 and degrade for browsers that don’t support them (or offer a slight different experience) Reuse images with rotation An up arrow is a down arrow rotated through 180°
  • ASDL Upstream and downstream speeds don’t match i.e. at home I have 448Kbps upstream and 4.4Mbps downstream Cookieless (sub-)domain Using a sub-domain? Cookies can be big - 4KB – that’s 4KB that gets sent to the browser, and then back to the server Watch out for things like Google Analytics which will set a cookie across all sub-domains i.e. .domain.com http://yuiblog.com/blog/2007/03/01/performance-research-part-3/ Using a separate (sub-)domain enables easy transition to a CDN in the future. A simple way to serve static content out from another domain is run it from the same web-server as the rest of the site (or something like an nginx proxy in front of the server, has other performance benefits too) POST vs GET POST – Headers get sent then waits for server to acknowledge headers before data is sent. GET – May fit a single packet, responses are cacheable .NET Many applications rely on POST with hidden form fields like viewstate – viewstate is essentially sending state to the client and back to the server instead of keeping on the server.
  • Merge CSS, JS Multiple CSS or JS files, can they be merged? CSS Sprites Create a tile of images and use CSS to pick out the required image Cache Directives Set Expires or Cache-Control header far in the future for static components e.g. images, css, js etc. but need to version the components if updated e.g. build number, fingerprint (SHA, MD5 etc) Alternatives to external images CSS3 – gradients, rounded corners dataURIs – base64 encoded in the stylesheet, not universal (e.g. alternative needed for IE6 / IE7), bulks out stylesheet leading to lager stylesheets
  • Use SpriteMe ( http:// spriteme.org / ) to automagically produce a set of sprites for an existing page
  • Javascript blocking rendering http://www.stevesouders.com/blog/2009/05/06/positioning-inline-scripts/

The Need For Speed The Need For Speed Presentation Transcript

  • The Need For Speed… BarCamp Stroud, 13 Sep 2010 … why slow page load times matter …some things you can do about it @andydavies
  • Straw poll: Who does what?
  • Me…
    • Run development and operations for Kerboodle
    • Subscription based service for secondary education - GCSE/AS/A2 etc.
    • 300,000+ “paid for” users
    • Peak 1 million page views a day (but very peaky)
    • Rich media content
    • Congested connections:
        • Average School: 300+ PCs, 16Mbps pipe = 64Kpbs/user!
  • Slow pages = poor user experience = less time on site = lower conversions
  •  
  •  
  •  
  • What affects performance?
    • Request size
    • Time to generate response
    • Response size
    • Number of components
    • Bandwidth
    • Latency
    • Browser
    • Network gateways
    • Security Software
    Things we can influence Things we can’t control
  • What does a page load look like?
  • So, how can we speed things up?
  • Shrink the response
    • Compress (deflate/gzip)
      • html, css, js, xml, json etc.
    • Minify
      • css & js
    • Concise markup
    • Remove un-needed HTTP headers
      • X- headers
  • Images
    • Pick the right format
      • jpg
      • png
      • gif
    • Optimise
    • Do you need an image?
      • CSS3
      • Canvas/SVG
  • Spot the difference
  • The difference… gif 26KB png 9KB
  • A Song for Europe Richard http://givepngachance.com
  • Shrink the request
    • A is for Asymmetric (ADSL)
      • Upload speed != download speed
    • Static content from a cookieless domain (take care if using sub-domain)
    • POST vs GET
    • .NET – Here be dragons!
  • Reduce the requests
    • Merge CSS, JS
    • Merge images and use CSS Sprites
    • Set cache directives
    • Do you need an external image?
      • CSS3
      • dataURIs
  • CSS Sprites
    • http://www.google.co.uk/images/nav_logo16.png
    .icon { background:url(/images/nav_logo16.png) background-position: -40px -85px; height: 19px; width: 19px; }
  • Browsers Block
    • Stylesheets
      • Block page rendering until all external stylesheets have been downloaded
    • Javascript
      • External scripts block rendering of elements below them
      • Inline scripts block rendering of everything
  • 3 rd Party Scripts
    • e.g. Share This, Google Analytics, Widgets etc.
    • What happens if the third party is broken or slow?
    • Simulate with Charles - reduce bandwidth or increase latency for third party URLs
    • Is there an asynchronous version available?
  • Other things…
    • Watch the limit on number of parallel downloads
    • Specify a charset
      • Content-Type: text/html; charset=utf-8
      • <meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; utf-8&quot;>
    • Flush the response early?
    • e.g. after <head>, header, before footer etc.
  • Handy Tools
    • YSlow
    • http://developer.yahoo.com/yslow/
    • PageSpeed http://code.google.com/speed/page-speed/
    • WebPageTest
      • http://www.webpagetest.org/
  • The Giants!
    • Steve Souders
    • @souders
      • http://www.stevesouders.com/blog/
    • Stoyan Stefanov
      • @stoyanstefanov
      • http://www.phpied.com/
  • Thanks for listening… http://slideshare.net/andydavies/the-need-for-speed @andydavies Questions… Comments… Thoughts?
  • Find Out More…
    • Google Guidelines
    • http://code.google.com/speed/page-speed/docs/rules_intro.html/
    • Yahoo Guidelines
    • http://developer.yahoo.com/performance/rules.html
    • Blogs
      • http://www.webperformancetoday.com/
      • http://blog.patrickmeenan.com/
      • http://pipes.yahoo.com/stoyan/perfplanet/
  • Waterfall Generators
    • WebPageTest - http://webpagetest.org/
    • Firefox - Firebug
    • Chrome/Safari – Inspector
    • AOL PageTest - http://pagetest.wiki.sourceforge.net/
    • MSFast - http://msfast.myspace.com/
  • Traffic Inspectors
    • Charles
    • http://www.charlesproxy.com/
    • HTTPWatch
    • http://www.httpwatch.com/
    • Fiddler
    • http://www.fiddler2.com/
    • Wireshark
    • http://www.wireshark.org/
  • CSS & Javascript Minifiers
    • CSS
    • YUI Compressor - http://developer.yahoo.com/yui/compressor/
    • CSS Tidy - http://csstidy.sourceforge.net/
    • Javascript
    • YUI Compressor - http://developer.yahoo.com/yui/compressor/
    • JSMin - http://crockford.com/javascript/jsmin
    • Closure - http://code.google.com/intl/pl/closure/compiler/
  • Optmising Images
    • General list
      • http://www.phpied.com/big-list-image-optimization-tools/
    • Yahoo Smush.it
    • http://www.smushit.com
    • Gifsicle
    • http://www.lcdf.org/gifsicle/
    • PNG
    • http://www.phpied.com/give-png-a-chance/
  • Image credits
    • Slide 1: © Chris-Håvard Berge 2009 - http://www.flickr.com/photos/chberge/3803475294/
    • Slide 2: © Dominique Archambault 2009 - http://www.flickr.com/photos/chezdom/3268236588/
    • Slide 4: © Chris Miller 2008 - http://www.flickr.com/photos/thatmushroom/2299645283/
    • S lides 5, 6, 7: StrangeLoop Networks - http://strangeloopnetworks.com/
    • Slide 8: © eko - http://www.flickr.com/photos/ekosystem/3117095951/
    • Slide 18: Google - http://www.google.co.uk/