+ All Categories
Home > Technology > InterCon 2016 - HTTP/2 for Web Application Developers

InterCon 2016 - HTTP/2 for Web Application Developers

Date post: 16-Apr-2017
Category:
Upload: imasters
View: 143 times
Download: 0 times
Share this document with a friend
55
HTTP 2.0
Transcript
Page 1: InterCon 2016 - HTTP/2 for Web Application Developers

HTTP 2.0

Page 2: InterCon 2016 - HTTP/2 for Web Application Developers

@sergio_caelum sergiolopes.org

Page 3: InterCon 2016 - HTTP/2 for Web Application Developers

REVIEW

HTTP

Page 4: InterCon 2016 - HTTP/2 for Web Application Developers

$ telnet www.alura.com.br 80 Trying 64.233.171.121... Connected to ghs.googlehosted.com. Escape character is '^]'.

GET / HTTP/1.1 Host: www.alura.com.br

HTTP/1.1 200 OK Content-Type: text/html; charset=utf-8 Vary: Accept-Encoding,User-Agent Content-Language: pt-br Date: Thu, 01 Apr 2017 18:37:18 GMT Server: Google Frontend Cache-Control: private

<!DOCTYPE html><html><head><title>Caelum</title>

Page 5: InterCon 2016 - HTTP/2 for Web Application Developers

TEXTO

$ telnet www.alura.com.br 80 Trying 64.233.171.121... Connected to ghs.googlehosted.com. Escape character is '^]'.

GET / HTTP/1.1 Host: www.alura.com.br

HTTP/1.1 200 OK Content-Type: text/html; charset=utf-8 Vary: Accept-Encoding,User-Agent Content-Language: pt-br Date: Thu, 01 Apr 2017 18:37:18 GMT Server: Google Frontend Cache-Control: private

<!DOCTYPE html><html><head><title>Caelum</title>

Page 6: InterCon 2016 - HTTP/2 for Web Application Developers

REQUEST

RESPONSE

$ telnet www.alura.com.br 80 Trying 64.233.171.121... Connected to ghs.googlehosted.com. Escape character is '^]'.

GET / HTTP/1.1 Host: www.alura.com.br

HTTP/1.1 200 OK Content-Type: text/html; charset=utf-8 Vary: Accept-Encoding,User-Agent Content-Language: pt-br Date: Thu, 01 Apr 2017 18:37:18 GMT Server: Google Frontend Cache-Control: private

<!DOCTYPE html><html><head><title>Caelum</title>

Page 7: InterCon 2016 - HTTP/2 for Web Application Developers

... ESPERA ...

REQUEST

RESPONSE

$ telnet www.alura.com.br 80 Trying 64.233.171.121... Connected to ghs.googlehosted.com. Escape character is '^]'.

GET / HTTP/1.1 Host: www.alura.com.br

HTTP/1.1 200 OK Content-Type: text/html; charset=utf-8 Vary: Accept-Encoding,User-Agent Content-Language: pt-br Date: Thu, 01 Apr 2017 18:37:18 GMT Server: Google Frontend Cache-Control: private

<!DOCTYPE html><html><head><title>Caelum</title>

Page 8: InterCon 2016 - HTTP/2 for Web Application Developers

MÉTODO E URL

STATUS

RESPOSTA

$ telnet www.alura.com.br 80 Trying 64.233.171.121... Connected to ghs.googlehosted.com. Escape character is '^]'.

GET / HTTP/1.1 Host: www.alura.com.br

HTTP/1.1 200 OK Content-Type: text/html; charset=utf-8 Vary: Accept-Encoding,User-Agent Content-Language: pt-br Date: Thu, 01 Apr 2017 18:37:18 GMT Server: Google Frontend Cache-Control: private

<!DOCTYPE html><html><head><title>Caelum</title>

Page 9: InterCon 2016 - HTTP/2 for Web Application Developers

HEADERS

HEADERS

$ telnet www.alura.com.br 80 Trying 64.233.171.121... Connected to ghs.googlehosted.com. Escape character is '^]'.

GET / HTTP/1.1 Host: www.alura.com.br

HTTP/1.1 200 OK Content-Type: text/html; charset=utf-8 Vary: Accept-Encoding,User-Agent Content-Language: pt-br Date: Thu, 01 Apr 2017 18:37:18 GMT Server: Google Frontend Cache-Control: private

<!DOCTYPE html><html><head><title>Caelum</title>

Page 10: InterCon 2016 - HTTP/2 for Web Application Developers

