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的更多相关文章

  1. Nagle's algorithm

    w41字节的数据包只有1字节的可用信息.以减少数据包发送量来提高TCP/IP网络性能. https://en.wikipedia.org/wiki/Nagle's_algorithm https:// ...

  2. Nagle's algorithm 封包 网络游戏协议封包需注意点 封包挂

    w41字节的数据包只有1字节的可用信息.以减少数据包发送量来提高TCP/IP网络性能. https://en.wikipedia.org/wiki/Nagle's_algorithm https:// ...

  3. 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 ...

  4. TCP Nagle算法&&延迟确认机制

    TCP Nagle算法&&延迟确认机制 收藏 秋风醉了 发表于 3年前 阅读 1367 收藏 0 点赞 0 评论 0 [腾讯云]买域名送云解析+SSL证书+建站!>>> ...

  5. 神秘的40毫秒延迟与 TCP_NODELAY

    写 HTTP Server,不可免俗地一定要用 ab 跑一下性能,结果一跑不打紧,出现了一个困扰了我好几天的问题:神秘的 40ms 延迟. Table of Contents 1 现象 2 背后的原因 ...

  6. TCP_NODELAY 和 TCP_NOPUSH的解释

    一.问题的来源 今天看到 huoding 大哥分享的 lamp 面试题,其中一点提到了: Nginx 有两个配置项: TCP_NODELAY 和 TCP_NOPUSH ,请说明它们的用途及注意事项. ...

  7. Nagle算法&&延时确认

    数据流分类 成块数据 交互数据   Rlogin需要远程系统(服务器)回显我们(客户)键入的字符 数据字节和数据字节的回显都需要对方确认 rlogin 每次只发送一个字节到服务器,而Telnet 可以 ...

  8. tcp 粘包 和 TCP_NODELAY 学习

    TCP通信粘包问题分析和解决  在socket网络程序中,TCP和UDP分别是面向连接和非面向连接的.因此TCP的socket编程,收发两端(客户端和服务器端)都要有成对的socket,因此,发送端为 ...

  9. 仔细看参数--NGINX之tcp_nodelay

    一.知识准备 ● 在nginx优化中有个经常需要设置的参数,tcp_nodelay ● 该参数最核心的功能,就是把小包组成成大包,提高带宽利用率也就是著名的nagle算法 ● tcp协议中,有一个现象 ...

随机推荐

  1. 进程控制函数(2)-setpgid() 修改当前进程的进程组ID

    定义:int setpgid(pid_t pid,pid_t pgid); 表头文件:#include<unistd.h> 说明:setpgid()将参数pid 指定进程所属的组识别码设为 ...

  2. 【C语言】18-变量类型

    一.变量的作用域 C语言根据变量作用域的不同,将变量分为局部变量和全局变量. 1.局部变量 1> 定义:在函数内部定义的变量,称为局部变量.形式参数也属于局部变量. 2> 作用域:局部变量 ...

  3. js 控制不同客户端 访问不同CSS js

    function loadCSS(flag) { var t='.css'; if((navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios ...

  4. hdu1331(记忆化搜索)

    #include<iostream> #include<stdio.h> #include<string.h> using namespace std; typed ...

  5. EF调用存储过程、函数

    一.ef4.1 codeFirst 修改表结构 增加字段等 EF code first需要重新生成库导致数据丢失的问题 说这个问题前 首先先说下 我使用ef4.1 codefirst的目的. 是因为可 ...

  6. HeadFisrt 设计模式03 装饰者

    类应该对扩展开放, 对修改关闭. 所谓装饰者模式, 是指用其他的类来装饰某个类, 装饰者说白了就是使用 has-a 来代替 is-a 隐喻 咖啡店, 有很多种咖啡, 咖啡里还要增加一些 milk, 面 ...

  7. 关于Unity中的transform组件(一)

    一.transform组件用途 1.维护场景树 2.对3D物体的平移,缩放,旋转 二.场景树定义 在Hierarchy视图中显示的: 一个game_scene场景,下面有Main Camera节点,D ...

  8. 随机森林(Random Forest)

    决策树介绍:http://www.cnblogs.com/huangshiyu13/p/6126137.html 一些boosting的算法:http://www.cnblogs.com/huangs ...

  9. android之SQLite数据库insert操作

    原型: long Android.database.sqlite.SQLiteDatabase.insert(String table, String nullColumnHack, ContentV ...

  10. php -- 魔术方法 之 判断属性是否存在或为空:__isset()

    属性重载:当访问一个不存在或者权限不够的属性的时候,能够触发一系列的魔术方法,就叫做属性重载 __isset($name):当使用 isset()函数或者empty()函数 判断属性是否存在或者是否为 ...