liveBook · Manning

Http/2

As explained in The Design of Web APIs, Second Edition

HTTP/2 is a version of the Hypertext Transfer Protocol that supports multiplexed parallel requests, persistent connections, and more efficient header and body compression.

HTTP/2 improves API efficiency without changing familiar HTTP requests, responses, methods, or status codes. It compresses headers and bodies, uses binary transmission, and supports persistent connections with parallel requests. section 13.2.1

Choose HTTP/2 when connection efficiency affects consumer experience:

  • Prefer it over HTTP/1.1 when consumers need parallel requests without opening multiple connections. section 13.2.1
  • Use a well-designed REST API over HTTP/2 when GraphQL-specific aggregation or selection features are unnecessary. section 14.8.1
  • Consider gRPC for internal microservices needing HTTP/2 bidirectional streaming, but not when browsers must consume the API. section 14.8.1

Parallel API loading

A consumer loading several JSON resources can send requests in parallel over one persistent HTTP/2 connection. HTTP/1.1 instead requires multiple connections for parallelism, while compression reduces transferred textual data. section 13.2.1

How The Design of Web APIs, Second Edition covers it

How deep it goes
Explains compression, binary transmission, connection reuse, and parallelism, but stops short of detailed server configuration.
Examples
Uses parallel consumer requests, compressed JSON, REST over HTTP/2, and gRPC bidirectional streaming as contrasts.
What it assumes
Assumes familiarity with HTTP requests, responses, methods, and statuses while contrasting HTTP/1.1 limitations.
What you can do after
Operate APIs over HTTP/2, or retain HTTP/1.1 compression and keep-alive when HTTP/2 is unavailable.
How it connects
Connects REST APIs with HTTP/1.1, GraphQL, gRPC, WebSockets, and API performance optimization.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of The Design of Web APIs, Second Edition. The section links point to the parts of the book it draws on.