Top Banner
Or maybe HTTP2.0 [SPeeDY] Andreas Bjärlestam 2012-05-30
74

SPDY

May 15, 2015

Download

Technology

The SPDY protocol has been developed by Google since 2009. It is intended as an evolution of HTTP with better performance and network utilization.
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: SPDY

Or maybe HTTP2.0

[SPeeDY]

Andreas Bjärlestam 2012-05-30

Page 2: SPDY

SPDY quick overview

• An evolution of HTTP• Developed by Google since 2009• Openly available spec

Page 3: SPDY

Why the hell would you want to replace HTTP?

Page 4: SPDY

HTTP is fantastic

it has totally changed the world

Page 5: SPDY

but…

Page 6: SPDY

HTTP is over 20 years old

HTTP 1.1 is 12 years old

Page 7: SPDY

Webpages in 1999

Page 8: SPDY
Page 9: SPDY

Webpages in 2012

Page 10: SPDY
Page 11: SPDY

Mobile internet usage

source: svenskarna och internet 2011 https://www.iis.se/docs/SOI2011.pdf

Page 12: SPDY

This is how more and more of us consume the web…

Page 13: SPDY

Often it feels a lot like…

Page 14: SPDY

People no longer have patience to wait for slow pages

Page 15: SPDY

Web pages February 2012

• www.facebook.com - ca 100 http requests• www.bostonglobe.com - ca 100 http requests• www.svtplay.se - ca 90 http requests• www.aftonbladet.se - ca 350 http requests

source: http://httparchive.org/

Page 16: SPDY

What does it look like over the network fetching 100 resources?

Page 17: SPDY
Page 18: SPDY

Can you spot the problem?

Page 19: SPDY

Its all synchronous

Page 20: SPDY

How come an advanced page like facebook.com loads in under 4

seconds when its all synchronous?

Page 21: SPDY

Hacky optimizations

CSS spritesbase64 images in data-urls

CSS concatenationJavaScript concatenation

Page 22: SPDY

HTTP/TCP

HTTP/TCP

HTTP/TCP

HTTP/TCP

HTTP/TCP

HTTP/TCP

6 x HTTP connections

Page 23: SPDY

Domain sharding

• www.bostonglobe.com - 59 connections• www.svtplay.se - 22 connections• www.aftonbladet.se - 118 connections

source: http://www.webpagetest.org

Page 24: SPDY

What is the problem with this? Why not even more?

Page 25: SPDY

We kind of abuse TCP when we open more

connections

Page 26: SPDY

2 connections per host recommended by HTTP 1.1 spec

6 connections in most browsers

Page 27: SPDY

and…

Page 28: SPDY

New TCP connections are slow

Page 29: SPDY

3 way handshake

Page 30: SPDY

On my macbookPing 20ms ≈ 30ms to set up a

connection

On my mobile (3G)Ping 300ms ≈ 450ms to set up a

connection

Page 31: SPDY

HTTP/TCP

HTTP/TCP

HTTP/TCP

HTTP/TCP

HTTP/TCP

TCP Slow start

HTTP/TCP

Page 32: SPDY

Bandwidth doesn’t matter much anymore

Latency does

Page 33: SPDY

So… we need to utilize our TCP connections better

Page 34: SPDY

Enter

SPDY

Page 35: SPDY

Don’t we break the web if we replace HTTP?

Page 36: SPDY

Nope

Page 37: SPDY

The semantics of HTTP is kept

Page 38: SPDY

HTTP -> SPDY

GETPUT

POST…

HEADERS

Use of URLs Use of TCP

GETPUT

POST…

HEADERS

Use of URLs Use of TCP

Page 39: SPDY

You can switch to SPDY with no changes to your web application

Page 40: SPDY

SPDY runs over TCP and will not require upgraded network

equipment

Page 41: SPDY

Example…

Page 42: SPDY

Designed with speed as

primary goal

Page 43: SPDY

1 TCP connection

HTTP/TCP

Page 44: SPDY

HTTP/TCP

But it will be on fire!

Page 45: SPDY

SPDY is multiplexed

Page 46: SPDY

This is a typical HTTP sessionGET

GET

GET

200 OK

200 OK

200 OK

Page 47: SPDY

MultiplexingGET 1

GET 2GET 3

200 OK 2

200 OK 3

200 OK 1

Page 48: SPDY

Stream priorities

Page 49: SPDY

SPDY is binary

Page 50: SPDY

Will be difficult to just fire up telnet and hack away

Page 51: SPDY

Every decent site will be encrypted and gzipped anyways

Page 52: SPDY

TLS/SSL is mandatory✗was

Page 53: SPDY

Communication should be secure by default

Users should not have to care

Page 54: SPDY

Headers are compressed

Page 55: SPDY

Server Push

Page 56: SPDY

Server Push

Page 57: SPDY

So is it worth it?

Page 58: SPDY

Google tested 25 of the “top 100” sites

Page 59: SPDY

Average speedup

39% - 55%

Page 60: SPDY

SPDY could make your life easier

Less need for hacky optimizations like CSS sprites, file concatenations,

domain sharding etc

Page 61: SPDY

Should I add SPDY support to my servers on Monday?

Page 62: SPDY

Probably not…

Page 63: SPDY

Implementations

• Apache mod_spdy• Nginx – in roadmap• node_spdy – requires node.js 0.7• Netty• Jetty• more…

Page 64: SPDY

Browsers

• Chrome (since version 6)• Firefox (since version 11, turned off by default)• Amazon silk

Page 65: SPDY

Others

• Strangeloop• Akamai (Contendo)• F5 BIG-IP

Page 66: SPDY

Google

• Support SPDY on most of their services• 90% of their SSL traffic is over SPDY

Page 67: SPDY

Amazon silk

SilkBrowser

SPDYGateway

TheInternet

SPDY HTTP

Page 68: SPDY

The spec

• Draft spec, version 4• IETF HTTPbis WG has started to work on

HTTP2.0• SPDY has been submitted as input to HTTP2.0

Page 69: SPDY

Roundup

• ~ 50% Faster page loads than HTTP• Backwards compatible with HTTP• Better utilization of TCP• Secured by default• Binary + compressed• Will likely be the base for HTTP2.0

Page 71: SPDY

Backup slides

Page 72: SPDY

Alternatives

Page 73: SPDY

HTTP Pipelining

• Not as effective as multiplexing• Hard to implement in browser• Opera is the only desktop browser that has a

full implementation enabled by default• Android, IOS5 and Opera mobile browsers do

some amount of pipelining• Not used by most proxies

Page 74: SPDY

Pipelining

GET 1

GET 2GET 3

200 OK 1

200 OK 2

200 OK 3

GET 1

GET 2GET 3

200 OK 2

200 OK 3

200 OK 1

Multiplexing

GET

GET

GET

200 OK

200 OK

200 OK

Synchronous