The Backend Engineering Show with Hussein Nasser

Graceful shutdown in HTTP

Oct 17, 2025
This discussion explores the importance of graceful shutdowns in backend connections. It highlights reasons for closing connections, like resource management and preventing overload. Listeners learn how HTTP/1.1 and HTTP/2 handle these shutdowns, particularly the unique GOAWAY frame in HTTP/2. The impact of client-side pooling, along with historic issues like browser bugs related to GOAWAY, is also examined. The conversation wraps up with a summary of best practices for managing shutdowns effectively.
Ask episode
AI Snips
Chapters
Transcript
Episode notes
INSIGHT

Why Servers Need Connection Shutdowns

  • Servers close connections to free resources, prevent abuse, or reset accumulated per-connection state.
  • Closing a connection forces backend cleanup of heavy nested objects and cached state tied to that connection.
ADVICE

Notify Clients Before Closing

  • Use graceful shutdown to notify clients to stop sending new requests and allow in-flight requests to finish.
  • In HTTP/1.1 send a Connection: close header so clients create a fresh connection and backend can reclaim resources.
INSIGHT

HTTP/1.1 Connection Pools Throttle Load

  • Browsers use HTTP/1.1 connection pools per domain (Chrome ~6 connections) to throttle client concurrency.
  • This client-side pooling makes backend load more predictable compared with HTTP/2's single-connection model.
Get the Snipd Podcast app to discover more snips from this episode
Get the app