Slide 1

Slide 1 text

HTTP/2 is coming! Unbundle all the things? main.js

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

HTTP/2 is coming! Unbundle all the things? main.js

Slide 7

Slide 7 text

HTTP/2 is here! Unbundle all the things? main.js

Slide 8

Slide 8 text

Jumping to conclusions

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

TCP Three Way Handshake Server Client SYN (got something) SYN+ACK (waddya want) ACK + Data image-1.jpg

Slide 14

Slide 14 text

Head of line blocking

Slide 15

Slide 15 text

HTTP1.1!! We need something better than 1 request 1 Request 1 Requests 2

Slide 16

Slide 16 text

No content

Slide 17

Slide 17 text

The best request is a request not being made

Slide 18

Slide 18 text

triggering requests src=“…” url(…) link href=“…”

Slide 19

Slide 19 text

reducing requests • Concatenation … 1 JS file, 1 CSS file • Image sprites • Inlining stuff

Slide 20

Slide 20 text

httparchive.org

Slide 21

Slide 21 text

40 TCP connections on average

Slide 22

Slide 22 text

No content

Slide 23

Slide 23 text

CSS JS

Slide 24

Slide 24 text

CSS JS

Slide 25

Slide 25 text

CSS JS JPG

Slide 26

Slide 26 text

CSS JS JPG

Slide 27

Slide 27 text

Server Client HTTP/2 Getting stuff …

Slide 28

Slide 28 text

HTTP 1.1 index.html a.js b.js c.js d.js

Slide 29

Slide 29 text

HTTP 2 index.html a.js b.js c.js d.js

Slide 30

Slide 30 text

HTTP 2 index.html a.js b.js c.js d.js

Slide 31

Slide 31 text

HTTP 2 index.html a.js b.js c.js d.js

Slide 32

Slide 32 text

No content

Slide 33

Slide 33 text

Desktop HTTP/2 ~1.8s HTTP1.1 ~2.6s

Slide 34

Slide 34 text

mobile connections HTTP1.1 ~3.37s HTTP2 ~1.72

Slide 35

Slide 35 text

A slow website on HTTP1.1 will still be a slow website on HTTP2

Slide 36

Slide 36 text

Performance guidelines • Minifying JS and CSS • Optimising images • Gzipping your content • Do not block rendering These all still hold up!

Slide 37

Slide 37 text

HTTP/2 is not (only) for Performance Optimisation, it is an Engineering Opportunity

Slide 38

Slide 38 text

The best request is a request not being made

Slide 39

Slide 39 text

HTTP 2 index.html a.js b.js c.js d.js

Slide 40

Slide 40 text

HTTP 2 index.html a.js b.js d.js

Slide 41

Slide 41 text

No content

Slide 42

Slide 42 text

No content

Slide 43

Slide 43 text

The best request is a request not being made

Slide 44

Slide 44 text

agent.v1.svg cloud.v1.svg

Slide 45

Slide 45 text

ExpiresDefault "access until Judgement Day”

Slide 46

Slide 46 text

agent.v1.svg cloud.v2.svg

Slide 47

Slide 47 text

So … yes!

Slide 48

Slide 48 text

But wait …

Slide 49

Slide 49 text

No content

Slide 50

Slide 50 text

agent.v1.svg cloud.v2.svg

Slide 51

Slide 51 text

agent.v1.svg

Slide 52

Slide 52 text

agent.v1.svg

Slide 53

Slide 53 text

agent.v1.svg That’s what we call a dependency

Slide 54

Slide 54 text

In JavaScript payment.js hyped- framework.js lodash.js call-to-action.js validation.js

Slide 55

Slide 55 text

In JavaScript payment.v1.js hyped- framework.v1 .js lodash.v1..js call-to- action.v1.js validation.v1.js

Slide 56

Slide 56 text

In JavaScript payment.v1.js hyped- framework.v1 .js lodash.v1..js call-to- action.v2.js validation.v1.js

Slide 57

Slide 57 text

In JavaScript payment.v1.js hyped- framework.v1 .js lodash.v1..js call-to- action.v2.js validation.v2.js

Slide 58

Slide 58 text

Frequency of change Libraries Utilities Module Module Module Module rigid high frequency some frequency

Slide 59

Slide 59 text

Optimised utility layer Libraries Utilities Module Module Module rigid high frequency some frequency

Slide 60

Slide 60 text

Extending the utility layer Libraries Utilities Module Module Module rigid high frequency some frequency

Slide 61

Slide 61 text

Files to change Libraries Utilities Module Module Module rigid high frequency some frequency

Slide 62

Slide 62 text

Tree Shaking // module.js import { helper } from ‘pretty-huge-utility-lib’; helper(10);

Slide 63

Slide 63 text

Tree Shaking // module.js import { helper } from ‘pretty-huge-utility-lib’; helper(10); // module-built.js function neededByHelper(inp) { return true; } function helper(inp) { return neededByHelper(inp); } helper(10);

Slide 64

Slide 64 text

Frequency of change Libraries Module Module Module rigid high frequency Module

Slide 65

Slide 65 text

What to do with your application?

Slide 66

Slide 66 text

The best request is a request not being made

Slide 67

Slide 67 text

Create independent, exchangeable components

Slide 68

Slide 68 text

Create small, detached bundles

Slide 69

Slide 69 text

Code duplication and weight is okay if the file can stay longer

Slide 70

Slide 70 text

Think about long lasting applications and frequency of change

Slide 71

Slide 71 text

JS framework HTTP/2 bundling predictions!

Slide 72

Slide 72 text

Tools not Rules

Slide 73

Slide 73 text

No content

Slide 74

Slide 74 text

@ddprrt Thank you Budapest!

Slide 75

Slide 75 text

@scriptconf @stahlstadtjs