SPDY быстрее на 146% (Валентин Бартенев)

2,016 views

Published on

  • Be the first to comment

SPDY быстрее на 146% (Валентин Бартенев)

  1. 1. SPDY: 146% faster Valentin V. Bartenev NGINX, Inc.
  2. 2. 2 / 16 What the fu in the world is going on SPDY?● Binary protocol● Developed by Google● Transport layer for HTTP● Works over TLS – proxy transparency
  3. 3. 3 / 16A long time ago in a galaxy far, far away....● Simple sites, light pages – no CSS, no JavaScript – a few graphics● Slow clients, low capacity last miles p.s. http://wayback.archive.org/
  4. 4. 4 / 16 The world is changing● Broadband internet connections● Fat pages● Browser arms race● Hard-to-please customers
  5. 5. 5 / 16 What Is to Be Done?● Metrics: RTT, TTFB● Browser caching● Keepalive, pipelining● JS/CSS catenation, sprites, inlining, data URI scheme● Async loading, AJAX● Domain sharding● Proxying, CDN
  6. 6. 6 / 16Pipelining
  7. 7. 7 / 16 SPDY features● Multiplexing● HTTP headers compression● Flow control● Server push
  8. 8. 8 / 16Multiplexing
  9. 9. 9 / 16 HTTP headers compression● Zlib● Dictionary● CRIME - zero compression level - zlib hack - new algorithm in SPDY/4
  10. 10. 10 / 16 Lulz● Partial alignment● 24 bits for all headers, but 32 bits for every header name and value● Blowing hot & cold with priority● Mistakes in comp. dictionary● Chrome flow control fail
  11. 11. 11 / 16 To be or not to be?● HTTPS ready● Lot of external resources per page● Big RTT● Stats from WordPress: – faster than HTTPS, – but slower than plain HTTP
  12. 12. 12 / 16 SPDY in NGINX● Sponsored and tested by Automattic – WordPress, Gravatar – Wordpress.com: 70 000 rps, 15+ Gbit/sec● Timeline – March 2012: the work has started – 15 June: first public release – 18 August: last stable version
  13. 13. 13 / 16 Results SPDY Server Survey Nginx 9% Google 4000 Apache 3500 Other 3000SPDY domains 2500 2000 1500 1000 500 0 May October 89%
  14. 14. 14 / 16 How-To● OpenSSL 1.0.1+ (NPN support required)● http://nginx.org/patches/spdy/ (temporary) server { listen 433 ssl spdy; ssl_certificate path/to/server.crt; ssl_certificate_key path/to/private.key; #spdy_headers_comp 1; }
  15. 15. 15 / 16 Detect SPDY in browser● Chrome/Chromium: – window.chrome.loadTimes().wasFetchedViaSpdy; – chrome://net-internals/#spdy● Firefox: – SPDY indicator var req = new XMLHttpRequest(); req.open(HEAD, document.location, false); req.send(); req.getResponseHeader(X-Firefox-Spdy);
  16. 16. 16 / 16 ¿Questions? Valentin V. Bartenevhttp://vbart.info/, ne@vbart.ru Btw, is hiring! Please submit your CV to maxim@nginx.com

×