Networking Essentials medium
What does the `Connection: keep-alive` header achieve in HTTP/1.1?
- A It keeps the target application server running in a low-power mode to ensure that it can respond to subsequent incoming requests with zero initial computational delay.
- B It prevents the browser from closing the current active tabs, ensuring that the user's session state remains persistent even if the underlying network connection is temporarily lost.
- C It significantly increases the internal server-side timeout period for a specific request, allowing for the delivery of exceptionally large or complex data payloads.
- D It instructs the server not to close the underlying TCP socket after sending a response, allowing the same connection to be reused for multiple subsequent requests.
Answer: D. It instructs the server not to close the underlying TCP socket after sending a response, allowing the same connection to be reused for multiple subsequent requests.
In early versions of HTTP, the server would close the TCP connection as soon as it finished sending a single file. For a modern webpage with 100 images, this meant 100 slow TCP handshakes. The `keep-alive` header (default in HTTP/1.1) tells the server to 'keep the door open'. This allows the client to pipe multiple requests through the same established connection, drastically reducing latency and per-request CPU overhead. However, the server must now track many 'idle' connections, which consumes memory and file descriptors. If a server has millions of users, it must carefully time out these idle sockets to avoid running out of resources.
One system design question a day, with spaced repetition so the ones you miss come back.
Get the appRelated questions
- What is the downside of enabling 'Sticky Sessions' (Session Affinity) on a Load Balancer?
- In WebRTC (P2P Mesh), why is a STUN server required?
- What is the fundamental difference between a Network Switch and a Router?
- In Cloud Networking (AWS), what is the limitation of VPC Peering compared to a Transit Gateway?
- Which protocol is ideal for real-time multiplayer gaming positions or Voice over IP (VoIP), and why?
- What is the purpose of the 'Time To Live' (TTL) field in an IP packet?