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

16
Valentin V. Bartenev NGINX, Inc. SPDY: 146% faster

Upload: ontico

Post on 15-May-2015

1.627 views

Category:

Documents


1 download

TRANSCRIPT

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

Valentin V. BartenevNGINX, Inc.

SPDY: 146% faster

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

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

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

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/

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

4 / 16

The world is changing● Broadband internet connections● Fat pages● Browser arms race● Hard-to-please customers

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

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

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

6 / 16

Pipelining

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

7 / 16

SPDY features

● Multiplexing● HTTP headers compression● Flow control● Server push

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

8 / 16

Multiplexing

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

9 / 16

HTTP headers compression

● Zlib● Dictionary● CRIME

- zero compression level

- zlib hack

- new algorithm in SPDY/4

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

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

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

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

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

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

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

13 / 16

May October0

500

1000

1500

2000

2500

3000

3500

4000

SP

DY

do

ma

ins

89%

9%

SPDY Server Survey Nginx

Google

Apache

Other

Results

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

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;}

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

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');

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

16 / 16

Valentin V. Bartenevhttp://vbart.info/, [email protected]

Btw,

is hiring!Please submit your CV to

[email protected]

¿Questions?