Improving performance by changing the rules from fast to SPDY
SPDY быстрее на 146% (Валентин Бартенев)
Transcript of SPDY быстрее на 146% (Валентин Бартенев)
Valentin V. BartenevNGINX, Inc.
SPDY: 146% faster
2 / 16What the fu in the world
is going on SPDY?
● Binary protocol● Developed by Google● Transport layer for HTTP● Works over TLS
– proxy transparency
3 / 16
A 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 / 16
The world is changing● Broadband internet connections● Fat pages● Browser arms race● Hard-to-please customers
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 / 16
Pipelining
7 / 16
SPDY features
● Multiplexing● HTTP headers compression● Flow control● Server push
8 / 16
Multiplexing
9 / 16
HTTP headers compression
● Zlib● Dictionary● CRIME
- zero compression level
- zlib hack
- new algorithm in SPDY/4
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 / 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 / 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 / 16
May October0
500
1000
1500
2000
2500
3000
3500
4000
SP
DY
do
ma
ins
89%
9%
SPDY Server Survey Nginx
Apache
Other
Results
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 / 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
Valentin V. Bartenevhttp://vbart.info/, [email protected]
Btw,
is hiring!Please submit your CV to
¿Questions?