最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Why would someone turn off Nagle's Algorithm? - Stack Overflow

programmeradmin3浏览0评论

From node redis docs:

socket_nodelay: defaults to true. Whether to call setNoDelay() on the TCP stream, which disables the Nagle algorithm on the underlying socket. Setting this option to false can result in additional throughput at the cost of more latency. Most applications will want this set to true.

Why would I want to turn off Nagle's algorithm?

From node redis docs:

socket_nodelay: defaults to true. Whether to call setNoDelay() on the TCP stream, which disables the Nagle algorithm on the underlying socket. Setting this option to false can result in additional throughput at the cost of more latency. Most applications will want this set to true.

Why would I want to turn off Nagle's algorithm?

Share Improve this question asked Mar 8, 2012 at 8:49 CamelCamelCamelCamelCamelCamel 5,1908 gold badges63 silver badges94 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 12

You would want to turn off the Nagle Algorithm when you're concerned about latency. My understanding of the algorithm is that it delays sending data until there is a reasonable amount to send. This in turn reduces the protocol overhead of the stream because more data is sent in a single packet (i.e. with a single header).

With the Nagle Algorithm turned off, the idea is that data is sent immediately by the protocol stack.

It was designed in the day when network resources were more constrained and so reducing the overhead was more important that expedient delivery. However these days with generally faster interconnects and more requirement for low-latency it's bee less important. (Think video streaming!)

发布评论

评论列表(0)

  1. 暂无评论