liveBook · Manning

Keep-alive

As explained in Go in Practice, Second Edition

HTTP keep-alive is an HTTP feature that allows a server to retain a connection for subsequent requests.

HTTP keep-alive reuses a connection for later requests, avoiding repeated connection setup and TCP slow-start. Go’s net/http server and client support reuse by default. section 12.3.1

Preserve connection reuse by:

  • Using http.Get or http.Post, which rely on a keep-alive-enabled default client and transport. section 12.3.1

Custom transport

Create an http.Transport with TLS settings, compression preferences, and a net.Dialer whose KeepAlive is set to 30 seconds; attach it to an http.Client.

How Go in Practice, Second Edition covers it

How deep it goes
Explains performance benefits, protocol distinctions, defaults, custom transports, and response-body handling, but does not develop server implementation code.
Examples
Uses connection-timing diagrams, custom Go transports, and paired examples that contrast prompt versus delayed response-body closure.
What it assumes
Assumes HTTP client usage and distinguishes HTTP keep-alive from operating-system TCP keep-alive.
What you can do after
Apply it via Go’s net/http package by preserving default reuse, configuring custom transports, and closing response bodies promptly.
How it connects
Connects HTTP keep-alive with HTTP/2, HTTP/1.1, TCP keep-alive, net/http, HTTP clients, and TCP slow-start.

Related concepts

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