Interview Prep/Networking/TLS, HTTP & Application Layer

What is the difference between HTTP keep-alive and a new TCP connection per request?

BeginnerScenarioTLS, HTTP & Application Layer
Answer

Situation read → Connection reuse saves handshakes.

What I'd do →

  1. A new connection costs a TCP handshake plus TLS handshake, around 2 to 3 round trips
  2. Keep-alive reuses the connection for many requests
  3. Configure with Nginx keepalive_timeout 65; for clients and keepalive 32; for upstream
  4. Confirm reuse with curl -v showing Re-using existing connection

Why → Connection setup often costs more time than the request itself.

Interview tip → Say the server's keep-alive timeout should exceed the LB's idle timeout.

All Networking questions Roadmap: Networking for DevOps

More on TLS, HTTP & Application Layer