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

Web Performance

Web Performance

A talk by Joacim Gunnarsson about Web Performance in general. It's focused on the client side and includes concrete tips how you can improve and plan the performance of your site.

Joacim Gunnarsson

November 14, 2015
Tweet

Other Decks in Programming

Transcript

  1. WEB PERFORMANCE Knowit Reaktor Stockholm [email protected] http://joacim.me Knowit Developer Summit

    2015 Saturday the 14th of November at 13:50 Radisson Blu Waterfront Stockholm, Room 24 JOACIM GUNNARSSON
  2. Agenda • Why performance • Perception of Time • Aim

    for one second • How do I test my site? ◦ Speed Index • Latency vs Bandwidth • TCP Connections • SlowIt - Let’s fix it • Prefetching • Perceived Performance • Performance planning • The Future… Is here
  3. Why performance? • 47% of the users expected a web

    page to load in less than 2 seconds • 40% of the users abandon sites with page load high than 3 seconds http://blog.jamesdbloom.com/WhyDoesWebPerformanceMatter.html
  4. Why performance? • Google - 500ms slowdown equals 20% decrease

    in ad revenue. • Amazon - 100ms slowdown – can mean a 1% decrease in revenue.
  5. Why performance? • Google - 500ms slowdown equals 20% decrease

    in ad revenue. • Amazon - 100ms slowdown – can mean a 1% decrease in revenue. • Yahoo - 400ms improvement in load time translated to a 9% increase in traffic.
  6. Why performance? • Google - 500ms slowdown equals 20% decrease

    in ad revenue. • Amazon - 100ms slowdown – can mean a 1% decrease in revenue. • Yahoo - 400ms improvement in load time translated to a 9% increase in traffic. • Google is so committed to speed and User Experience that they are, right within their search results, experimenting with affixing a "SLOW" label to slower websites
  7. Preception of time “Alice: How long is forever? White Rabbit:

    Sometimes, just one second.” ― Lewis Carroll, Alice in Wonderland http://www.smashingmagazine.com/2015/09/why-performance-matters-the-perception-of-time/
  8. Preception of time • Objective Time • Psychological Time Instant

    0.1 - 0.2 second Immidiate 0.5 - 1 second User flow 2 - 5 seconds Attention span 5 - 10 seconds http://www.smashingmagazine.com/2015/09/why-performance-matters-the-perception-of-time/
  9. Preception of time • Objective Time • Psychological Time Instant

    0.1 - 0.2 second Immidiate 0.5 - 1 second User flow 2 - 5 seconds Attention span 5 - 10 seconds Average attention span 8 seconds
  10. What is latency? Generation Data rate Latency 2G 100–400 Kbit/s

    300–1000 ms 3G 0.5–5 Mbit/s 100–500 ms 4G 1–50 Mbit/s < 100 ms http://chimera.labs.oreilly.com/books/1230000000545/ch07.html#_evolution_of_3g_technologies
  11. TCP Slow start Three-Way Handshake • Always Keep Alive •

    Minimize the number of your HTTP requests for a good mobile experience • Can we deliver the page in one round trip? http://chimera.labs.oreilly.com/books/1230000000545/ch07.html#RRC
  12. SlowIt - Let’s fix it! • SlowIt Landing Page ◦

    Bootstrap 3 ◦ Responsive • Let’s make it better! • Google PageSpeed Insights Score above 85 is good
  13. Images - Scale Serve scaled images • Scale • Choose

    the right format • Remove meta tags • Try SVG https://developers.google.com/web/fundamentals/performance/
  14. And a lot of other stuff to optimize • There

    are bunch of other things you can do to optimize https://developers.google.com/web/fundamentals/performance/
  15. Web performance budget Web performance budget • Look at competitors

    • Speedindex of 2500 • 14 kb rule • Images max weight 100kb • Total weight of all images less than 2 mb • Max number of HTTP requets 80 • The total weight of the website should not exceed 5 mb SEPARATION OF CONCERNS - Andy Hume • Core content • Enhancement • Leftovers https://vimeo.com/77967591
  16. HTTP 2 • Orgins from SPDY by Google • Binary

    Framing Layer • Header Compression • One TCP connection • Multiplexing • Server push • And more Anti-patterns • Images Sprites • Merging css, js http://chimera.labs.oreilly.com/books/1230000000545/ch07.html#_evolution_of_3g_technologies “when we download the top 25 websites over simulated home network connections, we see a significant improvement in performance—pages loaded up to 55% faster.” -- A 2x Faster Web Chromium Blog
  17. SlowIt - Let’s fix it! Takeaways • Performance is important

    • Aim for 1 second ATF rendering • Webpagetest.org - Start testing today! • Speed Index - Good mesurement • Keep number of HTTP requets low - Latecy is evil. • 14 KB with 10 Segments • Block rendering • Gzip • Web performance budget - 20% improvements • HTTP 2