Publicité
Publicité

Contenu connexe

Publicité

Dernier(20)

Publicité

Como o HTTP/2 vai mudar sua vida

  1. HTTP/2
  2. @sergio_caelum sergiolopes.org
  3. review HTTP em 5 slides
  4. $  telnet  www.caelum.com.br  80   Trying  64.233.171.121...   Connected  to  ghs.googlehosted.com.   Escape  character  is  '^]'.   GET  /  HTTP/1.1   Host:  www.caelum.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,  03  Apr  2014  18:37:18  GMT   Server:  Google  Frontend   Cache-­‐Control:  private   <!DOCTYPE  html><html><head><title>Caelum</title>
  5. $  telnet  www.caelum.com.br  80   Trying  64.233.171.121...   Connected  to  ghs.googlehosted.com.   Escape  character  is  '^]'.   GET  /  HTTP/1.1   Host:  www.caelum.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,  03  Apr  2014  18:37:18  GMT   Server:  Google  Frontend   Cache-­‐Control:  private   <!DOCTYPE  html><html><head><title>Caelum</title> TEXTO
  6. REQUEST RESPONSE $  telnet  www.caelum.com.br  80   Trying  64.233.171.121...   Connected  to  ghs.googlehosted.com.   Escape  character  is  '^]'.   GET  /  HTTP/1.1   Host:  www.caelum.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,  03  Apr  2014  18:37:18  GMT   Server:  Google  Frontend   Cache-­‐Control:  private   <!DOCTYPE  html><html><head><title>Caelum</title>
  7. REQUEST RESPONSE ...ESPERA... $  telnet  www.caelum.com.br  80   Trying  64.233.171.121...   Connected  to  ghs.googlehosted.com.   Escape  character  is  '^]'.   GET  /  HTTP/1.1   Host:  www.caelum.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,  03  Apr  2014  18:37:18  GMT   Server:  Google  Frontend   Cache-­‐Control:  private   <!DOCTYPE  html><html><head><title>Caelum</title>
  8. MÉTODO E URL STATUS RESPOSTA $  telnet  www.caelum.com.br  80   Trying  64.233.171.121...   Connected  to  ghs.googlehosted.com.   Escape  character  is  '^]'.   GET  /  HTTP/1.1   Host:  www.caelum.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,  03  Apr  2014  18:37:18  GMT   Server:  Google  Frontend   Cache-­‐Control:  private   <!DOCTYPE  html><html><head><title>Caelum</title>
  9. HEADERS HEADERS $  telnet  www.caelum.com.br  80   Trying  64.233.171.121...   Connected  to  ghs.googlehosted.com.   Escape  character  is  '^]'.   GET  /  HTTP/1.1   Host:  www.caelum.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,  03  Apr  2014  18:37:18  GMT   Server:  Google  Frontend   Cache-­‐Control:  private   <!DOCTYPE  html><html><head><title>Caelum</title>
  10. http texto request > espera > response headers
  11. cliente servidor cliente servidor HTTP 1.1 CONEXÃO TCP REQUEST REQUEST CONEXÃO TCP
  12. cliente servidor Keep-Alive REQUEST REQUEST #2 REQUEST #3 CONEXÃO TCP
  13. 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
  14. otimizações web
  15. otimizações web diminuir requests
  16. otimizações web diminuir requests diminuir tráfego
  17. otimizações web diminuir requests diminuir tráfego paralelizar requests
  18. otimizações web JUNTAR CSS E JS SPRITES INLINE DE RECURSOS diminuir requests diminuir tráfego paralelizar requests
  19. otimizações web JUNTAR CSS E JS SPRITES INLINE DE RECURSOS GZIP MINIFICAÇÃO DOMÍNIOS SEM COOKIES diminuir requests diminuir tráfego paralelizar requests
  20. otimizações web JUNTAR CSS E JS SPRITES INLINE DE RECURSOS GZIP MINIFICAÇÃO DOMÍNIOS SEM COOKIES MÚLTIPLOS HOSTNAMES CDNs diminuir requests diminuir tráfego paralelizar requests
  21. o fantástico mundo do HTTP/2 (e do SPDY)
  22. GET  /  HTTP/1.1   Host:  www.caelum.com.br   HTTP/1.1  200  OK   Content-­‐Type:  text/html;  charset=utf-­‐8   Content-­‐Language:  pt-­‐br   Date:  Thu,  03  Apr  2015  18:37:18  GMT   Cache-­‐Control:  private   <!DOCTYPE  html><html><head><title>Caelum</title>   <meta  name=viewport  content=width=device-­‐width>   <meta  name=description  content="A  Caelum  tem  os  cursos  de   Java,  Android,  Scrum,  Rails,  .NET,  HTML  e  CSS  mais   reconhecidos  no  mercado"><style> http 1.1
  23. GET  /  HTTP/1.1   Host:  www.caelum.com.br   Accept-­‐Encoding:  gzip   HTTP/1.1  200  OK   Content-­‐Type:  text/html;  charset=utf-­‐8   Content-­‐Language:  pt-­‐br   Date:  Thu,  03  Apr  2015  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 http 1.1 GZIP
  24. 0101010101010101010101   010101010101   0101010101010   101010101010   0101010101010   ??[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 http 2.0 BINÁRIO GZIP
  25. ?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 http 2.0 BINÁRIO HPACK GZIP
  26. ?????????   ???????   ????????   ????????   ?????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????? ????????????????????????????????????????????????????????? http 2.0 BINÁRIO HPACK GZIP TLS TLS
  27. HEADER BINÁRIO GZIP / HPACK TLS*
  28. cliente servidor HTTP 1.1 com Keep-Alive
  29. cliente servidor HTTP 1.1 com Pipelining*
  30. cliente servidor HTTP 1.1 com Pipelining*
  31. cliente servidor HTTP 1.1 com Pipelining* Head of Line Blocking ... ...
  32. cliente servidor HTTP 2.0 multiplexing
  33. multiplexing 1 CONEXÃO TCP ASSÍNCRONO
  34. otimizações web JUNTAR CSS E JS SPRITES INLINE DE RECURSOS GZIP MINIFICAÇÃO DOMÍNIOS SEM COOKIES MÚLTIPLOS HOSTNAMES CDNs diminuir requests diminuir tráfego paralelizar requests
  35. otimizações web JUNTAR CSS E JS SPRITES INLINE DE RECURSOS GZIP MINIFICAÇÃO DOMÍNIOS SEM COOKIES MÚLTIPLOS HOSTNAMES CDNs diminuir requests diminuir tráfego paralelizar requests
  36. otimizações web JUNTAR CSS E JS SPRITES INLINE DE RECURSOS GZIP MINIFICAÇÃO DOMÍNIOS SEM COOKIES MÚLTIPLOS HOSTNAMES CDNs diminuir requests diminuir tráfego paralelizar requests
  37. otimizações web JUNTAR CSS E JS SPRITES INLINE DE RECURSOS GZIP MINIFICAÇÃO DOMÍNIOS SEM COOKIES MÚLTIPLOS HOSTNAMES CDNs diminuir requests diminuir tráfego paralelizar requests
  38. :method:  GET   :path:  /   Host:  www.caelum.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.caelum.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
  39. :method:  GET   :path:  /   Host:  www.caelum.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.caelum.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
  40. :method:  GET   :path:  /   Host:  www.caelum.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
  41. :method:  GET   :path:  /   Host:  www.caelum.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
  42. header tables MENOS BYTES REQUEST e RESPONSE STATEFUL
  43. otimizações web JUNTAR CSS E JS SPRITES INLINE DE RECURSOS GZIP MINIFICAÇÃO DOMÍNIOS SEM COOKIES diminuir requests diminuir tráfego MÚLTIPLOS HOSTNAMES CDNs paralelizar requests
  44. otimizações web JUNTAR CSS E JS SPRITES INLINE DE RECURSOS GZIP MINIFICAÇÃO DOMÍNIOS SEM COOKIES diminuir requests diminuir tráfego MÚLTIPLOS HOSTNAMES CDNs paralelizar requests
  45. inline diminuir requests priorizar conteúdo
  46. 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>
  47. priorizar conteúdo <!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>
  48. priorizar conteúdo <!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>
  49. index.html priorizar conteúdo
  50. index.html estilo.css priorizar conteúdo
  51. index.html estilo.css app.js priorizar conteúdo
  52. index.html estilo.css jquery.jsapp.js priorizar conteúdo
  53. index.html estilo.css jquery.jsapp.js foto.jpg priorizar conteúdo
  54. index.html estilo.css jquery.js plugin.js app.js foto.jpg priorizar conteúdo
  55. index.html estilo.css jquery.js plugin.js app.js foto.jpg priorizar conteúdo
  56. index.html estilo.css jquery.js plugin.js app.js foto.jpg priorizar conteúdo
  57. index.html estilo.css jquery.js plugin.js app.js foto.jpg priorizar conteúdo
  58. index.html estilo.css jquery.js plugin.js app.js foto.jpg priorizar conteúdo
  59. index.html estilo.css jquery.js plugin.js app.js foto.jpg priorizar conteúdo
  60. index.html estilo.css jquery.js plugin.js app.js foto.jpg priorizar conteúdo
  61. index.html estilo.css jquery.js plugin.js app.js foto.jpg logo.png priorizar conteúdo
  62. index.html estilo.css jquery.js plugin.js app.js foto.jpg logo.png 12 priorizar conteúdo
  63. index.html estilo.css jquery.js plugin.js app.js foto.jpg logo.png 12 8 priorizar conteúdo
  64. index.html estilo.css jquery.js plugin.js app.js foto.jpg logo.png 12 8 8 priorizar conteúdo
  65. index.html estilo.css jquery.js plugin.js app.js foto.jpg logo.png 12 8 8 4 priorizar conteúdo
  66. index.html estilo.css jquery.js plugin.js app.js foto.jpg logo.png 12 8 8 4 8 priorizar conteúdo
  67. index.html estilo.css jquery.js plugin.js app.js foto.jpg logo.png 12 8 8 4 4 8 priorizar conteúdo
  68. index.html cliente servidor priorizar conteúdo
  69. index.html cliente servidor priorizar conteúdo
  70. index.html cliente servidor priorizar conteúdo
  71. index.html estilo.css cliente servidor priorizar conteúdo
  72. index.html estilo.css cliente servidor priorizar conteúdo
  73. index.html app.js estilo.css cliente servidor priorizar conteúdo
  74. index.html app.js estilo.css cliente servidor priorizar conteúdo
  75. index.html app.js estilo.css cliente servidor foto.jpg priorizar conteúdo
  76. index.html app.js estilo.css cliente servidor foto.jpg priorizar conteúdo
  77. index.html app.js estilo.css cliente servidor foto.jpg jquery.js priorizar conteúdo
  78. index.html app.js estilo.css cliente servidor foto.jpg jquery.js priorizar conteúdo
  79. index.html app.js estilo.css cliente servidor foto.jpg jquery.js plugin.js priorizar conteúdo
  80. index.html app.js estilo.css cliente servidor foto.jpg jquery.js plugin.js priorizar conteúdo
  81. index.html app.js estilo.css cliente servidor foto.jpg jquery.js plugin.js priorizar conteúdo
  82. index.html app.js estilo.css cliente servidor foto.jpg jquery.js plugin.js estilo.css priorizar conteúdo
  83. index.html app.js estilo.css cliente servidor foto.jpg jquery.js plugin.js estilo.css priorizar conteúdo
  84. index.html app.js estilo.css cliente servidor foto.jpg jquery.js plugin.js estilo.css jquery.js priorizar conteúdo
  85. index.html app.js estilo.css cliente servidor foto.jpg jquery.js plugin.js estilo.css jquery.js priorizar conteúdo
  86. index.html app.js estilo.css cliente servidor foto.jpg jquery.js plugin.js app.js estilo.css jquery.js priorizar conteúdo
  87. index.html app.js estilo.css cliente servidor foto.jpg jquery.js plugin.js app.js estilo.css jquery.js priorizar conteúdo
  88. index.html app.js estilo.css cliente servidor foto.jpg jquery.js plugin.js app.js estilo.css jquery.js plugin.js priorizar conteúdo
  89. index.html app.js estilo.css cliente servidor foto.jpg jquery.js plugin.js app.js estilo.css jquery.js plugin.js priorizar conteúdo
  90. index.html app.js estilo.css cliente servidor foto.jpg jquery.js plugin.js app.js estilo.css foto.jpg jquery.js plugin.js priorizar conteúdo
  91. index.html cliente servidor
  92. index.html cliente servidor
  93. index.html cliente servidor espera
  94. index.html cliente servidor index.html bloqueante espera
  95. index.html cliente servidor Server Push
  96. index.html cliente servidor Server Push
  97. index.html cliente servidor Server Push
  98. index.html cliente servidor app.js estilo.css foto.jpg jquery.js plugin.js Server Push
  99. index.html cliente servidor app.js estilo.css foto.jpg jquery.js plugin.js Server Push
  100. cliente servidor index.html   style.css index.html icone.png cliente servidor index.html style.css   index.html icone.png Server Push Cancelável
  101. server push PRIORIZAÇÃO CANCELÁVEL CACHEÁVEL
  102. otimizações web JUNTAR CSS E JS SPRITES INLINE DE RECURSOS GZIP MINIFICAÇÃO DOMÍNIOS SEM COOKIES diminuir requests diminuir tráfego MÚLTIPLOS HOSTNAMES CDNs paralelizar requests
  103. otimizações web JUNTAR CSS E JS SPRITES INLINE DE RECURSOS GZIP MINIFICAÇÃO DOMÍNIOS SEM COOKIES diminuir requests diminuir tráfego MÚLTIPLOS HOSTNAMES CDNs paralelizar requests
  104. http 2
  105. http 2 BINÁRIO
  106. http 2 COMPRESSÃO BINÁRIO
  107. http 2 COMPRESSÃO CRIPTOGRAFIA BINÁRIO
  108. http 2 COMPRESSÃO CRIPTOGRAFIA MULTIPLEXING BINÁRIO
  109. http 2 COMPRESSÃO CRIPTOGRAFIA MULTIPLEXING PRIORIZAÇÃO BINÁRIO
  110. http 2 COMPRESSÃO CRIPTOGRAFIA MULTIPLEXING SERVER PUSH PRIORIZAÇÃO BINÁRIO
  111. http 2 COMPRESSÃO CRIPTOGRAFIA MULTIPLEXING SERVER PUSH PRIORIZAÇÃO +PERFORMANCE BINÁRIO
  112. http 2 COMPRESSÃO CRIPTOGRAFIA MULTIPLEXING SERVER PUSH PRIORIZAÇÃO +MOBILE +PERFORMANCE BINÁRIO
  113. http 2 COMPRESSÃO CRIPTOGRAFIA MULTIPLEXING SERVER PUSH PRIORIZAÇÃO +MOBILE +FÁCIL+PERFORMANCE BINÁRIO
  114. http 2 COMPRESSÃO CRIPTOGRAFIA MULTIPLEXING SERVER PUSH PRIORIZAÇÃO +MOBILE +FÁCIL+PERFORMANCE BINÁRIO +COMPATÍVEL
  115. http 2 COMPRESSÃO CRIPTOGRAFIA MULTIPLEXING SERVER PUSH PRIORIZAÇÃO +MOBILE +FÁCIL+PERFORMANCE BINÁRIO +COMPATÍVEL +LEVE
  116. http 2 COMPRESSÃO CRIPTOGRAFIA MULTIPLEXING SERVER PUSH PRIORIZAÇÃO +MOBILE +FÁCIL+PERFORMANCE BINÁRIO +COMPATÍVEL +SEGURO +LEVE
  117. otimizações web http2 diminuir tráfego CACHE MINIFICAÇÃO JS,CSS,HTML COMPRESSÃO DE IMAGENS
  118. otimizações web http2 diminuir tráfego CACHE MINIFICAÇÃO JS,CSS,HTML COMPRESSÃO DE IMAGENS SERVER PUSH / HINT CRITICAL PATH 60 FPS / JANK FREE otimizar renderização
  119. otimizações web http2 diminuir tráfego CACHE MINIFICAÇÃO JS,CSS,HTML COMPRESSÃO DE IMAGENS SERVER PUSH / HINT CRITICAL PATH 60 FPS / JANK FREE otimizar renderização CDNs QUIC diminuir latência
  120. USE HTTP/2 HOJE (ou SPDY)
  121. @sergio_caelum obrigado!
  122. links adicionais: ● The Effect of Network and Infrastructural Variables on SPDY's Performance. ● Livro High Performance Browser Networking ● Especificação HTTP2 ● http://daniel.haxx.se/http2/
Publicité