$ cd ~/talks/performance-beyond-your-portfolio

Performance: Beyond Your Portfolio⁠

Google's RAIL model for what fast feels like, quick wins you can ship today, and how HTTP/2 changes the way the web is delivered.

$ open slides

  1. Performance: Beyond Your Portfolio FITC WEB UNLEASHED - OCTOBER 4TH, 2016
  2. Welcome.
  3. * jokes may not be as funny
  4. Welcome.
  5. *
  6. Luke DeWitt WEB TEAM LEAD / DAD / ALL AROUND GOOD GUY … who are you?
  7. RAIL
  8. RESPONSE
  9. ANIMATION
  10. IDLE
  11. LOAD
  12. Response Animation Idle Load
  13. It’s all about the user…
  14. Response Times 0.1 second “Instantaneous Reaction” 1 second “Uninterrupted Flow of Thought” 10 seconds “User’s Attention”
  15. Show of hands…
  16. SQUIRREL!!!
  17. Response Animation Idle Load
  18. Response 100ms = Lag Immediate, with substance User Perceived Performance
  19. Animation
  20. 60 FPS
  21. 60 FPS 16ms to react
  22. Idle Simple tasks Aim for < 50ms
  23. Load
  24. SQUIRREL!!!
  25. Load Load in < 1s Focus on critical path rendering User perceived performance
  26. Critical Path Rendering 0.0s 0.3s 0.8s 1.2s 1.5s
  27. Critical Path CSS
  28. Eliminate Render Blocking JavaScript
  29. Render Blocking LOADED IN <head> LOADED BEFORE </body>
  30. Image Optimizations
  31. Image Compression TinyPNG https://tinypng.com
  32. 1.7MB 305.9kb Image Compression -82%
  33. Responsive Images
  34. Lazy Loading Images
  35. File Compression Gzip
  36. File Delivery
  37. HTTP/2
  38. HTTP/2 == SPDY?
  39. • Concatenate files • Inline Assets • Combine Images • Domain Sharding
  40. Components of an HTTP Request – Chapter 10. Primer on Web Performance
  41. What’s cool in HTTP/2
  42. Binary Protocol
  43. Multiplexing
  44. HTTP/2 for a Faster Web
  45. HTTP/2 for a Faster Web
  46. CloudFlare - What is HTTP/2?
  47. DEMO
  48. Header Compression
  49. *HTTP/2 requires TLS
  50. Getting Ready
  51. Getting Ready
  52. Browser Support
  53. Node.js PHP Go Scala Microsoft ISS CloudFlare CloudFront Akamai nginx Apache
  54. HTTP/2 is here!
  55. Questions? redspace.com / T (902) 444.3490 FACEBOOK REDspace TWITTER @theREDspace LINKEDIN The REDspace LUKE DEWITT @whatadewitt
  56. Questions? redspace.com / T (902) 444.3490 FACEBOOK REDspace TWITTER @theREDspace LINKEDIN The REDspace LUKE DEWITT @whatadewitt
  57. THANK YOU! Oh, by the way, we’re hiring! http://redspace.recruiterbox.com
1 / 68
download pdf ↓

$ cat notes.md

Jokes may not be as funny.

It’s all about the user

Google’s RAIL model breaks performance into what people actually feel:

  • Response: react within 100ms, or it feels like lag. Respond immediately, and with substance.
  • Animation: 60 frames per second, which gives you about 16ms per frame.
  • Idle: keep background work in small chunks, under 50ms.
  • Load: get something useful on screen in under a second.

It lines up with the classic response-time limits: 0.1 seconds feels instantaneous, 1 second keeps the flow of thought, and 10 seconds is about as long as you’ll hold someone’s attention.

Quick wins

  • Critical path CSS: inline what the first screen needs so it can render before the rest arrives.
  • Render-blocking JavaScript: move scripts from the <head> to just before </body>.
  • Image compression: one image went from 1.7MB to 305.9KB (-82%) through TinyPNG.
  • Responsive images: srcset so phones don’t download desktop images.
  • Lazy loading: only load images when they’re about to be seen.
  • File compression: gzip everything you can.

HTTP/2

HTTP/2 grew out of Google’s SPDY. A lot of what we did to speed up HTTP/1.1 was a workaround for its limits: concatenating files, inlining assets, combining images into sprites, and sharding across domains. HTTP/2 makes most of those unnecessary:

  • Binary protocol: more compact and less error-prone to parse than text.
  • Multiplexing: many requests and responses share one connection at the same time, instead of queueing up behind each other.
  • Header compression: repeated headers aren’t sent over and over.

The catch: browsers only speak HTTP/2 over TLS, so you need HTTPS. Support was already broad across browsers, servers (Node.js, PHP, Go, nginx, Apache, IIS) and CDNs (CloudFlare, CloudFront, Akamai). HTTP/2 is here.

Further reading from the slides: Ilya Grigorik’s “Primer on Web Performance” chapter in High Performance Browser Networking, “HTTP/2 for a Faster Web”, and CloudFlare’s “What is HTTP/2?”.

visitor@whatadewitt: ~