texto

request > espera > responseheaders

HTTP

Page 11: InterCon 2016 - HTTP/2 for Web Application Developers

cliente servidor

cliente servidor

HTTP 1.1

CONEXÃO TCP

REQUEST

REQUEST

CONEXÃO TCP

Page 12: InterCon 2016 - HTTP/2 for Web Application Developers

cliente servidor

REQUEST

REQUEST #2

REQUEST #3

CONEXÃO TCP

Page 13: InterCon 2016 - HTTP/2 for Web Application Developers

cliente servidor

TCP HANDSHAKE

REQUEST

REQUEST #2

REQUEST #3

cliente servidor

TCP HANDSHAKE

REQUEST

REQUEST #2

REQUEST #3

cliente servidor

TCP HANDSHAKE

REQUEST

REQUEST #2

REQUEST #3

cliente servidor

TCP HANDSHAKE

REQUEST

REQUEST #2

REQUEST #3

cliente servidor

TCP HANDSHAKE

REQUEST

REQUEST #2

REQUEST #3

cliente servidor

TCP HANDSHAKE

REQUEST

REQUEST #2

REQUEST #3

de 4 a 8 conexões

Page 14: InterCon 2016 - HTTP/2 for Web Application Developers

OTIMIZAÇÕES WEBJUNTAR CSS E JS SPRITES INLINE DE RECURSOS

GZIP MINIFICAÇÃO DOMÍNIOS SEM COOKIES

MÚLTIPLOS HOSTNAMES

diminuir requests

diminuir tráfego

paralelizar requests

Page 15: InterCon 2016 - HTTP/2 for Web Application Developers

O NOVO

HTTP/2

Page 16: InterCon 2016 - HTTP/2 for Web Application Developers

GET / HTTP/1.1 Host: www.alura.com.br

HTTP/1.1 200 OK Content-Type: text/html; charset=utf-8 Content-Language: pt-br Date: Thu, 01 Apr 2017 18:37:18 GMT Cache-Control: private

<!DOCTYPE html><html><head><title>Alura</title> <meta name=viewport content=width=device-width> <meta name=description content="Cursos online de tecnologia, programação, front-end, mobile, design, ux, infra e muito mais"><style>

HTTP/1.1

Page 17: InterCon 2016 - HTTP/2 for Web Application Developers

GET / HTTP/1.1 Host: www.alura.com.br Accept-Encoding: gzip

HTTP/1.1 200 OK Content-Type: text/html; charset=utf-8 Content-Language: pt-br Date: Thu, 01 Apr 2017 18:37:18 GMT Cache-Control: private Content-Encoding: gzip Vary: Accept-Encoding

