Nagle's Algorithm is enabled by default in TCP. Why might you disable it (`TCP_NODELAY`) for a real-time game?
- A Because Nagle's algorithm consumes a disproportionate amount of CPU cycles by constantly calculating the optimal checksum for small, high-frequency data packets.
- B Because the algorithm significantly increases the overall bandwidth usage by redundantely re-sending small control packets to ensure the stable state of the connection.
- C Because the buffering logic within the algorithm fundamentally conflicts with the end-to-end cryptographic integrity checks required for secure real-time communication.
- D Because Nagle's algorithm buffers small outgoing messages to combine them into fewer, larger packets, which can introduce a critical 200ms delay to 'instant' player updates.
Nagle's Algorithm was designed to prevent the 'tinygram' problem, where a user typing in a terminal sends a 41-byte packet (header + 1 byte of text), which is very inefficient. Nagle says: 'Wait until we have enough data to fill a whole packet, or until the last packet is acknowledged'. While this saves bandwidth, it is a disaster for real-time games. If you press 'Jump', Nagle might hold that message for up to 200ms, waiting for more data to arrive. In gaming, we'd rather waste bandwidth by sending a small packet immediately than suffer any delay. Setting `TCP_NODELAY` disables Nagle and ensures that every write to the socket is sent as soon as possible.
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?