SPDY is a protocol that uses a single TCP connection to request and receive web page resources in parallel through multiplexed streams, allowing for header compression and prioritization of resources to reduce page load times. It works by establishing a single TCP connection between a client and server based on IP addresses, then streaming HTTP requests and responses concurrently over that connection through prioritized streams.
1. What is SPDY?
Framing layer implementing streams above TCP or TLS
Optimized for HTTP
How does it work?
Single client-server TCP connection - based on IP
addresses, not hostnames
HTTP Requests and Responses are streamed in parallel
over the TCP session
Optimizations
Compressed HTTP Headers in SYN_REPLY and
SYN_RESPONSE requests
Chunked responses to prevent head-of-line blocking
2. To target a 50% reduction in page load time
To minimize deployment complexity
To avoid the need for any changes to the content by
website authors
To allow many concurrent HTTP requests to run across a
single TCP session.
To reduce the bandwidth currently used by HTTP by
compressing headers and eliminating unnecessary headers.
To make SSL the underlying transport protocol, for better
security and compatibility with existing network
infrastructure
Goals for SPDY
3. What is a web page?
86 resources
13 hosts
800+KB
only 66% compressed (top sites are ~90% compressed)
4. Who is using SPDY?
Google Chrome
All Google Web Properties
Mozilla Firefox
Twitter
Amazon Silk
Others: Contendo, Strangeloop, iPhone client,
Apache mod-spdy, nginx beta, jetty, netty,
libraries in python, node.js, erlang, ruby, go, and
C
5. New Features
Multiplexing
Prioritization
Compression
Server Push
Transparent to HTTP application servers
deployable today
6. Improvements
One Connection per Domain to Exchange All Data
Multiplexed requests on the same connection
Permanent Connection to the server
Compression of Headers
Prioritized Requests
Server Push
Security by Design
HTTP Compatibility
Per-request flow control (Supported in SPDY v3)
7. Bottlenecks of HTTP Connections
HTTP relies on multiple connections for concurrency
Several problems caused by this
Additional round trips for connection setup
Slow-start delays
Connection rationing by the client, where it tries
to avoid opening too many connections to the single
server
The goal of SPDY is to reduce web page load time.
8. SPDY Layers
SPDY is split into 2 layers:
Framing Layer - which multiplexes a TCP
connection into independent, length-prefixed
frames. The framing layer is tailored to the
needs of the HTTP Protocol and Server push
HTTP Layer - which specifies the overlaying of
HTTP Request/Response pairs on top of the
framing layer
SPDY Framing layer runs on top of the reliable transport protocol like
TCP
SPDY Connections are persistent connections
SPDY is commonly used with TLS
9. SPDY Frame Types
Two types of Frames:
Control Frame contains
• a version number
• a frame type
• length
Data Frame contains
• a stream ID
• flags
• length for the payload carried after the common header.
There is always a common header which is 8 bytes in length.
The first bit indicates that whether the frame is a control frame
or a data frame.
10. SPDY Streams
Streams are independent sequences of bi-directional data
cut into frames
Streams are bidirectional – regular HTTP Requests for
Clients and unidirectional (server push) for servers
Streams may be created by either client or server
Streams optionally carry a set of name/value header pairs
Streams may be cancelled
11. SPDY Stream Frames
Types of SPDY Stream Frames:
SYN_STREAM - Open a new stream
SYN_REPLY - Remote Acknowledgement of newly
opened stream
RST_STREAM - Close a stream