??[mŚ???,l?T?%.?JI?;1?R0??E?д?H{{?un??Tm??:?U?5DI??su?

L??!???ӵm?_?\{-??bՓ?u??6?1,W??N?C.?0?f*??ꮘ?BV?????!#m|?x???L? Q???֝?U?.?MZ跘?M?JN_?I??RNN???}Y??????cM?<?T?l

U????8?Π???id?c?8)E8??%:?$D*ⰹ?????$4???j?F?

((R2[??O?;s??? ާy\??Fd⒙HK?x?-?$???ȈȈ??????????O

GZIP

HTTP/1.1

Page 18: InterCon 2016 - HTTP/2 for Web Application Developers

?c?8)E8??%:?$

?T?%.?JI?;1?R ,l?T?%.?JI?;1?R ?c?8)E8??%:?$

??[mŚ???,l?T?%.?JI?;1?R0??E?д?H{{?un??Tm??:?U?5DI??su?

L??!???ӵm?_?\{-??bՓ?u??6?1,W??N?C.?0?f*??ꮘ?BV?????!#m|?x???L? Q???֝?U?.?MZ跘?M?JN_?I??RNN???}Y??????cM?<?T?l

U????8?Π???id?c?8)E8??%:?$D*ⰹ?????$4???j?F?

((R2[??O?;s??? ާy\??Fd⒙HK?x?-?$???ȈȈ??????????O

HPACK

GZIP

HTTP/2.0

Page 19: InterCon 2016 - HTTP/2 for Web Application Developers

?????????

??????? ???????? ????????

?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

HPACK

GZIP

TLS

TLS

HTTP/2.0

Page 20: InterCon 2016 - HTTP/2 for Web Application Developers

TUDO BINÁRIO HPACK GZIP* TLS*

Page 21: InterCon 2016 - HTTP/2 for Web Application Developers

:method: GET :path: / Host: www.alura.com.br Accept: text/html,application/xhtml+xml;q=0.9,image/jpeg Accept-Encoding: gzip User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) Cookie: SID=786dads78asdbad876asdhjvb28

:method: GET :path: /style.css Host: www.alura.com.br Accept: text/html,application/xhtml+xml;q=0.9,image/jpeg Accept-Encoding: gzip User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) Cookie: SID=786dads78asdbad876asdhjvb28

HTTP/1.1

Page 22: InterCon 2016 - HTTP/2 for Web Application Developers

:method: GET :path: / Host: www.alura.com.br Accept: text/html,application/xhtml+xml;q=0.9,image/jpeg Accept-Encoding: gzip User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) Cookie: SID=786dads78asdbad876asdhjvb28

:method: GET :path: /style.css Host: www.alura.com.br Accept: text/html,application/xhtml+xml;q=0.9,image/jpeg Accept-Encoding: gzip User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) Cookie: SID=786dads78asdbad876asdhjvb28

HTTP/1.1

Page 23: InterCon 2016 - HTTP/2 for Web Application Developers

:method: GET :path: / Host: www.alura.com.br Accept: text/html,application/xhtml+xml;q=0.9,image/jpeg Accept-Encoding: gzip User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) Cookie: SID=786dads78asdbad876asdhjvb28

:path: /style.css

HTTP/2.0

Page 24: InterCon 2016 - HTTP/2 for Web Application Developers

:method: GET :path: / Host: www.alura.com.br Accept: text/html,application/xhtml+xml;q=0.9,image/jpeg Accept-Encoding: gzip User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) Cookie: SID=786dads78asdbad876asdhjvb28

:path: /style.css

:path: /main.js

:path: /imagem.jpg Host: images.caelum.com.br

HTTP/2.0

Page 25: InterCon 2016 - HTTP/2 for Web Application Developers

HEADER TABLES

MENOS BYTES REQUEST e RESPONSE STATEFUL

Page 26: InterCon 2016 - HTTP/2 for Web Application Developers

OTIMIZAÇÕES WEBJUNTAR CSS E JS SPRITES INLINE DE RECURSOS

GZIP MINIFICAÇÃO DOMÍNIOS SEM COOKIES

diminuir requests

diminuir tráfego

paralelizar requests MÚLTIPLOS HOSTNAMES

Page 27: InterCon 2016 - HTTP/2 for Web Application Developers

OTIMIZAÇÕES WEBJUNTAR CSS E JS SPRITES INLINE DE RECURSOS

GZIP MINIFICAÇÃO DOMÍNIOS SEM COOKIES

diminuir requests

diminuir tráfego

paralelizar requests MÚLTIPLOS HOSTNAMES

Page 28: InterCon 2016 - HTTP/2 for Web Application Developers

HTTP 1.1 com Keep-Alive

cliente servidor

Page 29: InterCon 2016 - HTTP/2 for Web Application Developers

HTTP 1.1 com Pipelining*

cliente servidor

Page 30: InterCon 2016 - HTTP/2 for Web Application Developers

HTTP 1.1 com Pipelining*

cliente servidor

Page 31: InterCon 2016 - HTTP/2 for Web Application Developers

HTTP 1.1 com Pipelining*

Head of Line Blocking...

...

cliente servidor

Page 32: InterCon 2016 - HTTP/2 for Web Application Developers

HTTP 2.0 multiplexing

cliente servidor

Page 33: InterCon 2016 - HTTP/2 for Web Application Developers

MULTIPLEXING

1 CONEXÃO TCP ASSÍNCRONO

Page 34: InterCon 2016 - HTTP/2 for Web Application Developers
Page 35: InterCon 2016 - HTTP/2 for Web Application Developers
Page 36: InterCon 2016 - HTTP/2 for Web Application Developers
Page 37: InterCon 2016 - HTTP/2 for Web Application Developers

OTIMIZAÇÕES WEBJUNTAR CSS E JS SPRITES INLINE DE RECURSOS

GZIP MINIFICAÇÃO DOMÍNIOS SEM COOKIES

diminuir requests

diminuir tráfego

paralelizar requests MÚLTIPLOS HOSTNAMES

Page 38: InterCon 2016 - HTTP/2 for Web Application Developers

OTIMIZAÇÕES WEBJUNTAR CSS E JS SPRITES INLINE DE RECURSOS

GZIP MINIFICAÇÃO DOMÍNIOS SEM COOKIES

diminuir requests

diminuir tráfego

paralelizar requests MÚLTIPLOS HOSTNAMES

Page 39: InterCon 2016 - HTTP/2 for Web Application Developers

OTIMIZAÇÕES WEBJUNTAR CSS E JS SPRITES INLINE DE RECURSOS

GZIP MINIFICAÇÃO DOMÍNIOS SEM COOKIES

MÚLTIPLOS HOSTNAMES

diminuir requests

diminuir tráfego

paralelizar requests

Page 40: InterCon 2016 - HTTP/2 for Web Application Developers

INLINE

DIMINUIR REQUESTS PRIORIZAR CONTEÚDO

Page 41: InterCon 2016 - HTTP/2 for Web Application Developers

priorizar conteúdo

<!DOCTYPE html> <html> <head> <style> /* estilo para o ATF */ </style>

<script> /* javascript importante */ </script>

/* javascript pra depois */ <script src="secundario.js" async></script> </head> <body> ... </body> </html>

Page 42: InterCon 2016 - HTTP/2 for Web Application Developers

<!DOCTYPE html> <html> <head> <link rel="stylesheet" href="estilo.css"> <script src="app.js" async></script> </head> <body> <img src="foto.jpg"> ... <script src="jquery.js"></script> <script src="plugin.js"></script> </body> </html>

priorizar conteúdo

Page 43: InterCon 2016 - HTTP/2 for Web Application Developers

<!DOCTYPE html> <html> <head> <link rel="stylesheet" href="estilo.css"> <script src="app.js" async></script> </head> <body> <img src="foto.jpg"> ... <script src="jquery.js"></script> <script src="plugin.js"></script> </body> </html>

priorizar conteúdo

Page 44: InterCon 2016 - HTTP/2 for Web Application Developers

index.html

estilo.css jquery.js

plugin.js

app.js foto.jpg

logo.png

12 8 8 4

4 8

priorizar conteúdo

Page 45: InterCon 2016 - HTTP/2 for Web Application Developers

index.html

app.js

estilo.css

foto.jpgjquery.jsplugin.js

app.js

estilo.css

foto.jpg

jquery.js

plugin.js

priorizar conteúdo

cliente servidor

Page 46: InterCon 2016 - HTTP/2 for Web Application Developers

index.html

index.html bloqueante

espera

cliente servidor

Page 47: InterCon 2016 - HTTP/2 for Web Application Developers

index.html

app.js

estilo.css

foto.jpg

jquery.js

plugin.js

Server Push

cliente servidor

Page 48: InterCon 2016 - HTTP/2 for Web Application Developers

index.html

app.js

estilo.css

foto.jpg

jquery.js

plugin.js

cliente servidor

Server Push

Page 49: InterCon 2016 - HTTP/2 for Web Application Developers

index.html

style.css

index.html

icone.png

index.html

style.css

index.html

icone.png

cliente servidor

cliente servidor

Server Push Cancelável

Page 50: InterCon 2016 - HTTP/2 for Web Application Developers

SERVER PUSH

PRIORIZAÇÃO CACHEÁVEL CANCELÁVEL*

Page 51: InterCon 2016 - HTTP/2 for Web Application Developers

SERVER PUSH

CASPer (cache-aware server-push)

Cache Digests

Page 52: InterCon 2016 - HTTP/2 for Web Application Developers

OTIMIZAÇÕES WEBJUNTAR CSS E JS SPRITES INLINE DE RECURSOS

GZIP MINIFICAÇÃO DOMÍNIOS SEM COOKIES

diminuir requests

diminuir tráfego

paralelizar requests MÚLTIPLOS HOSTNAMES

Page 53: InterCon 2016 - HTTP/2 for Web Application Developers

OTIMIZAÇÕES WEBJUNTAR CSS E JS SPRITES INLINE DE RECURSOS

GZIP MINIFICAÇÃO DOMÍNIOS SEM COOKIES

diminuir requests

diminuir tráfego

paralelizar requests MÚLTIPLOS HOSTNAMES

Page 54: InterCon 2016 - HTTP/2 for Web Application Developers

HTTP/2

COMPRESSÃOCRIPTOGRAFIA

MULTIPLEXING

SERVER PUSHPRIORIZAÇÃO

+MOBILE+FÁCIL+PERFORMANCE

BINÁRIO

+COMPATÍVEL +SEGURO+LEVE

Page 55: InterCon 2016 - HTTP/2 for Web Application Developers

OBRIGADO!

sergiolopes.org @sergio_caelum


Recommended