Imagine I want to send one byte to your server. TPC needs 40 bytes in order to work (20bytes TCP and 20bytes for IPv4). I just wanted to send one byte but I must send 41 bytes! This is huge overload.
Meet Nagle’s algorithm.
This may sound awesome but.. all that glitters is not gold. Using such a technique has some drawbacks. I am gonna describe two.
Using Nagel’s algorithm with games or other realtime stuff is not very recommended. In really depends on the app itself as the game could be turn based so we don’t care but in FPS like games etc.. I would not recommend using this algorithm. Why?
Nagel’s algorithm basically merge all packets and send them when there’s a reasonable amount to send. This sounds good but in case you build a low latency app/software you should turn this algorithm off (At least for some low latency operations).
Go away, clients!
Do you build an app where you expect high amount of concurrent connections? I would say that you will try to handle responses as quick as possible in order to handle more. For example, disabling nagel’s for long-pool connections could save some milliseconds for you.
I would recommend this article: Scaling node.js to 100k concurrent connections!