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

WebPerformance Meetup in Cologne (Feb. 2017)

WebPerformance Meetup in Cologne (Feb. 2017)

At the WebPerformance Meetup in Cologne I presented this talk about how we tackle WebPerformance at https://www.vutuv.de

https://www.meetup.com/de-DE/cologne-germany-high-performance-website-optimization-group/events/236635872/

Avatar for Stefan Wintermeyer

Stefan Wintermeyer

February 02, 2017
Tweet

More Decks by Stefan Wintermeyer

Other Decks in Technology

Transcript

  1. I’m not going to cover all the basics. I’m going

    to cherry pick 4 topics. To cover the basics:
 http://hpbn.co
  2. We jump through hoops to achieve this. Make no mistake:

    This is not easy. Spoiler alert: We don’t use JavaScript.
  3. Jakob Nielsen’s book „Usability Engineering“ from 1993 Delay User reaction

    0 - 100 ms Instant 100 - 300 ms Feels sluggish 300 - 1000 ms Machine is working… 1 s+ Mental context switch 10 s+ I’ll come back later…
  4. Web Search Delay Experiment Type of Delay Delay (ms) Duration

    (weeks) Impact on Avg. Daily Searches Pre-header 100 4 -0.20 % Pre-header 200 6 -0.59% Post-header 400 6 0.59% Post-ads 200 4 0.30% Source: https://www.igvita.com/slides/2012/webperf-crash-course.pdf
  5. Download a 58 kB file from a US east cost

    server to a client in Frankfurt. Protocol: HTTP Roundtrip Time: 80 ms Zeit client server 0 ms SYN --> <-- SYN,ACK 80 ms ACK --> GET --> <-- 10 TCP Segmente (14.600 Bytes) 160 ms ACK --> <-- 20 TCP Segmente (29.200 Bytes) 240 ms ACK --> <-- 40 TCP Segmente (15.592 Bytes) 320 ms ACK --> Time to download a 58 kB file: 320 ms
  6. TCP Slow-Start KB 0 55 110 165 220 Roundtrip 1.

    2. 3. 4. 213 99 42 14 114 57 28 14
  7. HTTPS KB 0 50 100 150 200 Roundtrip 1. 2.

    3. 4. 199 85 28 0 114 57 28 14 SSL
  8. Above the fold target: 28 KB KB 0 50 100

    150 200 Roundtrip 1. 2. 3. 4. 199 85 28 0 114 57 28 14 SSL
  9. Set a time budget and stick to it! Our time

    budget is 1 second for Germany.
  10. What we can control: • Transfer Protocol (e.g. HTTP/1.1 vs.

    HTTP/2.0) • Compression (e.g. gzip vs. zopfli vs. brotli) • Amount of files • File size • Time the server needs to generate the HTML • Content (e.g. HTML, CSS, JavaScript, Images)
  11. Phoenix is about 
 10 times faster 
 than Ruby

    on Rails or Django. The functional programming language Elixir has a lot of more advantages, but today I’m only talking about speed.
  12. guetzli -quality 75 a.jpg /tmp/q75-a.jpg convert a.jpg /tmp/q75-a.jpg -fx 'hypot(65-i,

    65-j) < 65 ? u : v' new_a.jpg https://github.com/google/guetzli
  13. By that we save 15-20% of file size. BTW: We

    optimize during off peak times.
  14. /var/www/vutuv/ cache - index.html - index.html.gz users - xyz.html -

    xyz.html.gz Always provide a compressed version of a static file.
  15. Fill the Steps KB 0 50 100 150 200 Roundtrip

    1. 2. 3. 4. 199 85 28 0 114 57 28 14 SSL