Nagle's Algorithm and TCP_NODELAY
w非全尺寸分组的发送条件
HTTP The Definitive Guide
TCP has a data stream interface that permits applications to stream data of any size to the TCP stack—
even a single byte at a time! But because each TCP segment carries at least 40 bytes of flags and
headers, network performance can be degraded severely if TCP sends large numbers of packets
containing small amounts of data.
[5]
[5]
Sending a storm of single-byte packets is called "sender silly window syndrome." This is inefficient, anti-
social, and can be disruptive to other Internet traffic.
Nagle's algorithm (named for its creator, John Nagle) attempts to bundle up a large amount of TCP
data before sending a packet, aiding network efficiency. The algorithm is described in RFC 896,
"Congestion Control in IP/TCP Internetworks."
Nagle's algorithm discourages the sending of segments that are not full-size (a maximum-size packet
is around 1,500 bytes on a LAN, or a few hundred bytes across the Internet). Nagle's algorithm lets
you send a non-full-size packet only if all other packets have been acknowledged. If other packets are
still in flight, the partial data is buffered. This buffered data is sent only when pending packets are
acknowledged or when the buffer has accumulated enough data to send a full packet.
[6]
[6]
Several variations of this algorithm exist, including timeouts and acknowledgment logic changes, but the
basic algorithm causes buffering of data smaller than a TCP segment.
Nagle's algorithm causes several HTTP performance problems. First, small HTTP messages may not
fill a packet, so they may be delayed waiting for additional data that will never arrive. Second, Nagle's
algorithm interacts poorly with disabled acknowledgments—Nagle's algorithm will hold up the
sending of data until an acknowledgment arrives, but the acknowledgment itself will be delayed 100-
200 milliseconds by the delayed acknowledgment algorithm.
[7]
[7]
These problems can become worse when using pipelined connections (described later in this chapter),
because clients may have several messages to send to the same server and do not want delays. HTTP applications often disable Nagle's algorithm to improve performance, by setting the
TCP_NODELAY parameter on their stacks. If you do this, you must ensure that you write large
chunks of data to TCP so you don't create a flurry of small packets.

Nagle's Algorithm and TCP_NODELAY的更多相关文章
- Nagle's algorithm
w41字节的数据包只有1字节的可用信息.以减少数据包发送量来提高TCP/IP网络性能. https://en.wikipedia.org/wiki/Nagle's_algorithm https:// ...
- Nagle's algorithm 封包 网络游戏协议封包需注意点 封包挂
w41字节的数据包只有1字节的可用信息.以减少数据包发送量来提高TCP/IP网络性能. https://en.wikipedia.org/wiki/Nagle's_algorithm https:// ...
- linux tcp Nagle算法,TCP_NODELAY和TCP_CORK 转载
转载自: http://www.cnhalo.net/2016/08/13/linux-tcp-nagle-cork/ http://abcdxyzk.github.io/blog/2018/07/0 ...
- TCP Nagle算法&&延迟确认机制
TCP Nagle算法&&延迟确认机制 收藏 秋风醉了 发表于 3年前 阅读 1367 收藏 0 点赞 0 评论 0 [腾讯云]买域名送云解析+SSL证书+建站!>>> ...
- 神秘的40毫秒延迟与 TCP_NODELAY
写 HTTP Server,不可免俗地一定要用 ab 跑一下性能,结果一跑不打紧,出现了一个困扰了我好几天的问题:神秘的 40ms 延迟. Table of Contents 1 现象 2 背后的原因 ...
- TCP_NODELAY 和 TCP_NOPUSH的解释
一.问题的来源 今天看到 huoding 大哥分享的 lamp 面试题,其中一点提到了: Nginx 有两个配置项: TCP_NODELAY 和 TCP_NOPUSH ,请说明它们的用途及注意事项. ...
- Nagle算法&&延时确认
数据流分类 成块数据 交互数据 Rlogin需要远程系统(服务器)回显我们(客户)键入的字符 数据字节和数据字节的回显都需要对方确认 rlogin 每次只发送一个字节到服务器,而Telnet 可以 ...
- tcp 粘包 和 TCP_NODELAY 学习
TCP通信粘包问题分析和解决 在socket网络程序中,TCP和UDP分别是面向连接和非面向连接的.因此TCP的socket编程,收发两端(客户端和服务器端)都要有成对的socket,因此,发送端为 ...
- 仔细看参数--NGINX之tcp_nodelay
一.知识准备 ● 在nginx优化中有个经常需要设置的参数,tcp_nodelay ● 该参数最核心的功能,就是把小包组成成大包,提高带宽利用率也就是著名的nagle算法 ● tcp协议中,有一个现象 ...
随机推荐
- lua urlencode urldecode URL编码
URL编码其实就是对一些字符转义为%加上该字符对应ASCII码的二位十六进制形式. 如: 字符 特殊字符的含义 URL编码 # 用来标志特定的文档位置 % % 对特殊字符进行编码 % & 分隔 ...
- python操作word之pywin32的安装
PyCharm 2016.2 官网中文汉化破解版 注册码 http://idea.lanyus.com/ 首先下载安装win32com,下载32位的,不然安装的时候可能检测不到python https ...
- [uboot]uboot如何引导系统
转自:http://bbs.elecfans.com/jishu_455028_1_1.html 如6410的bootcmd和bootargs默认存在于uboot1.1.6/include/confi ...
- Android——RelativeLayout(相对布局)
一.相对于父容器 1.居中 2.同方向 <?xml version="1.0" encoding="utf-8"?> <RelativeLay ...
- java定时调度器解决方案分类及特性介绍
什么是定时调度器? 我们知道程序的运行要么是由事件触发的,而这种事件的触发源头往往是用户通过ui交互操作层层传递过来的:但是我们知道还有另外一种由机器系统时间触发的程序运行场景.大家想想是否遇到或者听 ...
- librtmp将本地FLV文件发布到RTMP流媒体服务器
没有用到ffmpeg库 可以将本地FLV文件发布到RTMP流媒体服务器 使用librtmp发布RTMP流可以使用两种API:RTMP_SendPacket()和RTMP_Write(). 使用RTMP ...
- make: *** [sapi/cli/php] Error 1 解决办法
make: *** [sapi/cli/php] Error 1 一:考虑过make clean,问题依然 二:(采取此方法后出现启动apache报错:/usr/local/apache2/modul ...
- C++ 指针引用
//指针引用 #include<iostream> using namespace std; struct Teacher{ ]; int age; }; int InitA(Teache ...
- php if语句判定ms查询是否为空
$select_re_id=$cnx->query("select count(*) c from Yid where pid='".$pid."' and gid ...
- Spring Framework 官方文档学习(二)之IoC容器与bean lifecycle
到目前为止,已经看了一百页.再次感慨下,如果想使用Spring,那可以看视频或者找例子,但如果想深入理解Spring,最好还是看官方文档. 原计划是把一些基本接口的功能.层次以及彼此的关系罗列一下.同 ...