3. RTTM: ROUND-TRIP TIME MEASUREMENT
往返时间衡量
3.1 Introduction
Accurate and current RTT estimates are necessary to adapt to
changing traffic conditions and to avoid an instability known as
"congestion collapse" [Nagle84] in a busy network. However,
accurate measurement of RTT may be difficult both in theory and in
implementation.
准确和当前的往返时间估计对于应对不断变化的网络情况和避免在繁忙网络时拥塞崩溃。
Many TCP implementations base their RTT measurements upon a sample
of only one packet per window. While this yields an adequate
approximation to the RTT for small windows, it results in an
unacceptably poor RTT estimate for an LFN. If we look at RTT
estimation as a signal processing problem (which it is), a data
signal at some frequency, the packet rate, is being sampled at a
lower frequency, the window rate. This lower sampling frequency
violates Nyquist's criteria and may therefore introduce "aliasing"
artifacts into the estimated RTT [Hamming77].
一些TCP的实现基于他们的RTT计算,但是一个window只有一个pack作为代表。
A good RTT estimator with a conservative retransmission timeout
calculation can tolerate aliasing when the sampling frequency is
"close" to the data frequency. For example, with a window of 8
packets, the sample rate is 1/8 the data frequency -- less than an
order of magnitude different. However, when the window is tens or
hundreds of packets, the RTT estimator may be seriously in error,
resulting in spurious retransmissions.
一个好的方案是一个保守的重传评估可以在采样频率‘close’原始数据频率的情况下容忍失真,比如,具有8个包得数据窗口,采样频率是1/8,小于大小差值的顺序。并且,如果一个窗口有几百个包,RTT的估算可能会有错误,导致伪重传的问题。
If there are dropped packets, the problem becomes worse. Zhang
Jacobson, Braden, & Borman [Page 11]
RFC 1323 TCP Extensions for High Performance May 1992
[Zhang86], Jain [Jain86] and Karn [Karn87] have shown that it is
not possible to accumulate reliable RTT estimates if retransmitted
segments are included in the estimate. Since a full window of
data will have been transmitted prior to a retransmission, all of
the segments in that window will have to be ACKed before the next
RTT sample can be taken. This means at least an additional
window's worth of time between RTT measurements and, as the error
rate approaches one per window of data (e.g., 10**-6 errors per
bit for the Wideband satellite network), it becomes effectively
impossible to obtain a valid RTT measurement.
A solution to these problems, which actually simplifies the sender
substantially, is as follows: using TCP options, the sender places
a timestamp in each data segment, and the receiver reflects these
timestamps back in ACK segments. Then a single subtract gives the
sender an accurate RTT measurement for every ACK segment (which
will correspond to every other data segment, with a sensible
receiver). We call this the RTTM (Round-Trip Time Measurement)
mechanism.
It is vitally important to use the RTTM mechanism with big
windows; otherwise, the door is opened to some dangerous
instabilities due to aliasing. Furthermore, the option is
probably useful for all TCP's, since it simplifies the sender.
3.2 TCP Timestamps Option
TCP is a symmetric protocol, allowing data to be sent at any time
in either direction, and therefore timestamp echoing may occur in
either direction. For simplicity and symmetry, we specify that
timestamps always be sent and echoed in both directions. For
efficiency, we combine the timestamp and timestamp reply fields
into a single TCP Timestamps Option.
TCP为对称协议,数据可以在任何时间任何方向传递,并且两个方向都可以有时间戳。组合时间戳和应答时间戳作为一个单独的TCP时间戳选项。
Jacobson, Braden, & Borman [Page 12]
RFC 1323 TCP Extensions for High Performance May 1992
TCP Timestamps Option (TSopt):
Kind: 8
Length: 10 bytes
+-------+-------+---------------------+---------------------+
|Kind=8 | 10 | TS Value (TSval) |TS Echo Reply (TSecr)|
+-------+-------+---------------------+---------------------+
1 1 4 4
The Timestamps option carries two four-byte timestamp fields.
The Timestamp Value field (TSval) contains the current value of
the timestamp clock of the TCP sending the option.
TSval:当前TCP发送请求包的时间戳
TSecr:
The Timestamp Echo Reply field (TSecr) is only valid if the ACK
bit is set in the TCP header; if it is valid, it echos a times-
tamp value that was sent by the remote TCP in the TSval field
of a Timestamps option. When TSecr is not valid, its value
must be zero. The TSecr value will generally be from the most
recent Timestamp option that was received; however, there are
exceptions that are explained below.
A TCP may send the Timestamps option (TSopt) in an initial
<SYN> segment (i.e., segment containing a SYN bit and no ACK
bit), and may send a TSopt in other segments only if it re-
ceived a TSopt in the initial <SYN> segment for the connection.
3.3 The RTTM Mechanism
The timestamp value to be sent in TSval is to be obtained from a
(virtual) clock that we call the "timestamp clock". Its values
must be at least approximately proportional to real time, in order
to measure actual RTT.
TSval中的时间戳是来自虚拟时钟的,我们可以称之为时间戳时钟,它的值必须大致的正比于实际时间。
The following example illustrates a one-way data flow with
segments arriving in sequence without loss. Here A, B, C...
represent data blocks occupying successive blocks of sequence
numbers, and ACK(A),... represent the corresponding cumulative
acknowledgments. The two timestamp fields of the Timestamps
option are shown symbolically as <TSval= x,TSecr=y>. Each TSecr
field contains the value most recently received in a TSval field.
Jacobson, Braden, & Borman [Page 13]
RFC 1323 TCP Extensions for High Performance May 1992
TCP A TCP B
<A,TSval=1,TSecr=120> ------>
<---- <ACK(A),TSval=127,TSecr=1>
<B,TSval=5,TSecr=127> ------>
<---- <ACK(B),TSval=131,TSecr=5>
. . . . . . . . . . . . . . . . . . . . . .
<C,TSval=65,TSecr=131> ------>
<---- <ACK(C),TSval=191,TSecr=65>
(etc)
The dotted line marks a pause (60 time units long) in which A had
nothing to send. Note that this pause inflates the RTT which B
could infer from receiving TSecr=131 in data segment C. Thus, in
one-way data flows, RTTM in the reverse direction measures a value
that is inflated by gaps in sending data. However, the following
rule prevents a resulting inflation of the measured RTT:
A TSecr value received in a segment is used to update the
averaged RTT measurement only if the segment acknowledges
some new data, i.e., only if it advances the left edge of the
send window.
Since TCP B is not sending data, the data segment C does not
acknowledge any new data when it arrives at B. Thus, the inflated
RTTM measurement is not used to update B's RTTM measurement.
3.4 Which Timestamp to Echo
If more than one Timestamps option is received before a reply
segment is sent, the TCP must choose only one of the TSvals to
echo, ignoring the others. To minimize the state kept in the
receiver (i.e., the number of unprocessed TSvals), the receiver
should be required to retain at most one timestamp in the
connection control block.
Jacobson, Braden, & Borman [Page 14]
RFC 1323 TCP Extensions for High Performance May 1992
There are three situations to consider:
(A) Delayed ACKs.
Many TCP's acknowledge only every Kth segment out of a group
of segments arriving within a short time interval; this
policy is known generally as "delayed ACKs". The data-sender
TCP must measure the effective RTT, including the additional
time due to delayed ACKs, or else it will retransmit
unnecessarily. Thus, when delayed ACKs are in use, the
receiver should reply with the TSval field from the earliest
unacknowledged segment.
(B) A hole in the sequence space (segment(s) have been lost).
The sender will continue sending until the window is filled,
and the receiver may be generating ACKs as these out-of-order
segments arrive (e.g., to aid "fast retransmit").
The lost segment is probably a sign of congestion, and in
that situation the sender should be conservative about
retransmission. Furthermore, it is better to overestimate
than underestimate the RTT. An ACK for an out-of-order
segment should therefore contain the timestamp from the most
recent segment that advanced the window.
The same situation occurs if segments are re-ordered by the
network.
(C) A filled hole in the sequence space.
The segment that fills the hole represents the most recent
measurement of the network characteristics. On the other
hand, an RTT computed from an earlier segment would probably
include the sender's retransmit time-out, badly biasing the
sender's average RTT estimate. Thus, the timestamp from the
latest segment (which filled the hole) must be echoed.
An algorithm that covers all three cases is described in the
following rules for Timestamps option processing on a synchronized
connection:
(1) The connection state is augmented with two 32-bit slots:
TS.Recent holds a timestamp to be echoed in TSecr whenever a
segment is sent, and Last.ACK.sent holds the ACK field from
the last segment sent. Last.ACK.sent will equal RCV.NXT
except when ACKs have been delayed.
Jacobson, Braden, & Borman [Page 15]
RFC 1323 TCP Extensions for High Performance May 1992
(2) If Last.ACK.sent falls within the range of sequence numbers
of an incoming segment:
SEG.SEQ <= Last.ACK.sent < SEG.SEQ + SEG.LEN
then the TSval from the segment is copied to TS.Recent;
otherwise, the TSval is ignored.
(3) When a TSopt is sent, its TSecr field is set to the current
TS.Recent value.
The following examples illustrate these rules. Here A, B, C...
represent data segments occupying successive blocks of sequence
numbers, and ACK(A),... represent the corresponding
acknowledgment segments. Note that ACK(A) has the same sequence
number as B. We show only one direction of timestamp echoing, for
clarity.
o Packets arrive in sequence, and some of the ACKs are delayed.
By Case (A), the timestamp from the oldest unacknowledged
segment is echoed.
TS.Recent
<A, TSval=1> ------------------->
1
<B, TSval=2> ------------------->
1
<C, TSval=3> ------------------->
1
<---- <ACK(C), TSecr=1>
(etc)
o Packets arrive out of order, and every packet is
acknowledged.
By Case (B), the timestamp from the last segment that
advanced the left window edge is echoed, until the missing
segment arrives; it is echoed according to Case (C). The
same sequence would occur if segments B and D were lost and
retransmitted..
Jacobson, Braden, & Borman [Page 16]
RFC 1323 TCP Extensions for High Performance May 1992
TS.Recent
<A, TSval=1> ------------------->
1
<---- <ACK(A), TSecr=1>
1
<C, TSval=3> ------------------->
1
<---- <ACK(A), TSecr=1>
1
<B, TSval=2> ------------------->
2
<---- <ACK(C), TSecr=2>
2
<E, TSval=5> ------------------->
2
<---- <ACK(C), TSecr=2>
2
<D, TSval=4> ------------------->
4
<---- <ACK(E), TSecr=4>
(etc)
相关推荐
TCP代理用Go语言编写的... | bash 来源$ go get -v github.com/jpillora/go-tcp-proxy/cmd/tcp-proxy用法 $ tcp-proxy --helpUsage of tcp-proxy: -c: output ansi colors -h: output hex -l="localhost:9999": local
(接TCP-IP详解卷2-1:实现) 本书完整而详细地介绍了TCP/IP协议是如何实现的。书中给出了约500个图例,15 000行实际操作的C代码,采用举例教学的方法帮助你掌握TCP/IP实现。本书不仅说明了插口API和协议族的关系...
npm install ping-tcp-js ping 参数 const host = 'google.com'; const port = 80; client.ping(host, port); // or client.ping({host, port}); 主持人 const client = require('ping-tcp-js'); const host = ...
### TCP-IP详解卷1:协议00009 #### 概述 本文档将对《TCP-IP详解卷1:协议00009》中的关键参数进行详细解析,帮助读者理解TCP/IP协议栈中各个配置项的作用及其设置方式。这些配置项涉及到IP、ICMP、ARP、UDP以及...
tcp-over-websockets 通过 WebSockets 隧道 TCP。 访问任何你想要的东西,即使是从一个只允许 HTTPS 的蹩脚 WiFi。 注意: 可能是同样的东西,但更好。 类似。 隧道客户端 使用 : npx tcp-over-websockets wss:/...
react-native-tcp-socket 使用客户端SSL / TLS支持对Android,iOS和macOS的本机TCP套接字API进行React。 它允许您创建TCP客户端和服务器套接字,以模仿Node的API功能(有关更多信息,请参见可用的 )。 目录 SSL...
TCP-IP详解卷三:TCP事务协议,HTTP,NNTP和UNIX域协议TCP-IP详解卷三:TCP事务协议,HTTP,NNTP和UNIX域协议TCP-IP详解卷三:TCP事务协议,HTTP,NNTP和UNIX域协议TCP-IP详解卷三:TCP事务协议,HTTP,NNTP和UNIX域...
Labview 虚拟仪器编程实例, 第二章 虚拟仪器软件开发平台(1) 2-1:开关和指示灯.vi 2-2:对已有VI程序操作.vi 2-3:图形性控件.vi 2-4:属性节点.vi 2-... 7-1:发布数据.vi 7-2:客户读取.vi 7-3:TCP服务器端.vi 7-4:TC
TCP-IP详解卷三:TCP事务协议,HTTP,NNTP和UNIX域协议./TCP-IP详解卷三:TCP事务协议,HTTP,NNTP和UNIX域协议./TCP-IP详解卷三:TCP事务协议,HTTP,NNTP和UNIX域协议./TCP-IP详解卷三:TCP事务协议,HTTP,NNTP和...
- 说明: 控制处于TIME_WAIT状态的TCP连接数量上限。 10. **TCP SACK启用**: - 参数: `net.ipv4.tcp_sack` - 设置: `1` - 说明: 启用选择性确认功能,提高传输效率。 11. **支持大窗口**: - 参数: `...
The Implementation (TCP-IP Illustrated Volume 2).part1.rar(共8部分,第1部分)
这是gps平台gataway --online jvm选项DEFAULT_JVM_OPTS =“-Xmx4g -Xms4g -XX:+ UseG1GC -XX:GCTimeRatio = 19 -XX:MaxGCPauseMillis = 400 -XX:+ PrintGC -XX:+ PrintGCDetails -XX:+ PrintGCTimeStamps -XX...
pomelo-node-tcp-client 用于Pomelo框架的Node.js TCP客户端库。指示使用npm install pomelo-node-tcp-client 用法: var Pomelo = require ( "pomelo-node-tcp-client" )pomelo . init ( "127.0.0.1" , 3010 , { } ...
tcp-to-tls -h $ ./tcp-to-tls -h Usage of ./tcp-to-tls: -host="": Remote host to connect. Mandatory. -port=0: Remote port to connect. Mandatory. -insecure-skip-verify=false: Skip verification of ...
ws-tcp-proxy 简单的websocket tcp代理。 Usage: ws-tcp-proxy <address> [flags] Flags: -a, --auto-cert string register hostname with LetsEncrypt -c, --cert string path to cert.pem for TLS -k, --key...
本文将深入讲解一个名为`node-tcp-client`的模块,它是一个简单且具备重新连接功能的TCP客户端,专为JavaScript开发人员设计。 首先,TCP(传输控制协议)是一种面向连接的、可靠的、基于字节流的传输层通信协议,...
tcp隧道TCP隧道服务器和客户端,多用户支持安装必需的Node.js v4.0或更高版本$ npm install tcp-tunnel -g配置服务器端配置文件server.conf : :valueport = 5000# clients# name:password:clientA:123456B:123456# ...
tcp代理实验性零拷贝 tcp 代理用法: $ make $ ./bin/tcp-proxy 例如:$ ./bin/tcp-proxy 本地主机:8080 本地主机:8000 一些实现提示: 默认启动nproc线程,每个线程运行独立的事件循环 (libev) 每个事件循环接受...