SPDY:
Make the web faster

Libo Song
Dec 4, 2012

What is SPDY?

SPDY is HTTP 2.0 ... kind of ...


HTTP/2.0 Milestones:

Done Call for Proposals for HTTP/2.0
Nov 2012[1] First draft of HTTP/2.0, based on SPDY
Apr 2014 Working Group Last Call for HTTP/2.0
Nov 2014 Submit HTTP/2.0 to IESG
SPDY is a starting point for HTTP/2.0. It is not adopted as HTTP/2.0.

[1] SPDY Protocol draft-ietf-httpbis-http2-00

What does SPDY look like?

Why SPDY?

HTTP needs to be updated
1991 HTTP/0.9
1996 HTTP/1.0
1999 HTTP/1.1
2012 ?

HTTP has issues with modern web sites

HTTP was simple ...

Single HTTP request

  1. Open a connection
  2. Send a request
  3. Receive a response
  4. Close the connection, and done

The first website

HTTP was simple ...

Web page has multiple resources

  1. Open a connection
  2. Send a request
  3. Receive a response
  4. ... Repeat request and response ...
  5. Close the connection, and done

Serialization

Web page has multiple resources

  1. Open a connection
  2. Send a request
  3. Receive a response
  4. ... Repeat request and response ...
  5. Close the connection, and done

Pipelining for concurrency

Pipelining for concurrency

Head of line blocking

Solution: Open multiple TCP connections!

Pipeline support

Browser
  • IE8: NO
  • Chrome: YES, disabled by default
  • Firefox: YES, disabled by default
  • Opera: YES
Server Most modern web servers: YES
Proxy Most proxies: NO

Open multiple connections

TCP handshake

TCP slow start

Stats from httparchive

Total transfer size 1249 KB
Total requests 86
Average request size 14.5 KB

source:http://httparchive.org

Connection limit

Connections per host 6
Connections across all hosts 16 - 35

Workarounds

  1. Combine resources
    • Javascript
    • CSS
    • Spriting images
  2. Inline resources
    • Small JS/CSS/images inside HTML
  3. Keep alive
    • Reuse connections
  4. Shard domains
    • Parallel requests

SPDY fixes them all

SPDY in a Nutshell

  • One TCP connection
  • Multiplexed
  • Prioritized
  • Headers compressed
  • Server push
Control Frame:
+----------------------------------+
|C| Version(15bits) | Type(16bits) |
+----------------------------------+
| Flags (8)  |  Length (24 bits)   |
+----------------------------------+
|               Data               |
+----------------------------------+

Data Frame:
+----------------------------------+
|D|       Stream-ID (31bits)       |
+----------------------------------+
| Flags (8) | Length (24 bits)     |
+----------------------------------+
|               Data               |
+----------------------------------+
             

Multiplexing and prioritization

Multiplexing and prioritization

Header compression is significant

Request headers 1st 2nd
HTTP Request 686.2 636.4
SPDY Request 379.4 (55%) 68.6 (10%)
Response headers 1st 2nd
HTTP Response 444.6 418.7
SPDY Response 202.0 (45%) 69.2 (17%)

source:UDELCOMPRESSION

Server push and server hint

Server Push: Server pushes a resource directly to the client without the client asking for the resource.

Server Hint: Server can notify the client of a resource that will be needed before the client can discover it.

Server push Demo

SPDY with push HTTP

Support for SPDY

Browser Server Sites
  • Chrome
  • Firefox
  • Opera
  • mod_spdy
  • nginx
  • jetty
  • node-spdy
  • ...
  • Google properties
  • Twitter
  • wordpress.com
  • 1000+ sites
  • ...

How to tell if a page uses SPDY

chrome://net-internals/#spdy
SPDY indicator (Chrome extension)
SPDY indicator (Firefox Add-on)

Why TLS?

Pragmatic + deployment reasons
  • Firewall blocks most ports except 80 and 443
  • Proxies
  • TLS Next Protocol Negotiation Extension (NPN)

What should the developers do?

mod_spdy


mod_spdy is a SPDY module for Apache 2.2

Next Protocol Negotiation (NPN)

Patched version of mod_ssl provides to support NPN.

Next Protocol Negotiation (NPN)

Next Protocol Negotiation (NPN)

Next Protocol Negotiation (NPN)

Next Protocol Negotiation (NPN)

Next Protocol Negotiation (NPN)

Multiplexing

Server push

Summary

Thank you!

Related links

Thank you!

Additional slides

RTT is a big deal

More Bandwidth Doesn't Matter (much)



Mike Belshe 04/08/10

RTT is a big deal

Unlike bandwidth, which continues to grow annually, RTT values are as stagnant as the speed of light (and in fact somewhat related to the speed of light).

over time, we would expect RTT to become the progressively dominant network factor in page load time.

3G 39 packets transmitted, 39 received, 0% packet loss, time 38049ms rtt min/avg/max/mdev = 100.975/352.454/1443.243/201.583 ms, pipe 2

Ethernet 15 packets transmitted, 15 received, 0% packet loss, time 14020ms rtt min/avg/max/mdev = 18.554/22.644/54.186/8.647 ms

Send a request

+------------------------------------+
|1|    version    |         1        |
+------------------------------------+
|  Flags (8)  |  Length (24 bits)    |
+------------------------------------+
|X|           Stream-ID (31bits)     |
+------------------------------------+
|X| Associated-To-Stream-ID (31bits) |
+------------------------------------+
| Pri|Unused | Slot |                |
+-------------------+                |
| Number of Name/Value pairs (int32) |    -
+------------------------------------+    |
|     Length of name (int32)         |    | "Name/Value Block",
+------------------------------------+    | compressed.
|           Name (string)            |    |
+------------------------------------+    |
|     Length of value  (int32)       |    |
+------------------------------------+    |
|          Value   (string)          |    |
+------------------------------------+    |
|           (repeats)                |    -
             

Reply with a response

+------------------------------------+
|1|    version    |         2        |
+------------------------------------+
|  Flags (8)  |  Length (24 bits)    |
+------------------------------------+
|X|           Stream-ID (31bits)     |
+------------------------------------+
| Number of Name/Value pairs (int32) |    -
+------------------------------------+    |
|     Length of name (int32)         |    | "Name/Value Block",
+------------------------------------+    | compressed.
|           Name (string)            |    |
+------------------------------------+    |
|     Length of value  (int32)       |    |
+------------------------------------+    |
|          Value   (string)          |    |
+------------------------------------+    |
|           (repeats)                |    -