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

SPDY and HTTP2

SPDY and HTTP2

Andreas Bjärlestam

March 15, 2013
Tweet

More Decks by Andreas Bjärlestam

Other Decks in Technology

Transcript

  1. Being  slow  has  a  strong  negaJve   impact  on  business

      The  cost  of  being  slow  increases  over   Jme  and  persists  
  2. Myth:  If  your  site  loads  in  under  4   seconds

     you  are  ok   Actually:  The  negaJve  impact  of  being   slow  increases  linearly!  
  3. Bounce  rate  increases  linearly  with   page  load  Jme  

    Search  engines  rank  faster  sites  higher  
  4. Bandwidth   Page  Load  Time   1Mbps   3Mbps  

    9Mbps   Latency   Page  Load  Time   240ms   120ms   20ms  
  5. Web  pages  March  2013   •  www.facebook.com  -­‐  ca  170

     hRp  requests   •  www.bostonglobe.com  -­‐  ca  150  hRp  requests   •  www.svtplay.se  -­‐  ca  50  hRp  requests   •  www.aTonbladet.se  -­‐  ca  450  hRp  requests   source:  hRp://hRparchive.org/    
  6. How  come  an  advanced  page  like   facebook.com  loads  in

     under  4   seconds  when  its  all  synchronous?  
  7. Hacky  opJmizaJons   CSS  sprites   base64  images  in  data-­‐urls

      CSS  concatenaJon   JavaScript  concatenaJon  
  8. HTTP/TCP   HTTP/TCP   HTTP/TCP   HTTP/TCP   HTTP/TCP  

    HTTP/TCP   6  x  HTTP  connecJons  
  9. Domain  sharding   •  www.bostonglobe.com  -­‐  25  domains   • 

    www.svtplay.se  -­‐  9  domains   •  www.aTonbladet.se  -­‐  42  domains   source:    hRp://www.webpagetest.org  
  10. 2  connecJons  per  host  recommended   by  HTTP  1.1  spec

      6  connecJons  in  most  browsers    
  11. On  my  macbook   Ping  20ms  ≈  30ms  to  set

     up  a   connecJon   On  my  mobile  (3G)   Ping  300ms  ≈  450ms  to  set  up  a   connecJon  
  12. Window  size   1  2  3  4  5  6  7

     8  roundtrips   TCP  Slow  start   Packet  loss  
  13. HTTP  -­‐>  SPDY   GET   PUT   POST  

    …   HEADERS   Use  of  URLs   Use  of  TCP   GET   PUT   POST   …   HEADERS   Use  of  URLs   Use  of  TCP  
  14. This  is  a  typical  HTTP  session   GET   GET

      GET   200  OK   200  OK   200  OK  
  15. MulJplexing   GET  1   GET  2   GET  3

      200  OK  2   200  OK  3   200  OK  1  
  16. Many  studies  with  slightly  different   results   Most  of

     them  indicate  a  significant   speedup  (10%  –  60%)   hRps://code.google.com/p/mod-­‐spdy  
  17. SPDY  could  make  your  life  easier   No  more  hacky

     opJmizaJons  like   CSS  sprites,  file  concatenaJons,   domain  sharding  etc  
  18. ImplementaJons   •  Apache  mod_spdy   •  Nginx   • 

    node_spdy   •  NeRy   •  JeRy   •  HAProxy   •  more…  
  19. Browsers   •  Chrome  6+   •  Firefox  13+  

    •  Opera  12.10+   •  Amazon  silk   >  50%  of  browsers   support  SPDY  
  20. Google   •  Support  SPDY  on  all  their  services  (gmail

     etc)   •  Most  of  their  SSL  traffic  is  over  SPDY  
  21. Others   •  Akamai  (Contendo)   •  Strangeloop   • 

    F5  BIG-­‐IP   •  TwiRer   •  Facebook   •  Wordpress   •  Amazon  (kindle  fire  silkbrowser)  
  22. Amazon  silk   Silk   Browser   SPDY   Gateway

      The   Internet   SPDY   HTTP   Google  has  introduced  a  similar  thing   in  chrome  for  android  (beta  version)  
  23. The  spec   •  DraT  spec,  version  4   • 

    IETF  has  started  to  work  on  HTTP/2.0   •  SPDY  has  been  agreed  to  be  the  starJng  point   for  HTTP/2.0  
  24. Roundup   •  Faster  page  loads  than  HTTP   • 

    Backwards  compaJble  with  HTTP   •  BeRer  uJlizaJon  of  TCP   •  Secured  by  default   •  Binary  +  compressed  
  25. ARribuJons   •  hRp://en.wikipedia.org/wiki/ File:US_RoboJcs_56K_Modem_Front.JPG   •  hRps://www.iis.se/docs/SOI2012.pdf   • 

    hRp://www.flickr.com/photos/howi/6366423373/   •  hRp://www.flickr.com/photos/wwarby/5110037138/   •  hRp://www.flickr.com/photos/alicetragedy/ 4977295298/   •  hRp://www.flickr.com/photos/koltregaskes/ 624914973/in/photostream/  
  26. HTTP  Pipelining   •  Not  as  effecJve  as  mulJplexing  

    •  Hard  to  implement  in  browser   •  Opera  is  the  only  desktop  browser  that  has  a   full  implementaJon  enabled  by  default   •  Android,  IOS5  and  Opera  mobile  browsers  do   some  amount  of  pipelining   •  Not  used  by  most  proxies  
  27. Pipelining   GET  1   GET  2   GET  3

      200  OK  1   200  OK  2   200  OK  3   GET  1   GET  2   GET  3   200  OK  2   200  OK  3   200  OK  1   MulJplexing   GET   GET   GET   200  OK   200  OK   200  OK   Synchronous