Introduction

HTTP/2 is a major revision of HTTP network protocol use by the World Wide Web. It was derived from the SPDY(pronounced "speedy") protocol.

Goals

  • Create a negotiation mechanism that allows clients and servers to elect to use protocol.
  • Maintain high-level compatibility with HTTP 1.1
  • Decrease latency to improve page load speed.
    • Header data compression.
    • HTTP/2 Server push.
    • Pipelineing of requests.
    • Multiplexing multiple request over a single TCP connection.

Difference from HTTP 1.1

Same as HTTP1.1

  • Methods.
  • Status codes.
  • Header fields.
  • URIS

Different

  • How the data is framed.
  • How the data is transported between the client and server.

HTTP/2 Protocol Overview

 HTTP/2 provides an optimized transport for HTTP semantics.
HTTP/2 support all of core features of HTTP/1.1 but aims to be more efficient in several ways.

 The basic protocol unit in HTTP/2 is a frame. Each frame type servers different purpose. 
For Example HEADERS, and DATA frames form the basis of HTTP request and response.
Other frame type like SETTING, WINDOW_UPDATE, PUSH_NOTIFICATION are used in support of other HTTP/2 features.

 Multiplexing of requests is achieved by having each HTTP request/response exchange associated with its own stream.
Streams are largely independent of each other(Streams are identified by an integer.)

 Flow control and prioritization ensure that it is possible to efficiently use multiplexed streams.
Flow control helps to ensure that only data that can be used by receiver is transmitted.
Prioritization ensures that limited resources can be directed to the most important stream first.
(Priority unit is a stream.)

 HTTP/2 adds a new interaction mode whereby a server can push response to a client. 
Server push allows a server to speculatively send data to a client that the server anticipate the client will need,
trading off some network usage against a potential latency gain.
The server dose this by synthesizing a request, which it sends as a PUSH_PROMISE frame. 
The server is then able to send a response to the synthetic request on a separate stream.

 Because HTTP header fields used in a connection can contain large amount of redundant data, 
frames that contain them are compressed.
This has especially advantageous impact upon request sizes in the common case, 
allowing many request to be compressed into one packet.

from RFC7540

Limitation

  • HTTP/2 allows a server to push responses (along with corresponding "promised" requests) to a client in association with a previous client-initiated request.
  • HTTP/2 server push is made for loading webpage as fast as possible.
sequenceDiagram Server ->>+ Client : PUSH_PROMISE (request) Client -->>- Server : void Server ->>+ Client : response (response to above reqeust) Client -->>- Server : void

SPDY

SPDY is network protocol.

Goal
  • Reduce webpage load latency.
  • Improve web security.
HowTo
  • Compression.
  • Multiplexing.
  • prioritization.