Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Front-end optimization

Front-end optimization

Tools and techniques for delivering content faster

RJ Zaworski

June 19, 2014

Transcript

60 slides
  1. So why do we care? ★ 47% of consumers expect

    a web page to load in 2 seconds or less. ★ 40% of people abandon a website that takes more than 3 seconds to load. (http://blog.kissmetrics.com/loading-time/)
  2. It's even worse for mobile. “73% of mobile internet users

    say that they’ve encountered a website that was too slow to load.” (http://blog.kissmetrics.com/loading-time/)
  3. Why is it slow? ★ Bandwidth: how big is the

    pipe? ★ Volume: how much needs to be delivered?
  4. Why is it slow? ★ Bandwidth: how big is the

    pipe? ★ Volume: how much needs to be delivered? ★ Proximity: how far away are the ends?
  5. Is the pipe clogged? ★ Concurrent connections are limited per

    host ★ Browser mileage may vary (http://www.browserscope.org/?category=network)
  6. HTTP isn’t free ★ Every request has headers ★ Keep

    an eye on that ! ★ Batch overhead where possible
  7. Minify concatenated files ★ uglifyjs is pretty good ★ closure

    compiler is really good ★ Hint: build tools support these
  8. Caching: the Big Idea ★ Less distance == faster ★

    Keep content as close as possible
  9. Caching: the bad news There are only two hard things

    in Computer Science: cache invalidation and naming things. —Phil Karlton
  10. Enable browser caching ★ HTTP can help ★ Use header

    (http://www.mobify.com/blog/beginners-guide-to-http-cache-headers/)
  11. Enable browser caching ★ HTTP can help ★ Use header

    ★ Set if content will change ★ Use with dynamic content
  12. Use a Content Delivery Network ★ located near the users

    ★ replicate automagically ★ == fast
  13. Use a Content Delivery Network Share common assets with everyone

    else ★ cdnjs.com ★ jsDelivr.com ★ Google Hosted Libraries
  14. Server-side caching On the application server ★ Minimize disk I/O

    ★ Cache popular files in memory Optimize for dev time!
  15. Summing up ★ Bandwidth: how big is the pipe? ★

    Volume: how much needs to be delivered? ★ Proximity: how far away are the ends?
  16. Summing up ★ Bandwidth: avoid blocking behaviors ★ Volume: minimize

    request count and size ★ Proximity: use browser caching and a CDN
  17. Summing up ★ Bandwidth: avoid blocking behaviors ★ Volume: minimize

    request count and size ★ Proximity: use browser caching and a CDN ★ Optimize for dev time!

More Decks by RJ Zaworski

Other Decks in Programming