Skip to main content
InterviewHubPRO
Section Overview
Q46

Question 46 of 50

Part 3: Advanced Internals, Scale & Production Patterns (Senior / Lead)

92%
Networking & Protocols (50 Qs)•Part 3: Advanced Internals, Scale & Production Patterns (Senior / Lead)

TCP Keep-Alive vs HTTP Persistent Connections (`Keep-Alive` header).

senior LevelHTTP & REST APIs

In Simple Words: Two completely different concepts operating at different OSI layers:

  • HTTP Connection: keep-alive (Layer 7): Reuses the same underlying TCP connection to send multiple sequential HTTP requests and responses, avoiding the 3-way handshake overhead for every image or CSS file.
  • TCP Keep-Alive (Layer 4): Operates at the OS socket level. Sends empty probe packets with duplicate sequence numbers every 2 hours (or configured interval) to verify that an idle connection's peer has not crashed or lost power.