tcp协议论文(TCp协议称为)

      最后更新:2023-09-03 11:40

      TCP协议总结

      Transmission Control Protocol,传输控制协议,是一种面向连接的、可靠的、基于字节流的传输层通信协议TCP协议的目的是:在不可靠传输的IP层之上建立一套可靠传输的机制。TCP的可靠只是对于它自身来说的, 甚至是对于socket接口层, 两个系统就不是可靠的了, 因为发送出去的数据, 没有确保对方真正的读到(所以要在业务层做重传和确认机制)。可靠传输的第一要素是确认, 第二要素是重传, 第三要素是顺序。 任何一个可靠传输的系统, 都必须包含这三个要素。数据校验也是必要的。传输是一个广义的概念, 不局限于狭义的网络传输, 应该理解为通信和交互. 任何涉及到通信和交互的东西, 都可以借鉴TCP的思想。无论是在UDP上实现可靠传输或者创建自己的通信系统,无论这个系统是以API方式还是服务方式,只要是一个通信系统,就要考虑这三个要素。SeqNum的增加是和传输的字节数相关的。上图中,三次握手后,来了两个Len:1440的包,而第二个包的SeqNum就成了1441。然后第一个ACK回的是1441(下一个待接收的字节号),表示第一个1440收到了。网络上的传输是没有连接的,包括TCP也是一样的。而TCP所谓的“连接”,其实只不过是在通讯的双方维护一个“连接状态”,让它看上去好像有连接一样。所以,TCP的状态变换是非常重要的。查看各种状态的数量ss -ant | awk '{++s[$1]} END {for(k in s) print k,s[k]}'通过三次握手完成连接的建立三次握手的目的是交换通信双方的初始化序号,以保证应用层接收到的数据不会乱序,所以叫SYN(Synchronize Sequence Numbers)。ISN是不能hard code的,不然会出问题的。比如:如果连接建好后始终用1来做ISN,如果client发了30个segment过去,但是网络断了,于是client重连,又用了1做ISN,但是之前连接的那些包到了,于是就被当成了新连接的包,此时,client的Sequence Number可能是3,而Server端认为client端的这个号是30了。全乱了。RFC793中说,ISN会和一个假的时钟绑在一起,这个时钟会在每4微秒对ISN做加一操作,直到超过232,又从0开始。这样,一个ISN的周期大约是4.55个小时。因为,我们假设我们的TCP Segment在网络上的存活时间不会超过Maximum Segment Lifetime(MSL),所以,只要MSL的值小于4.55小时,那么,我们就不会重用到ISN。如果Server端接到了Clien发的SYN后回了SYN-ACK,之后Client掉线了,Server端没有收到Client返回的ACK,那么,这个连接就处于一个中间状态,即没成功,也没失败。于是,Server端如果在一定时间内没有收到的ACK会重发SYN-ACK。在Linux下,默认重试次数为5次,重试的间隔时间从1s开始每次都翻番,5次的重试时间间隔为1s, 2s, 4s, 8s, 16s,总共31s,第5次发出后还要等32s都知道第5次也超时了,所以,总共需要 1s + 2s + 4s+ 8s+ 16s + 32s = 26 -1 = 63s,TCP才会断开这个连接。客户端给服务器发了一个SYN后,就下线了,于是服务器需要默认等63s才会断开连接,这样,攻击者就可以把服务器的SYN连接的队列耗尽,让正常的连接请求不能处理。于是,Linux下给了一个叫tcp_syncookies的参数来应对这个事:当SYN队列满了后,TCP会通过源地址端口、目标地址端口和时间戳打造出一个特别的Sequence Number发回去(又叫cookie),此时服务器并没有保留客户端的SYN包。如果是攻击者则不会有响应,如果是正常连接,则会把这个SYN Cookie发回来,然后服务端可以通过cookie建连接(即使你不在SYN队列中)。千万别用tcp_syncookies来处理正常的大负载的连接的情况。因为sync cookies是妥协版的TCP协议,并不严谨。应该调整三个TCP参数:tcp_synack_retries减少重试次数,tcp_max_syn_backlog增大SYN连接数,tcp_abort_on_overflow处理不过来干脆就直接拒绝连接因为TCP是全双工的,因此断开连接需要4次挥手,发送方和接收方都需要发送Fin和Ack。如果两边同时断连接,那就会就进入到CLOSING状态,然后到达TIME_WAIT状态。指的是报文段的最大生存时间,如果报文段在网络中活动了MSL时间,还没有被接收,那么会被丢弃。关于MSL的大小,RFC 793协议中给出的建议是两分钟,不过实际上不同的操作系统可能有不同的设置,以Linux为例,通常是半分钟,两倍的MSL就是一分钟,也就是60秒主动关闭的一方会进入TIME_WAIT状态,并且在此状态停留两倍的MSL时长。由于TIME_WAIT的存在,大量短连接会占有大量的端口,造成无法新建连接。主动关闭的一方发出 FIN包,被动关闭的一方响应ACK包,此时,被动关闭的一方就进入了CLOSE_WAIT状态。如果一切正常,稍后被动关闭的一方也会发出FIN包,然后迁移到LAST_ACK状态。CLOSE_WAIT状态在服务器停留时间很短,如果你发现大量的 CLOSE_WAIT状态,那么就意味着被动关闭的一方没有及时发出FIN包。TCP要保证所有的数据包都可以到达,所以,必需要有重传机制。接收端给发送端的Ack确认只会确认最后一个连续的包,比如,发送端发了1,2,3,4,5一共五份数据,接收端收到了1,2,于是回ack 3,然后收到了4(注意此时3没收到),此时的TCP会怎么办?我们要知道,因为正如前面所说的,SeqNum和Ack是以字节数为单位,所以ack的时候,不能跳着确认,只能确认最大的连续收到的包,不然,发送端就以为之前的都收到了但总体来说都不好。因为都在等timeout,timeout可能会很长不以时间驱动,而以数据驱动重传如果包没有连续到达,就ack最后那个可能被丢了的包,如果发送方连续收到3次相同的ack,就重传Selective Acknowledgment, 需要在TCP头里加一个SACK的东西,ACK还是Fast Retransmit的ACK,SACK则是汇报收到的数据碎版,在发送端就可以根据回传的SACK来知道哪些数据到了,哪些没有收到重复收到数据的问题,使用了SACK来告诉发送方有哪些数据被重复接收了经典算法:Karn/Partridge算法,Jacobson/Karels算法TCP必需要知道网络实际的数据处理带宽或是数据处理速度,这样才不会引起网络拥塞,导致丢包Advertised-Window:接收端告诉发送端自己还有多少缓冲区可以接收数据。于是发送端就可以根据这个接收端的处理能力来发送数据,而不会导致接收端处理不过来接收端LastByteRead指向了TCP缓冲区中读到的位置,NextByteExpected指向的地方是收到的连续包的最后一个位置,LastByteRcved指向的是收到的包的最后一个位置,我们可以看到中间有些数据还没有到达,所以有数据空白区。发送端的LastByteAcked指向了被接收端Ack过的位置(表示成功发送确认),LastByteSent表示发出去了,但还没有收到成功确认的Ack,LastByteWritten指向的是上层应用正在写的地方。接收端在给发送端回ACK中会汇报自己的AdvertisedWindow = MaxRcvBuffer – LastByteRcvd – 1;收到36的ack,并发出了46-51的字节如果Window变成0了,发送端就不发数据了如果发送端不发数据了,接收方一会儿Window size 可用了,怎么通知发送端呢:TCP使用了Zero Window Probe技术,缩写为ZWP,也就是说,发送端在窗口变成0后,会发ZWP的包给接收方,让接收方来ack他的Window尺寸,一般这个值会设置成3次,每次大约30-60秒。如果3次过后还是0的话,有的TCP实现就会发RST把链接断了。如果你的网络包可以塞满MTU,那么你可以用满整个带宽,如果不能,那么你就会浪费带宽。避免对小的window size做出响应,直到有足够大的window size再响应。如果这个问题是由Receiver端引起的,那么就会使用David D Clark’s 方案。在receiver端,如果收到的数据导致window size小于某个值,可以直接ack(0)回sender,这样就把window给关闭了,也阻止了sender再发数据过来,等到receiver端处理了一些数据后windows size大于等于了MSS,或者receiver buffer有一半为空,就可以把window打开让send 发送数据过来。如果这个问题是由Sender端引起的,那么就会使用著名的 Nagle’s algorithm。这个算法的思路也是延时处理,他有两个主要的条件:1)要等到 Window Size >= MSS 或是 Data Size >= MSS,2)等待时间或是超时200ms,这两个条件有一个满足,他才会发数据,否则就是在攒数据。TCP_CORK是禁止小包发送,而Nagle算法没有禁止小包发送,只是禁止了大量的小包发送TCP不是一个自私的协议,当拥塞发生的时候,要做自我牺牲拥塞控制的论文请参看 《Congestion Avoidance and Control》主要算法有:慢启动,拥塞避免,拥塞发生,快速恢复,TCP New Reno,FACK算法,TCP Vegas拥塞控制算法TCP网络协议及其思想的应用TCP 的那些事儿(上)TCP 的那些事儿(下)tcp为什么是三次握手,为什么不是两次或四次?记一次TIME_WAIT网络故障再叙TIME_WAITtcp_tw_recycle和tcp_timestamps导致connect失败问题tcp短连接TIME_WAIT问题解决方法大全(1)- 高屋建瓴tcp短连接TIME_WAIT问题解决方法大全(2)- SO_LINGERtcp短连接TIME_WAIT问题解决方法大全(3)- tcp_tw_recycletcp短连接TIME_WAIT问题解决方法大全(4)- tcp_tw_reusetcp短连接TIME_WAIT问题解决方法大全(5)- tcp_max_tw_bucketsTCP的TIME_WAIT快速回收与重用浅谈CLOSE_WAIT又见CLOSE_WAITPHP升级导致系统负载过高问题分析Coping with the TCP TIME-WAIT state on busy Linux servers
      TCP协议总结

      一篇有关TCP/IP局域网的英文论文

      (第一篇)这篇简单介绍了TCP/IP协议。 可供参考。 What is TCP/IP? TCP/IP (Transmission Control Protocol/Internet Protocol) is the basic communication language or protocol of the Internet. It can also be used as a communications protocol in a private network (either an intranet or an extranet). When you are set up with direct access to the Internet, your computer is provided with a copy of the TCP/IP program just as every other computer that you may send messages to or get information from also has a copy of TCP/IP.TCP/IP is a two-layer program. The higher layer, Transmission Control Protocol, manages the assembling of a message or file into smaller packets that are transmitted over the Internet and received by a TCP layer that reassembles the packets into the original message. The lower layer, Internet Protocol, handles the address part of each packet so that it gets to the right destination. Each gateway computer on the network checks this address to see where to forward the message. Even though some packets from the same message are routed differently than others, they'll be reassembled at the destination.TCP/IP uses the client/server model of communication in which a computer user (a client) requests and is provided a service (such as sending a Web page) by another computer (a server) in the network. TCP/IP communication is primarily point-to-point, meaning each communication is from one point (or host computer) in the network to another point or host computer. TCP/IP and the higher-level applications that use it are collectively said to be "stateless" because each client request is considered a new request unrelated to any previous one (unlike ordinary phone conversations that require a dedicated connection for the call duration). Being stateless frees network paths so that everyone can use them continuously. (Note that the TCP layer itself is not stateless as far as any one message is concerned. Its connection remains in place until all packets in a message have been received.)Many Internet users are familiar with the even higher layer application protocols that use TCP/IP to get to the Internet. These include the World Wide Web's Hypertext Transfer Protocol (HTTP), the File Transfer Protocol (FTP), Telnet (Telnet) which lets you logon to remote computers, and the Simple Mail Transfer Protocol (SMTP). These and other protocols are often packaged together with TCP/IP as a "suite."Personal computer users with an analog phone modem connection to the Internet usually get to the Internet through the Serial Line Internet Protocol (SLIP) or the Point-to-Point Protocol (PPP). These protocols encapsulate the IP packets so that they can be sent over the dial-up phone connection to an access provider's modem.Protocols related to TCP/IP include the User Datagram Protocol (UDP), which is used instead of TCP for special purposes. Other protocols are used by network host computers for exchanging router information. These include the Internet Control Message Protocol (ICMP), the Interior Gateway Protocol (IGP), the Exterior Gateway Protocol (EGP), and the Border Gateway Protocol (BGP).(第二篇)这篇介绍了TCP/IP的发展。Development of TCP/IPThe original research was performed in the late 1960s and early 1970s by the Advanced Research Projects Agency (ARPA), which is the research arm of the US Department of Defense (DOD). The DOD wanted to build a network to connect a number of military sites. The key requirements for the network were as follows:* It must continue to function during nuclear war (development took place during the 'cold war'). The 7/8th rule required that the network should continue to function even when 7/8th of the network was not operational* It must be completely decentralized with no key central installation that could be destroyed and bring down the whole network* It must be fully redundant and able to continue communication between A and B even though intermediate sites and links might stop functioning during the conversation* The architecture must be flexible as the envisaged range of applications for the network was wide (anything from file transfer to time-sensitive data such as voice)ARPA hired a firm called BBN to design the network. The prototype was a research network called ARPANET (first operational in 1972). This connected four university sites using a system described as a packet switching network.Prior to this development, any two computers wanting to communicate had to open a direct channel (known as a circuit) and information was then sent. If this circuit were broken, the computers would stop communicating immediately, which the DOD specifically wanted to avoid.One computer could forward information to another by using packet-switching, so it superseded circuit-switched networks. To ensure information reached the correct destination, each packet was addressed with a source and destination and the packet was then transferred using any available pathway to the destination computer.It was divided into small chunks or packets (originally 1008 bits). Sending large chunks of information has always presented problems, often because the full message fails to reach its destination at the first attempt, and the whole message then has to be resent. The facilities within the new protocol to divide large messages into numerous small packets meant that a single packet could be resent if it was lost or damaged during transmission, rather than the whole message.The new network was decentralized with no one computer controlling its operation where the packet switching protocol controlled most of the network operations.TCP/IP is a very robust protocol and can automatically recover from any communication link failures. It re-routes data packets if transmission lines are damaged or if a computer fails to respond, utilizing any available network path. The figure below shows an example of an Internet system. A packet being sent from Network A to Network F may be sent via Network D (the quickest route). If this route becomes unavailable, the packet is routed using an alternate route (for example, A B C E F).Once ARPANET was proven, the DOD built MILNET (Military Installation in US) and MINET (Military Installation in Europe). To encourage the wide adoption of TCP/IP, BBN and the University of California at Berkeley were funded by the US Government to implement the protocol in the Berkeley version of Unix. UNIX was given freely to US universities and colleges, allowing them to network their computers. Researchers at Berkeley developed a program interface to the network protocol called sockets and wrote many applications using this interface.During the early 1980s, the National Science Foundation (NSF) used Berkeley TCP/IP to create the Computer Science Network (CSNET) to link US universities. They saw the benefit of sharing information between universities and ARPANET provided the infrastructure. Meanwhile, in 1974 a successor to ARPANET was developed named NSFNET. This was based on a backbone of six supercomputers into which many regional networks were allowed to connect.The first stage in the commercial development of the Internet occurred in 1990 when a group of telecommunications and computer companies formed a non-profit making organization called Advanced Networks and Services (ANS). This organization took over NSFNET and allowed commercial organizations to connect to the system. The commercial Internet grew from these networks.上述两篇都可供参考。一、TCP/IP协议簇简介TCP/IP(传输控制协议/网间协议)是一种网络通信协议,它规范了网络上的所有通信设备,尤其是一个主机与另一个主机之间的数据往来格式以及传送方式。TCP/IP是 INTERNET的基础协议,也是一种电脑数据打包和寻址的标准方法。在数据传送中,可以形象地理解为有两个信封,TCP和IP就像是信封,要传递的信息被划分成若干段,每一段塞入一个TCP信封,并在该信封面上记录有分段号的信息,再将TCP信封塞入IP大信封,发送上网。在接受端,一个TCP软件包收集信封,抽出数据,按发送前的顺序还原,并加以校验,若发现差错,TCP将会要求重发。因此,TCP/IP在INTERNET中几乎可以无差错地传送数据。在任何一个物理网络中,各站点都有一个机器可识别的地址,该地址叫做物理地址.物理地址有两个特点:(1)物理地址的长度,格式等是物理网络技术的一部分,物理网络不同,物理地址也不同.(2)同一类型不同网络上的站点可能拥有相同的物理地址.以上两点决定了,不能用物理网络进行网间网通讯.在网络术语中,协议中,协议是为了在两台计算机之间交换数据而预先规定的标准。TCP/IP并不是一个而是许多协议,这就是为什么你经常听到它代表一个协议集的原因,而TCP和IP只是其中两个基本协议而已。你装在计算机-的TCP/IP软件提供了一个包括TCP、IP以及TCP/IP协议集中其它协议的工具平台。特别是它包括一些高层次的应用程序和FTP(文件传输协议),它允许用户在命令行上进行网络文件传输。TCP/IP 是美国政府资助的高级研究计划署(ARPA)在二十世纪七十年代的一个研究成果,用来使全球的研究网络联在一起形成一个虚拟网络,也就是国际互联网。原始的Internet通过将已有的网络如ARPAnet转换到TCP/IP上来而形成,而这个Internet最终成为如今的国际互联网的骨干网。如今TCP/IP如此重要的原因,在于它允许独立的网格加入到Internet或组织在一起形成私有的内部网(Intranet)。构成内部网的每个网络通过一种-做路由器或IP路由器的设备在物理上联接在一起。路由器是一台用来从一个网络到另一个网络传输数据包的计算机。在一个使用TCP/IP的内部网中,信息通过使用一种独立的叫做IP包(IPpacket)或IP数据报(IP datagrams)的数据单元进--传输。TCP/IP软件使得每台联到网络上的计算机同其它计算机“看”起来一模一样,事实上它隐藏了路由器和基本的网络体系结构并使其各方面看起来都像一个大网。如同联入以太网时需要确认一个48位的以太网地址一样,联入一个内部网也需要确认一个32位的IP地址。我们将它用带点的十进制数表示,如128.10.2.3。给定一个远程计算机的IP地址,在某个内部网或Internet上的本地计算机就可以像处在同一个物理网络中的两台计算机那样向远程计算机发送数据。TCP/IP 提供了一个方案用来解决属于同一个内部网而分属不同物理网的两台计算机之间怎样交换数据的问题。这个方案包括许多部分,而TCP/IP协议集的每个成员则用来解决问题的某一部分。如TCP/IP协议集中最基本的协议-IP协议用来在内部网中交换数据并且执行一项重要的功能:路由选择--选择数据报从A主机到B主机将要经过的路径以及利用合适的路由器完成不同网络之间的跨越(hop)。TCP 是一个更高层次的它允许运行在在不同主机上的应用程序相互交换数据流。TCP将数据流分成小段叫做TCP数据段(TCP segments),并利用IP协议进行传输。在大多数情况下,每个TCP数据段装在一个IP数据报中进行发送。但如需要的话,TCP将把数据段分成多个数据报,而IP数据报则与同一网络不同主机间传输位流和字节流的物理数据帧相容。由于IP并不能保证接收的数据报的顺序相一致,TCP会在收信端装配 TCP数据段并形成一个不间断的数据流。FTP和Telnet就是两个非常流行的依靠TCP的TCP/IP应用程序。另一个重要的TCP/IP协议集的成员是用户数据报协议(UDP),它同TCP相似但比TCP原始许多。TCP是一个可靠的协议,因为它有错误检查和握手确认来保证数据完整的到达目的地。UDP是一个“不可靠”的协议,因为它不能保证数据报的接收顺序同发送顺序相同,甚至不能保证它们是否全部到达。如果有可靠性要求,则应用程序避免使用它。同许多TCP/IP工具同时提供的SNMP(简单网络管理协议)就是一个使用UDP协议的应用例子。其它TCP/IP协议在TCP/IP网络中工作在幕后,但同样也发挥着重要作用。例如地址转换协议(ARP)将IP地址转换为物理网络地址如以太网地址。而与其对应的反向地址转换协议(RARP)做相反的工作,即将物理网络地址转换为IP地址。网际控制报文协议(ICMP)则是一个支持性协议,它利用IP完成IP数据报在传输时的控制信息和错误信息的传输。例如,如果一个路由器不能向前发送一个IP数据报,它就会利用ICMP来告诉发送者这里出现了问题。这个不是原版翻译,不过相差不多。 -0-。你先要的是英文版啊~ 囧~ 要不你再发个帖,找人翻译下。
      What is TCP/IP? TCP/IP (Transmission Control Protocol/Internet Protocol) is the basic communication language or protocol of the Internet. It can also be used as a communications protocol in a private network (either an intranet or an extranet). When you are set up with direct access to the Internet, your computer is provided with a copy of the TCP/IP program just as every other computer that you may send messages to or get information from also has a copy of TCP/IP. TCP/IP is a two-layer program. The higher layer, Transmission Control Protocol, manages the assembling of a message or file into smaller packets that are transmitted over the Internet and received by a TCP layer that reassembles the packets into the original message. The lower layer, Internet Protocol, handles the address part of each packet so that it gets to the right destination. Each gateway computer on the network checks this address to see where to forward the message. Even though some packets from the same message are routed differently than others, they'll be reassembled at the destination.TCP/IP uses the client/server model of communication in which a computer user (a client) requests and is provided a service (such as sending a Web page) by another computer (a server) in the network. TCP/IP communication is primarily point-to-point, meaning each communication is from one point (or host computer) in the network to another point or host computer. TCP/IP and the higher-level applications that use it are collectively said to be "stateless" because each client request is considered a new request unrelated to any previous one (unlike ordinary phone conversations that require a dedicated connection for the call duration). Being stateless frees network paths so that everyone can use them continuously. (Note that the TCP layer itself is not stateless as far as any one message is concerned. Its connection remains in place until all packets in a message have been received.)Many Internet users are familiar with the even higher layer application protocols that use TCP/IP to get to the Internet. These include the World Wide Web's Hypertext Transfer Protocol (HTTP), the File Transfer Protocol (FTP), Telnet (Telnet) which lets you logon to remote computers, and the Simple Mail Transfer Protocol (SMTP). These and other protocols are often packaged together with TCP/IP as a "suite."Personal computer users with an analog phone modem connection to the Internet usually get to the Internet through the Serial Line Internet Protocol (SLIP) or the Point-to-Point Protocol (PPP). These protocols encapsulate the IP packets so that they can be sent over the dial-up phone connection to an access provider's modem. Protocols related to TCP/IP include the User Datagram Protocol (UDP), which is used instead of TCP for special purposes. Other protocols are used by network host computers for exchanging router information. These include the Internet Control Message Protocol (ICMP), the Interior Gateway Protocol (IGP), the Exterior Gateway Protocol (EGP), and the Border Gateway Protocol (BGP).
      一篇有关TCP/IP局域网的英文论文

      tcpip协议毕业论文

      TCP/ip 的内容很多,你不知道 要写什么内容 规律什么的,有没有格式内容分析
      tcpip协议毕业论文

      论文

      你的如此高、如此多的要求,就凭 5 个悬赏分就能够让互联网上一个不认识的人帮你撰写了?没有人满足你的要求的!论文这东西拿出去专门让别人写可就不是这个价了!天底下真正的好事情是不会免费的!
      <TCP/IP协议深度分析>论文

      谁有关于“tcp公平性”方面的论文或资料?

      一种改善TCP 公平性的算法1 章淼,吴建平,徐恪(清华大学 计算机科学与技术系,北京 100084)收稿日期:2002-11-04基金项目:国家自然科学基金资助项目(69725003, 90104002, 60203025)作者简介:章淼(1976-),男(汉),浙江,博士研究生。E-mail: zm@csnet1.cs.tsinghua.edu.cn通讯联系人:徐恪,讲师。E-mail: xuke@csnet1.cs.tsinghua.edu.cn文 摘: 传输控制协议(TCP)是目前在Internet 上使用最广泛的传输协议。理论和试验表明TCP 连接在一些情况下是不公平的,这些情况包括多拥塞网关、不同的往返延迟和不同报文大小等。该文提出一种“显式公平控制”(EFC)算法来解决这个问题,其主要思想是通过在网关和端系统都增加机制来单独进行公平控制。在TCP 的报文头中增加一个“速率标签”来携带目前的发送速率,网关可以使用报文头中的这个信息对报文区别对待。试验结果表明EFC算法可以有效的改善TCP 连接的公平性。该文还讨论了如何在Internet 中逐步使用EFC 算法。关键词:传输控制协议(TCP);公平性;拥塞控制中图分类号: TP393传输控制协议(TCP)是目前Internet 中主要使用的传输协议。TCP 的一些设计特性使得TCP 连接在一些环境中无法达到公平。TCP 中使用的AIMD算法[1]在反馈延迟不同的情况下无法达到一个公平的平衡点。TCP 使用的“二值反馈”机制在多拥塞网关的环境下也可以导致不公平的出现。研究表明,一个经过多个拥塞网关的连接只能得到非常低的吞吐量[2]。Floyd 提出“Constant-Rate”(CR)窗口增加算法[2]来改善TCP 连接在不同往返延迟(RTT)环境下的公平性。每个连接增大窗口的量为a ´RTT ,其中a 是一个常数。New-ECN[3]在改善公平性方面也使用了类似的思路。CR 和New-ECN 算法都只修改端系统,这使得它们很容易在实际网络中使用,但都无法解决多拥塞网关环境中的不公平问题。Fair queue[4]和FRED[5]通过在网关中增加机制来改善公平性。它们不需要改变端系统的算法,但在实现上需要使用“单流信息”,在算法的扩展性上存在问题。本文提出一个“显式公平控制”算法(EFC:Explicit Fairness Control)来改善TCP 的公平性。其主要思想是:通过在端系统和网关中都增加机制来单独进行公平控制。在TCP 报文头中增加一个“速率标签”(Rate-Tag)来表明TCP 连接当前的发送速率;网关根据发送速率的不同对报文进行区别对待。在算法的设计中,尽量对当前的体系结构只做简单的修改,从而使EFC 算法可以在Internet 中逐步推广使用。1 背景图1 显示了一个多拥塞网关的典型拓扑结构,其中拥塞的网关为1a, 2a, ⋯, na。假设pi 是在网关ia 处的报文丢失概率,那么连接0 的丢失概率为:Õ== - -nii P p10 1 (1 ) .如果假设p p p p n = = ...= = 1 2 ,而且p 的值很小,那么:P =1- (1- p) n » np 0 . (1)由于连接0 和其它连接相比经历更多的报文丢失,在其它条件相同的情况下它的性能要比其它连接更差。在实际网络中,一个经过多拥塞网关的连接很有可能经历更大的传播延迟(propagationdelay)和排队延迟(queuing delay),这样它的性能会进一步降低。在TCP 建模方面的研究为更加准确的评价不同往返延迟和多拥塞网关对TCP 公平性的影响提供了条件。TCP 的一个速率公式为[6]:S 1a 1b 2a 2b na nb 0S1 S2 Sn01 2 nD1 D2 DnD0图1 网络拓扑12) (1 32 )83(332 p p 2ptpRsTRTO + += , (2)其中:T 是TCP 的发送速率,s 是报文大小,R 是往返延迟,p 是稳定状态下的丢失概率,tRTO 是TCP重传时钟的值。式(2)给出了发送速率的上限。当p很小时,式(2)可以简化为:32 pRsT = . (3)如果2 个连接具有同样的报文大小和丢失概率,但有不同的往返延迟R0 和R1,它们的吞吐量关系为:0110RRTT= . (4)对于多拥塞网关,如果使用式(1),并且不考虑往返延迟的差别,图1 中连接1 和连接0 吞吐量的比值为n 。式(3)还揭示了报文大小对于TCP 公平性的影响。对于两个往返延迟和报文丢失率相同的连接,如果它们的报文大小不同,它们的吞吐量之间也是不公平的,并且有以下关系:1010ssTT= , (5)其中s0 和s1 分别是两个连接的报文大小。2 EFC 算法的设计EFC 算法有两个主要设计特点。第一,在网关中使用了单独的公平控制机制。由网关计算所有通过网关连接的“公平份额”。如果一个连接的发送速率超过“公平份额”,就使用某种拥塞控制机制(如Adaptive RED[7])对这个连接的报文进行处理;如果发送速率低于“公平份额”,这个连接的报文将不受任何影响的转发。第二,网关通过报文中携带的“速率标签”来获得每个连接的发送速率。通过在报文中携带速率信息,可以避免在网关中保存“单流信息”,从而使算法具有很好的可扩展性。2.1 端系统的机制为实现EFC 算法,只需要在TCP 的发送端进行简单的修改,在TCP 的接收端不需要任何修改。在TCP 的发送端,当发送一个报文时,在报文头中携带一个“速率标签”来表示连接当前的发送速率。在拥塞避免阶段,TCP 连接的速率由拥塞窗口的大小(Wcwnd)和往返延迟大小(R)来决定。Rate-Tag的值为:V = Wcwnd / R.在Rate-Tag 的计算中,有两点需要注意。首先,拥塞窗口大小可以报文或者以字节为单位。如果以字节为单位,报文大小不同的TCP 连接之间的公平性也可以得到改善。其次,EFC 算法的性能依赖于RTT 测量的准确性。目前TCP 的实现中,RTT 的测量精度大约为100ms,这个测量精度还比较粗糙。提高RTT 测量的精度会增加系统的处理开销,在实现中需要在处理开销和公平性的要求之间进行权衡。在使用EFC 算法时,应该使用“显式拥塞通知”(ECN)[8]作为拥塞的反馈信号。如果把报文丢失作为反馈信号,丢失报文中的速率信息将不能到达下游的网关,从而影响下游网关“公平份额”计算的准确性。2.2 网关的机制图2 显示了网关处的EFC 算法。当一个报文到达时,网关从报文头的Rate-Tag 中获得连接的发送速率,然后使用EWMA(Exponential WeightedMoving Average)方法计算得到发送速率的平均值。同时,网关使用Adaptive RED 计算得到报文的标记概率Prob。如果报文中携带的发送速率大于计算得到的平均速率,就以概率Prob 标记报文;否则,收到的报文将不受影响的转发。在我们的实现中,wr 被设定为和wq 相同的值(wq 是Adaptive RED 中计算平均队列长度使用的权重)。EFC 算法只用于改善公平性,它必须和其它以效率为目标的网关机制共同工作。目前EFC 算法已应用于一种“主动队列管理算法”(AQM:Active Queue Management)-Adaptive RED 中。EFC 算法也可以和其它AQM 算法一起工作。for each packet arrivalcalculate average rate avg_rate:avg_rate = avg_rate * (1 – wr) + rate * wrif (rate > avg_rate)with probability Prob:mark the arriving packetelse // rate £ avg_rateno actionSaved Variables:avg_rate: average sending rate of all TCP connectionsFixed Parameters:wr: weight used in calculating avg_rateOther:rate: sending rate in the Rate-TagProb: marking probability calculated by Adaptive RED图2 网关处的EFC 算法33 模拟验证使用ns-2 模拟验证EFC 算法的性能。修改了TCP Reno 的代码,使TCP 的报头中包含Rate-Tag。试验比较了使用EFC算法和不使用EFC算法的结果。使用Fairness Index [1]衡量试验达到的公平性。Fairness Index 的定义为( )( )( ) 22åå =iin xxF x .3.1 试验1使用图1 的拓扑结构验证EFC 算法在多拥塞网关环境下的性能。每个链路的带宽为16Mb/s,报文大小为1kB。在拥塞网关处使用了AdaptiveRED 算法,并按文[7]推荐的值来设定参数。使用了10 个拥塞网关。从Si到Di (i = 0, 1, …, 10)各建立20 个TCP 连接。这些连接在0s 时启动,在200s时关闭。为了减少RTT 不同对试验结果的影响,将从Si 到Di 的延迟都设为63ms。统计S0 到D0 的吞吐量(T0)和从S1 到D1 的吞吐量(T1),并计算在网关1a 的Fairness Index 值(F)。表1 总结了试验1 的结果。在不使用EFC 算法时,T0 不到T1 的1/6。从式(1)得到,对n 个拥塞网关来说吞吐量的比例大约是n 。从S0 到D0 所经历的更长的排队延迟使这个比例变的更大。在使用EFC算法后,TCP 连接的公平性得到明显改善,FairnessIndex 的值从0.648 增长到0.948。3.2 试验2试验2 用于验证EFC算法在不同RTT 情况下的性能。试验的拓扑结构如图3 所示,链路的带宽为16Mb/s。在网关R1 处使用了Adaptive RED,其参数设置和试验1 相同。从Si到Di (i = 0, 1)各建立20 个TCP 连接。从S0到D0 的延迟设定为50ms,从S1 到D1 的延迟设定为150ms。试验2 的结果总结在表2 中。在不使用EFC算法时,试验结果和式(4)的结论很一致,吞吐量和RTT 的值成反比。使用EFC 算法后,TCP 连接的公平性得到改善,Fairness Index 的值从0.825 增长到0.960。3.3 试验3试验3 用于验证EFC 算法在不同报文大小情况下的性能。使用图3 所示的拓扑,从Si 到Di 的延迟设为50ms。从Si 到Di (i = 0, 1)各建立20 个TCP 连接。从S0 到D0 的连接其报文大小设定为0.5kB,从S1 到D1 的连接其报文大小设定为1.5kB。表3 反映了试验3 的结果,其中吞吐量以字节为单位统计。在不使用EFC 算法时,吞吐量和报文的大小成正比。在使用EFC 算法后,TCP 的公平性得到改善,Fairness Index 的值从0.803 增长到0.986。4 EFC 算法的过渡机制由于EFC 算法对目前的网络体系结构没有进行重大的修改,它可以逐步在网络中推广使用。我们可以将EFC 的基本算法进行扩展,用于处理包含Rate-Tag 报文和不包含Rate-Tag 报文的混合流量。这个扩展算法如图4 所示。包含Rate-Tag 的报文使用EFC 算法处理,在计算平均速率只针对包含Rate-Tag 的报文进行。对于不包含Rate-Tag的报文按照概率Prob´ k 标记,k 的取值在0 和1之间。通过引入k 来改善包含Rate-Tag 的连接和不包含Rate-Tag 的连接之间的公平性。如果不包含Rate-Tag 的连接也按照概率Prob 标记,那么从总体上,它们的标记概率将大于包含Rate-Tag 的连接。但是,k 的取值是一个问题。图5 显示了在稳定状态下TCP 拥塞窗口的变化。TCP 的拥塞窗口R1 R2S0S1D0D1图3 网络拓扑2表1 试验1分类 T0/pkt T1/pkt F不使用EFC 51492 339217 0.648使用EFC 146854 237111 0.948表2 试验2分类 T0/pkt T1/pkt F不使用EFC 289411 107093 0.825使用EFC 237111 146854 0.960表3 试验3分类 T0/MB T1/MB F不使用EFC 100.655 298.684 0.802使用EFC 176.094 223.776 0.986for each packet arrivalif packet has Rate-Tagprocess the packet with Rate-Tag algorithmelse // no Rate-Tagwith probability Prob´ k:mark the arriving packetFixed Parameters:k: coefficient for adjusting marking probability; 0< k <1Other:Prob: marking probability calculated by Adaptive RED图4 EFC 算法的过渡机制4在W 和W/2 之间振荡,平均的窗口大小是43W。假设T 是窗口变化的周期,在一个周期内,拥塞窗口大于43W 时发送的报文个数为:W W T WTN = ´ ´ + = ´167)43(2 211在一个周期内发送的总报文个数为:W T WWN = ´T ´ + = ´43)2(21假设网关的报文标记概率为p ,那么对于使用Rate-Tag 的连接,总的报文标记概率为:p p pNNp 0.6127'= 1 = »从上面的分析可以得到,k 的取值约为0.6。然而,试验结果显示,k 的取值应该更大。下面,通过试验进一步确定k 的取值。再次使用图3 所示的拓扑结构。从S0 到D0,创建20 个包含Rate-Tag 的TCP 连接。从S1 到D1,创建20 个不包含Rate-Tag 的TCP 连接。在网关R1 处使用图4 中的算法,对k = 0.6, 0.7, …, 1.0 的情况分别进行了试验,试验结果如表4 所示。k 的取值在0.7 和0.9 之间时,公平性的指标较好。进一步考虑,包含Rate-Tag 的连接最好可以获得更多的带宽,这样将鼓励用户使用EFC 算法。目前我们选择k = 0.8。5 总结本文在拥塞控制算法的公平性方面进行了研究,提出一种算法EFC来改善TCP 连接的公平性。EFC 算法通过在端系统和网关中增加机制来单独进行公平性的控制。EFC 算法在TCP 报文头中增加“速率标签”,网关可以根据这个信息使连接速率收敛到“公平份额”。试验结果表明,EFC 算法在多拥塞网关、不同RTT 和不同报文大小的情况下都可以改善TCP 连接的公平性。本文还讨论了如何在Internet 中逐步推广使用EFC 算法,并提出一种过渡机制来处理包含Rate-Tag 和不包含Rate-Tag 报文的混合流量。参 考 文 献 (References)[1] Chiu D, Jain R. Analysis of the increase and decreasealgorithms for congestion avoidance in computernetworks[J]. Computer Networks and ISDN Systems,1989, 17(1): 1-14.[2] Floyd S. Connections with multiple congested gatewaysin packet-switched networks part 1: one-way traffic[J].Computer Communication Review, 1991, 21(5): 30-47.[3] Hamann T, Walrand J. A new fair window algorithm forECN capable TCP (new-ECN)[A]. Sidi M. Proceedingsof INFOCOM'2000[C]. Tel Avlv, Israel: IEEECommunications Society, 2000. 1528-1536.[4] Demers A, Keshav S, Shenker S. Analysis andsimulation of a fair queueing algorithm[J].Internetworking: Research and Experience, 1990, 1(1):3-26.[5] Lin D, Morris R. Dynamics of random early detection[J].ACM Computer Communication Review, 1997, 27(4):127-137.[6] Padhye J, Firoiu V, Towsley D, et al. Modeling TCPthroughput: a simple model and its empiricalvalidation[J]. ACM Computer Communication Review,1998, 28(4): 303-314.[7] Floyd S, Gummadi R, Shenker S. Adaptive RED: AnAlgorithm for Increasing the Robustness of RED’sActive Queue Management[EB/OL].http://www.icir.org/floyd/papers/adaptiveRed.pdf,August 2001.[8] Floyd S. TCP and explicit congestion notification[J].ACM Computer Communication Review, 1994, 24(5):10-23.表4k T0/pkt T1/pkt F0.6 143979 256233 0.9270650.7 169983 230260 0.9778220.8 202740 197397 0.9998220.9 225859 174225 0.9836171.0 256529 143477 0.926031拥塞窗口大小WW/2时间 图5 稳定状态下TCP 拥塞窗口的变化
      谁有关于“tcp公平性”方面的论文或资料?

      本文由 在线网速测试 整理编辑,转载请注明出处。

          热门文章

          文章分类