Page 1
Or maybe HTTP2.0
[SPeeDY]
Andreas Bjärlestam 2012-02-23
Page 2
SPDY quick overview
• An evolution of HTTP• Developed by Google since 2009• Openly available spec
Page 3
Why the hell would you want to replace HTTP?
Page 4
HTTP is fantastic
it has totally changed the world
Page 6
HTTP is over 20 years old
HTTP 1.1 is 12 years old
Page 11
Mobile internet usage
source: svenskarna och internet 2011 https://www.iis.se/docs/SOI2011.pdf
Page 12
This is how more and more of us consume the web…
Page 13
Often it feels a lot like…
Page 14
People no longer have patience to wait for slow pages
Page 15
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
What does it look like over the network fetching 100 resources?
Page 18
Can you spot the problem?
Page 19
Its all synchronous
Page 20
How come an advanced page like facebook.com loads in under 4
seconds when its all synchronous?
Page 21
Hacky optimizations
CSS spritesbase64 images in data-urls
CSS concatenationJavaScript concatenation
Page 22
HTTP/TCP
HTTP/TCP
HTTP/TCP
HTTP/TCP
HTTP/TCP
HTTP/TCP
6 x HTTP connections
Page 23
What is the problem with this? Why not even more?
Page 25
TCP Congestion control
Page 26
2 connections per host recommended by HTTP 1.1 spec
6 connections in most browsers
Page 27
Domain sharding
• www.bostonglobe.com - 59 connections• www.svtplay.se - 22 connections• www.aftonbladet.se - 118 connections
source: http://www.webpagetest.org
Page 28
We kind of abuse TCP when we open more
connections
Page 30
New TCP connections are slow
Page 32
On my macbookPing 20ms ≈ 30ms to set up a
connection
On my mobile (3G)Ping 300ms ≈ 450ms to set up a
connection
Page 33
HTTP/TCP
HTTP/TCP
HTTP/TCP
HTTP/TCP
HTTP/TCP
TCP Slow start
HTTP/TCP
Page 34
It turns out that page load time for a moderately complex site is almost no faster over 20mbits/sec than over 2mbits/sec
Page 35
So… we need to utilize our TCP connections better
Page 37
Don’t we break the web if we replace HTTP?
Page 39
The semantics of HTTP is kept
Page 40
or in simpler words…
SPDY implements the HTTP API
Page 41
HTTP -> SPDY
GETPUT
POST…
HEADERS
Use of URLs Use of TCP
GETPUT
POST…
HEADERS
Use of URLs Use of TCP
Page 42
You can switch to SPDY with no changes to your web application
Page 43
SPDY runs over TCP and will not require upgraded network
equipment
Page 44
HTTP -> SPDY
TCP/IP
TLS/SSL
HTTP
TCP/IP
TLS/SSL
SPDY
HTTP
Page 45
Designed with speed as
primary goal
Page 46
1 TCP connection
HTTP/TCP
Page 47
HTTP/TCP
But it will be on fire!
Page 48
SPDY is multiplexed
Page 49
This is a typical HTTP sessionGET
GET
GET
200 OK
200 OK
200 OK
Page 50
MultiplexingGET 1
GET 2GET 3
200 OK 2
200 OK 3
200 OK 1
Page 51
Stream priorities
Page 53
Will be difficult to just fire up telnet and hack away
Page 54
Every decent site will be encrypted and gzipped anyways
Page 55
TLS/SSL is mandatory
Page 56
Communication should be secure by default
Users should not have to care
Page 57
Using SSL ensures that communication over existing
proxies is not broken
Page 58
..but you will not be able to use proxies for caching etc
Page 59
Headers are compressed
Page 60
How will the client know that it can use SPDY towards a server?
Page 61
NPN
TLS Next Protocol Negotiation
Page 64
So is it worth it?
Page 65
Google tested 25 of the “top 100” sites
Page 66
Average speedup
39% - 55%
Page 67
SPDY could make your life easier
Less need for hacky optimizations like CSS sprites, file concatenations,
domain sharding etc
Page 68
Should I add SPDY support to my servers on Monday?
Page 70
Implementations
• Apache mod_spdy• Nginx – in roadmap• node_spdy – requires node.js 0.7• netty• more…
Page 72
Browsers
• Chrome (since version 6)• Firefox 11 (turned off by default)• (Amazon silk)
Page 73
CDNs
• Strangeloop• Contendo
Page 74
CDNs
SPDYGateway
Your web serverBrowser
Page 75
Google
• Support SPDY on most of their services• 90% of their SSL traffic is over SPDY
Page 76
Amazon silk
SilkBrowser
SPDYGateway
TheInternet
SPDY HTTP
Page 77
The spec
• Draft spec, version 3• Plan is to submit it to IETF as input to HTTP2.0• IETF HTTPbis WG chair recently proposed to
start work on HTTP2.0
Page 79
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 80
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
Page 81
Alternative transport protocols
• SCTP• BEEP
Page 82
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 83
Attributions
• http://en.wikipedia.org/wiki/File:US_Robotics_56K_Modem_Front.JPG
• https://www.iis.se/docs/SOI2011.pdf• http://www.flickr.com/photos/howi/6366423
373/• http://www.flickr.com/photos/wwarby/51100
37138/• http://www.flickr.com/photos/alicetragedy/4
977295298/• http://www.flickr.com/photos/koltregaskes/6
24914973/in/photostream/