CN116566914A - Bypass TCP acceleration method, device, equipment and medium - Google Patents
Bypass TCP acceleration method, device, equipment and medium Download PDFInfo
- Publication number
- CN116566914A CN116566914A CN202310831319.8A CN202310831319A CN116566914A CN 116566914 A CN116566914 A CN 116566914A CN 202310831319 A CN202310831319 A CN 202310831319A CN 116566914 A CN116566914 A CN 116566914A
- Authority
- CN
- China
- Prior art keywords
- data packet
- packet
- tcp
- data
- acceleration
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L47/00—Traffic control in data switching networks
- H04L47/10—Flow control; Congestion control
- H04L47/19—Flow control; Congestion control at layers above the network layer
- H04L47/193—Flow control; Congestion control at layers above the network layer at the transport layer, e.g. TCP related
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L1/00—Arrangements for detecting or preventing errors in the information received
- H04L1/12—Arrangements for detecting or preventing errors in the information received by using return channel
- H04L1/16—Arrangements for detecting or preventing errors in the information received by using return channel in which the return channel carries supervisory signals, e.g. repetition request signals
- H04L1/18—Automatic repetition systems, e.g. Van Duuren systems
- H04L1/1867—Arrangements specially adapted for the transmitter end
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/50—Network services
- H04L67/56—Provisioning of proxy services
- H04L67/568—Storing data temporarily at an intermediate stage, e.g. caching
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/16—Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]
- H04L69/163—In-band adaptation of TCP data exchange; In-band control procedures
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/22—Parsing or analysis of headers
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D30/00—Reducing energy consumption in communication networks
- Y02D30/50—Reducing energy consumption in communication networks in wire-line communication networks, e.g. low power modes or reduced link rate
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer Security & Cryptography (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
本发明涉及互联网技术领域,提供一种旁路TCP加速方法、装置、设备及介质,应用于旁路部署的加速设备或者加速服务,在不影响原有TCP链路的情况下改善链路状态,且部署灵活;实时捕获数据包,并将捕获的数据包分流至不同线程,以提升并发处理效率;在检测到数据包丢包时结合缓存执行对数据包的重传,无需从发送方重新发包,降低了重发包所需时间,且在丢包影响链路之前提前补包,以保证链路通畅;在检测到数据包对应的数据流发生拥塞时执行拥塞控制,降低了链路拥塞发生的可能性,提高了链路的带宽利用率;检测数据包是否需要提前确认,通过提前回复ACK和补发数据包的形式,降低了链路的总体延迟和丢包率。
The present invention relates to the field of Internet technology, and provides a bypass TCP acceleration method, device, equipment and medium, which are applied to acceleration equipment or acceleration services deployed by bypass, and improve the link state without affecting the original TCP link. And the deployment is flexible; capture data packets in real time, and distribute the captured data packets to different threads to improve concurrent processing efficiency; when packet loss is detected, the data packet is retransmitted in combination with the cache, without the need to resend the packet from the sender , reducing the time required for resending packets, and replenishing packets in advance before packet loss affects the link to ensure smooth links; when congestion is detected in the data stream corresponding to the data packet, congestion control is performed to reduce the occurrence of link congestion Possibility, improve the bandwidth utilization of the link; detect whether the data packet needs to be confirmed in advance, and reduce the overall delay and packet loss rate of the link by replying ACK in advance and resending the data packet.
Description
技术领域technical field
本发明涉及互联网技术领域,尤其涉及一种旁路TCP加速方法、装置、设备及介质。The invention relates to the technical field of the Internet, in particular to a bypass TCP acceleration method, device, equipment and medium.
背景技术Background technique
TCP(Transmission Control Protocol,传输控制协议)是一种面向连接的、可靠的、基于字节流的传输层通信协议,依赖于对数据包按序进行编号以及确认机制,在不可靠的网络环境下为上层协议提供可靠的传输保障。TCP (Transmission Control Protocol, Transmission Control Protocol) is a connection-oriented, reliable, byte-stream-based transport layer communication protocol, which relies on sequential numbering of data packets and confirmation mechanism, in an unreliable network environment Provide reliable transmission guarantee for the upper layer protocol.
TCP虽然是可靠的协议,但在一些特殊的网络条件下会出现不稳定、波动大等问题,如长距离的网络链路或无线网络等情形。以无线网络为例,无线网络是通过无线电波作为传输媒介,将数据传输和通信功能扩展到没有物理连接的设备之间,允许设备通过无线方式进行互联和通信,而不需要使用传统的有线连接,如电缆或光纤。但是无线网络也带来了误码率高,网络状况不稳定的问题,当用户网络环境较差时,会产生大量的丢包,这些丢包需要从发送方进行重传,这极大的影响了全链路性能。Although TCP is a reliable protocol, problems such as instability and large fluctuations may occur under some special network conditions, such as long-distance network links or wireless networks. Taking wireless networks as an example, wireless networks use radio waves as a transmission medium to extend data transmission and communication functions between devices without physical connections, allowing devices to interconnect and communicate wirelessly without using traditional wired connections , such as cables or optical fibers. However, the wireless network also brings problems of high bit error rate and unstable network conditions. When the user’s network environment is poor, a large number of lost packets will be generated. These lost packets need to be retransmitted from the sender, which has a great impact full link performance.
针对TCP在特殊网络条件下存在的不稳定、波动大等问题,现有技术中通常采用以下解决方案:In view of the instability and large fluctuations of TCP under special network conditions, the following solutions are usually adopted in the prior art:
1、增加中间路由、交换机数量,以提高信号覆盖范围。1. Increase the number of intermediate routes and switches to improve signal coverage.
但是,这种方式费用昂贵、消耗大。However, this method is expensive and consumes a lot.
2、在中间路由、交换机上部署代理服务,进行TCP连接分割。2. Deploy proxy services on intermediate routers and switches to split TCP connections.
但是,这种方式一般只能加速TCP的慢启动环节,且会占用大量的设备资源,消耗大。并且,需要对中间路由进行修改,会影响现有业务,风险大。同时,该方案将原本一条TCP连接分割成了两条,破坏了原有的TCP链路,一旦代理服务出现问题,则会导致整个TCP链路瘫痪,且配置繁琐。However, this method generally can only accelerate the slow start of TCP, and will occupy a large amount of device resources and consume a lot of resources. In addition, intermediate routes need to be modified, which will affect existing services and pose a high risk. At the same time, this solution splits the original TCP connection into two, destroying the original TCP link. Once there is a problem with the proxy service, the entire TCP link will be paralyzed, and the configuration is cumbersome.
发明内容Contents of the invention
鉴于以上内容,有必要提供一种旁路TCP加速方法、装置、设备及介质,旨在解决不稳定、波动大的网络环境下的丢包重传慢、延时高的问题,以及传统代理对原始TCP链路影响大的问题,且解决了传统代理配置繁琐、占用资源大,部署或者修改会影响原本业务的问题。In view of the above, it is necessary to provide a bypass TCP acceleration method, device, equipment and medium, aiming to solve the problem of slow packet loss and retransmission and high delay in an unstable and fluctuating network environment, as well as the traditional proxy pair The problem that the original TCP link has a large impact, and solves the problem that the traditional proxy configuration is cumbersome, occupies a large amount of resources, and deployment or modification will affect the original business.
一种旁路TCP加速方法,应用于旁路部署的加速设备或者加速服务,所述旁路TCP加速方法包括:A bypass TCP acceleration method, applied to bypass deployed acceleration equipment or acceleration services, the bypass TCP acceleration method includes:
实时捕获数据包,并在捕获到数据包时,将捕获的数据包分流至对应的线程;Capture data packets in real time, and divert the captured data packets to corresponding threads when capturing data packets;
检测是否有数据包存在丢失风险,并在检测到有数据包存在丢失风险时,结合缓存执行对所述数据包的重传,并将所述数据包重传至所述数据包的接收方;Detecting whether there is a risk of data packet loss, and when detecting that there is a risk of data packet loss, retransmitting the data packet in combination with the buffer, and retransmitting the data packet to the receiver of the data packet;
在重传过程中,检测所述数据包对应的数据流是否发生拥塞,并在检测到所述数据包对应的数据流发生拥塞时执行拥塞控制;During the retransmission process, detect whether the data flow corresponding to the data packet is congested, and perform congestion control when it is detected that the data flow corresponding to the data packet is congested;
在执行拥塞控制后,检测所述数据包是否需要提前确认;After performing congestion control, detecting whether the data packet needs to be confirmed in advance;
当检测到所述数据包需要提前确认时,生成所述数据包的模拟ACK包,并将所述模拟ACK包传输至所述数据包的发送方。When it is detected that the data packet needs to be acknowledged in advance, generate a simulated ACK packet of the data packet, and transmit the simulated ACK packet to the sender of the data packet.
根据本发明优选实施例,所述方法还包括:According to a preferred embodiment of the present invention, the method further includes:
获取所述发送方与所述接收方的中间设备,及获取所述中间设备的空闲端口,为所述空闲端口配置镜像,并通过所述空闲端口建立与镜像服务器的连接,在所述镜像服务器上部署所述加速设备;或者Obtain the intermediate device of the sender and the receiver, and obtain the free port of the intermediate device, configure mirroring for the free port, and establish a connection with the mirror server through the free port, and in the mirror server Deploy the acceleration device on; or
获取所述发送方与所述接收方的中间设备,在所述中间设备上部署所述加速服务。The intermediate devices of the sender and the receiver are obtained, and the acceleration service is deployed on the intermediate devices.
根据本发明优选实施例,所述将捕获的数据包分流至对应的线程包括:According to a preferred embodiment of the present invention, said shunting captured data packets to corresponding threads includes:
获取每个数据包的包头格式;Get the header format of each data packet;
根据每个数据包的包头格式确定每个数据包的协议类型;Determine the protocol type of each data packet according to the header format of each data packet;
基于每个数据包的协议类型分析每个数据包的TCP/IP的四元组,得到分析结果;Analyze the TCP/IP quadruple of each data packet based on the protocol type of each data packet, and obtain the analysis result;
根据所述分析结果将每个数据包划分至对应的TCP流;Divide each data packet into a corresponding TCP flow according to the analysis result;
根据每个数据包所属的TCP流为每个数据包配置对应的线程。Configure a corresponding thread for each data packet according to the TCP flow to which each data packet belongs.
根据本发明优选实施例,所述结合缓存执行对所述数据包的重传前,所述方法还包括:According to a preferred embodiment of the present invention, before performing the retransmission of the data packet in combination with the cache, the method further includes:
获取所述发送方与所述接收方进行TCP握手时确定的MTU;Obtain the MTU determined when the sender and the receiver perform a TCP handshake;
将未被确认的数据包以所述MTU为长度进行分割,并将分割后的数据包以有序二维链表的形式存储至所述缓存;Segmenting unacknowledged data packets with the length of the MTU, and storing the segmented data packets in the cache in the form of an ordered two-dimensional linked list;
其中,当接收到所述缓存中任意数据包的ACK包时,从所述缓存中删除所述任意数据包所属的区间的字段;Wherein, when receiving the ACK packet of any data packet in the cache, deleting the field of the interval to which the arbitrary data packet belongs from the cache;
其中,当在所述缓存中查询丢失数据包时,在所述有序二维链表末尾的预设长度范围内进行二分查找。Wherein, when querying the lost data packet in the cache, a binary search is performed within a preset length range at the end of the ordered two-dimensional linked list.
根据本发明优选实施例,所述检测是否有数据包存在丢失风险,并在检测到有数据包存在丢失风险时,结合缓存执行对所述数据包的重传包括:According to a preferred embodiment of the present invention, the detecting whether there is a risk of data packet loss, and when it is detected that there is a risk of data packet loss, performing retransmission of the data packet in conjunction with caching includes:
获取每个数据包所属的TCP流的带宽、历史丢包率,以及在所述缓存中的存储时长;Obtain the bandwidth of the TCP stream to which each data packet belongs, the historical packet loss rate, and the storage duration in the cache;
获取与所述带宽对应的第一权重、与所述历史丢包率对应的第二权重,以及与所述存储时长对应的第三权重;Acquiring a first weight corresponding to the bandwidth, a second weight corresponding to the historical packet loss rate, and a third weight corresponding to the storage duration;
计算所述带宽与所述第一权重的乘积得到第一数值,计算所述历史丢包率与所述第二权重的乘积得到第二数值,及计算所述存储时长与所述第三权重的乘积得到第三数值;Calculate the product of the bandwidth and the first weight to obtain a first value, calculate the product of the historical packet loss rate and the second weight to obtain a second value, and calculate the storage duration and the third weight The product gets the third value;
计算所述第一数值、所述第二数值与所述第三数值的和,得到每个数据包当前的动态丢包率;calculating the sum of the first value, the second value and the third value to obtain the current dynamic packet loss rate of each data packet;
获取预先配置的丢包率阈值;Obtain the pre-configured packet loss rate threshold;
当有数据包对应的所述动态丢包率大于所述丢包率阈值时,确定所述数据包存在丢失风险;When the dynamic packet loss rate corresponding to a data packet is greater than the packet loss rate threshold, it is determined that the data packet has a loss risk;
从所述数据包对应的TCP头中获取SACK字段;Obtain the SACK field from the TCP header corresponding to the data packet;
根据所述SACK字段获取丢失的数据包序号;Obtain the sequence number of the lost data packet according to the SACK field;
根据所述数据包序号从所述缓存中查询并获取丢失的字段;Querying and obtaining the missing fields from the cache according to the sequence number of the data packet;
根据所述数据包序号对所述丢失的字段进行重传。Retransmit the lost field according to the data packet sequence number.
根据本发明优选实施例,所述方法还包括:According to a preferred embodiment of the present invention, the method further includes:
在根据所述数据包序号对所述丢失的字段进行重传的过程中,为每个重传的所述丢失的字段配置定时器;In the process of retransmitting the lost field according to the sequence number of the data packet, configuring a timer for each retransmitted lost field;
基于所述定时器对每个重传的所述丢失的字段进行超时重传。Retransmitting the lost fields for each retransmission based on the timer with a timeout.
根据本发明优选实施例,所述检测所述数据包对应的数据流是否发生拥塞,并在检测到所述数据包对应的数据流发生拥塞时执行拥塞控制包括:According to a preferred embodiment of the present invention, the detecting whether the data flow corresponding to the data packet is congested, and performing congestion control when detecting that the data flow corresponding to the data packet is congested includes:
采用下述公式计算拥塞指数:The congestion index is calculated using the following formula:
; ;
其中,R表示预先配置的理论带宽,S表示所述数据包的大小,tRTT 表示所述数据包的往返时延,tRTO表示预先配置的传输超时时限,p表示所述历史丢包率,b表示一次ACK的确认包数;Y表示所述拥塞指数,bw表示所述数据包所属的TCP流的带宽;cwnd表示拥塞窗口的大小;Wherein, R represents the pre-configured theoretical bandwidth, S represents the size of the data packet, t RTT represents the round-trip delay of the data packet, t RTO represents the pre-configured transmission overtime limit, and p represents the historical packet loss rate, b represents the number of confirmation packets of an ACK; Y represents the congestion index, bw represents the bandwidth of the TCP flow to which the data packet belongs; cwnd represents the size of the congestion window;
获取预先配置的拥塞指数阈值;Get the pre-configured congestion index threshold;
当所述拥塞指数Y小于所述拥塞指数阈值时,确定所述数据包对应的TCP流发生拥塞;When the congestion index Y is less than the congestion index threshold, it is determined that the TCP flow corresponding to the data packet is congested;
降低所述TCP流中用于提前确认的模拟ACK包的发送频率,并提升所述缓存中所述TCP流对应的数据包的重传频率;reducing the sending frequency of the analog ACK packet used for early confirmation in the TCP flow, and increasing the retransmission frequency of the data packet corresponding to the TCP flow in the cache;
其中,对于具有相同IP的其他TCP流,降低所述其他TCP流中用于提前确认的模拟ACK包的发送频率,并提升所述缓存中所述其他TCP流对应的数据包的重传频率。Wherein, for other TCP flows with the same IP, reduce the sending frequency of the simulated ACK packets used for early confirmation in the other TCP flows, and increase the retransmission frequency of the data packets corresponding to the other TCP flows in the cache.
根据本发明优选实施例,所述检测所述数据包是否需要提前确认包括:According to a preferred embodiment of the present invention, the detecting whether the data packet needs to be confirmed in advance includes:
获取预先配置的第四权重、第五权重及第六权重;Obtain the pre-configured fourth weight, fifth weight and sixth weight;
计算所述数据包所属的TCP流的带宽与所述第四权重的乘积得到第四数值,计算所述历史丢包率与所述第五权重的乘积得到第五数值,及计算所述拥塞指数与所述第六权重的乘积得到第六数值;Calculate the product of the bandwidth of the TCP stream to which the data packet belongs and the fourth weight to obtain a fourth value, calculate the product of the historical packet loss rate and the fifth weight to obtain a fifth value, and calculate the congestion index multiplied by said sixth weight to obtain a sixth value;
计算所述第四数值、所述第五数值与所述第六数值的和,得到目标值;calculating the sum of the fourth value, the fifth value and the sixth value to obtain a target value;
获取预先配置的预设阈值;Get pre-configured preset thresholds;
当所述目标值大于所述预设阈值时,确定所述数据包需要提前确认。When the target value is greater than the preset threshold, it is determined that the data packet needs to be acknowledged in advance.
一种旁路TCP加速装置,运行于旁路部署的加速设备或者加速服务,所述旁路TCP加速装置包括:A bypass TCP acceleration device, running on the acceleration device or acceleration service deployed by the bypass, the bypass TCP acceleration device includes:
分流单元,用于实时捕获数据包,并在捕获到数据包时,将捕获的数据包分流至对应的线程;The distribution unit is used to capture the data packets in real time, and when the data packets are captured, the captured data packets are distributed to the corresponding threads;
检测单元,用于检测是否有数据包存在丢失风险,并在检测到有数据包存在丢失风险时,结合缓存执行对所述数据包的重传,并将所述数据包重传至所述数据包的接收方;A detection unit, configured to detect whether there is a risk of data packet loss, and when it is detected that there is a risk of data packet loss, retransmit the data packet in combination with the cache, and retransmit the data packet to the data the recipient of the packet;
拥塞控制单元,用于在重传过程中,检测所述数据包对应的数据流是否发生拥塞,并在检测到所述数据包对应的数据流发生拥塞时执行拥塞控制;A congestion control unit, configured to detect whether the data flow corresponding to the data packet is congested during the retransmission process, and perform congestion control when it is detected that the data flow corresponding to the data packet is congested;
所述检测单元,还用于在执行拥塞控制后,检测所述数据包是否需要提前确认;The detection unit is further configured to detect whether the data packet needs to be confirmed in advance after performing congestion control;
重传单元,用于当检测到所述数据包需要提前确认时,生成所述数据包的模拟ACK包,并将所述模拟ACK包传输至所述数据包的发送方。The retransmission unit is configured to generate a simulated ACK packet of the data packet when it is detected that the data packet needs to be acknowledged in advance, and transmit the simulated ACK packet to the sender of the data packet.
一种计算机设备,所述计算机设备包括:A computer device comprising:
存储器,存储至少一个指令;及a memory storing at least one instruction; and
处理器,执行所述存储器中存储的指令以实现所述旁路TCP加速方法。A processor, executing instructions stored in the memory to implement the bypass TCP acceleration method.
一种计算机可读存储介质,所述计算机可读存储介质中存储有至少一个指令,所述至少一个指令被计算机设备中的处理器执行以实现所述旁路TCP加速方法。A computer-readable storage medium, at least one instruction is stored in the computer-readable storage medium, and the at least one instruction is executed by a processor in a computer device to implement the bypass TCP acceleration method.
由以上技术方案可以看出,本发明应用于旁路部署的加速设备或者加速服务,在不影响原有TCP链路的情况下改善链路状态,在一段TCP链路中实现类似于传统代理将TCP链路分割成两段的效果(即发送方到加速设备或加速服务的部署节点、加速设备或加速服务的部署节点到接收方两段),将丢包的影响限制在其中任意一段链路中,继而使得丢失的数据包可以更快的重传,且部署灵活;实时捕获数据包,并将捕获的数据包分流至不同线程,以提升并发处理效率;在检测到数据包丢包时,结合缓存执行对数据包的重传,无需从发送方重新发包,从中间加速缓存中获取丢包重传至接收方即可,降低了重发包所需时间,且在丢包影响链路之前提前补包,以保证链路通畅;在检测到数据包对应的数据流发生拥塞时执行拥塞控制,降低了链路拥塞发生的可能性,提高了链路的带宽利用率;检测数据包是否需要提前确认,通过提前回复ACK和补发数据包的形式,均衡发送方到加速设备或加速服务的部署节点、加速设备或加速服务的部署节点到接收方的等效两段速率,降低了链路的总体延迟和丢包率。It can be seen from the above technical solutions that the present invention is applied to the acceleration device or acceleration service deployed by the bypass, and improves the link status without affecting the original TCP link. The effect of splitting the TCP link into two segments (that is, from the sender to the deployment node of the acceleration device or acceleration service, and from the deployment node of the acceleration device or acceleration service to the receiver), limits the impact of packet loss to any one of the links In this way, the lost data packets can be retransmitted faster, and the deployment is flexible; the data packets are captured in real time, and the captured data packets are distributed to different threads to improve the concurrent processing efficiency; when the data packet loss is detected, Combined with the cache to retransmit the data packet, there is no need to resend the packet from the sender, just get the lost packet from the intermediate acceleration cache and retransmit it to the receiver, which reduces the time required for resending the packet, and advances before the packet loss affects the link Supplement the packet to ensure the smooth link; perform congestion control when the data stream corresponding to the data packet is detected to be congested, which reduces the possibility of link congestion and improves the bandwidth utilization of the link; detects whether the data packet needs to be forwarded Confirm that by replying ACK in advance and resending data packets, the equivalent two-stage rate from the sender to the deployment node of the acceleration device or acceleration service, and from the deployment node of the acceleration device or acceleration service to the receiver is balanced, reducing the link speed. Overall latency and packet loss.
附图说明Description of drawings
图1是本发明旁路TCP加速方法的较佳实施例的流程图。Fig. 1 is a flowchart of a preferred embodiment of the bypass TCP acceleration method of the present invention.
图2是本发明加速设备的硬件部署示意图。FIG. 2 is a schematic diagram of hardware deployment of the acceleration device of the present invention.
图3是本发明加速服务的软件部署示意图。Fig. 3 is a schematic diagram of software deployment of the acceleration service of the present invention.
图4是本发明旁路TCP加速装置的较佳实施例的功能模块图。Fig. 4 is a functional block diagram of a preferred embodiment of the bypass TCP acceleration device of the present invention.
图5是本发明实现旁路TCP加速方法的较佳实施例的计算机设备的结构示意图。Fig. 5 is a schematic structural diagram of a computer device in a preferred embodiment of the bypass TCP acceleration method of the present invention.
具体实施方式Detailed ways
为了使本发明的目的、技术方案和优点更加清楚,下面结合附图和具体实施例对本发明进行详细描述。In order to make the object, technical solution and advantages of the present invention clearer, the present invention will be described in detail below in conjunction with the accompanying drawings and specific embodiments.
如图1所示,是本发明旁路TCP加速方法的较佳实施例的流程图。根据不同的需求,该流程图中步骤的顺序可以改变,某些步骤可以省略。As shown in FIG. 1 , it is a flow chart of a preferred embodiment of the bypass TCP acceleration method of the present invention. According to different requirements, the order of the steps in the flowchart can be changed, and some steps can be omitted.
所述旁路TCP加速方法应用于一个或者多个计算机设备中,所述计算机设备是一种能够按照事先设定或存储的指令,自动进行数值计算和/或信息处理的设备,其硬件包括但不限于微处理器、专用集成电路(Application Specific Integrated Circuit,ASIC)、可编程门阵列(Field-Programmable Gate Array,FPGA)、数字处理器(Digital SignalProcessor,DSP)、嵌入式设备等。The bypass TCP acceleration method is applied to one or more computer devices, and the computer device is a device that can automatically perform numerical calculation and/or information processing according to preset or stored instructions, and its hardware includes but It is not limited to microprocessors, application specific integrated circuits (Application Specific Integrated Circuit, ASIC), programmable gate arrays (Field-Programmable Gate Array, FPGA), digital processors (Digital Signal Processor, DSP), embedded devices, etc.
所述计算机设备可以是任何一种可与用户进行人机交互的电子产品,例如,个人计算机、平板电脑、智能手机、个人数字助理(Personal Digital Assistant,PDA)、游戏机、交互式网络电视(Internet Protocol Television,IPTV)、智能式穿戴式设备等。The computer device may be any electronic product capable of man-machine interaction with the user, for example, a personal computer, a tablet computer, a smart phone, a personal digital assistant (Personal Digital Assistant, PDA), a game console, an interactive Internet TV ( Internet Protocol Television, IPTV), smart wearable devices, etc.
所述计算机设备还可以包括网络设备和/或用户设备。其中,所述网络设备包括,但不限于单个网络服务器、多个网络服务器组成的服务器组或基于云计算(CloudComputing)的由大量主机或网络服务器构成的云。The computer equipment may also include network equipment and/or user equipment. Wherein, the network device includes, but is not limited to, a single network server, a server group composed of multiple network servers, or a cloud composed of a large number of hosts or network servers based on cloud computing (Cloud Computing).
所述服务器可以是独立的服务器,也可以是提供云服务、云数据库、云计算、云函数、云存储、网络服务、云通信、中间件服务、域名服务、安全服务、内容分发网络(ContentDelivery Network,CDN)、以及大数据和人工智能平台等基础云计算服务的云服务器。The server can be an independent server, or it can provide cloud service, cloud database, cloud computing, cloud function, cloud storage, network service, cloud communication, middleware service, domain name service, security service, content distribution network (ContentDelivery Network) , CDN), and cloud servers for basic cloud computing services such as big data and artificial intelligence platforms.
其中,人工智能(Artificial Intelligence,AI)是利用数字计算机或者数字计算机控制的机器模拟、延伸和扩展人的智能,感知环境、获取知识并使用知识获得最佳结果的理论、方法、技术及应用系统。Among them, artificial intelligence (AI) is a theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. .
人工智能基础技术一般包括如传感器、专用人工智能芯片、云计算、分布式存储、大数据处理技术、操作/交互系统、机电一体化等技术。人工智能软件技术主要包括计算机视觉技术、机器人技术、生物识别技术、语音处理技术、自然语言处理技术以及机器学习/深度学习等几大方向。Artificial intelligence basic technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation/interaction systems, and mechatronics. Artificial intelligence software technology mainly includes computer vision technology, robotics technology, biometrics technology, speech processing technology, natural language processing technology, and machine learning/deep learning.
所述计算机设备所处的网络包括但不限于互联网、广域网、城域网、局域网、虚拟专用网络(Virtual Private Network,VPN)等。The network where the computer device is located includes, but is not limited to, the Internet, a wide area network, a metropolitan area network, a local area network, a virtual private network (Virtual Private Network, VPN) and the like.
本实施例应用于旁路部署的加速设备或者加速服务,包括:This embodiment is applied to acceleration devices or acceleration services deployed in bypass, including:
S10,实时捕获数据包,并在捕获到数据包时,将捕获的数据包分流至对应的线程。S10, capture data packets in real time, and when the data packets are captured, distribute the captured data packets to corresponding threads.
在本实施例中,所述方法还包括:In this embodiment, the method also includes:
(1)获取所述发送方与所述接收方的中间设备,及获取所述中间设备的空闲端口,为所述空闲端口配置镜像,并通过所述空闲端口建立与镜像服务器的连接,在所述镜像服务器上部署所述加速设备;(1) Obtain the intermediate device of the sender and the receiver, and obtain the free port of the intermediate device, configure mirroring for the free port, and establish a connection with the mirror server through the free port, and Deploying the acceleration device on the mirror server;
其中,所述中间设备可以包括,但不限于:中间路由、交换机、网关、基站等。Wherein, the intermediate device may include, but is not limited to: an intermediate router, switch, gateway, base station, and the like.
请参见图2,是本发明加速设备的硬件部署示意图。其中,对于发送方与接收方之间的中间设备,建立该中间设备与镜像服务器的连接,并在镜像服务器上部署加速设备。正常情况下,发送方通过中间设备向接收方下发数据包,接收方在接收到数据包后,通过中间设备向发送方反馈真实ACK包。加速设备作为旁路部署的代理设备,用于向发送方发送模拟ACK包,以及向接收方发送重传的数据包。Please refer to FIG. 2 , which is a schematic diagram of hardware deployment of the acceleration device of the present invention. Wherein, for the intermediate device between the sender and the receiver, the connection between the intermediate device and the mirror server is established, and the acceleration device is deployed on the mirror server. Under normal circumstances, the sender sends a data packet to the receiver through the intermediate device, and the receiver feeds back the real ACK packet to the sender through the intermediate device after receiving the data packet. The acceleration device acts as a proxy device deployed in the bypass to send simulated ACK packets to the sender and retransmitted data packets to the receiver.
在上述实施例中,实现了对所述加速设备的硬件部署。In the foregoing embodiments, hardware deployment of the acceleration device is implemented.
(2)获取所述发送方与所述接收方的中间设备,在所述中间设备上部署所述加速服务。(2) Obtain the intermediate devices of the sender and the receiver, and deploy the acceleration service on the intermediate devices.
请参见图3,是本发明加速服务的软件部署示意图。其中,在中间设备上部署加速服务。正常情况下,发送方通过中间设备向接收方下发数据包,接收方在接收到数据包后,通过中间设备向发送方反馈真实ACK包。加速服务作为旁路部署的代理服务,用于向发送方发送模拟ACK包,以及向接收方发送重传的数据包。Please refer to FIG. 3 , which is a schematic diagram of software deployment of the acceleration service of the present invention. Wherein, the acceleration service is deployed on the intermediate device. Under normal circumstances, the sender sends a data packet to the receiver through the intermediate device, and the receiver feeds back the real ACK packet to the sender through the intermediate device after receiving the data packet. The acceleration service is deployed as a proxy service in the bypass, and is used to send simulated ACK packets to the sender and retransmitted data packets to the receiver.
在上述实施例中,实现了对所述加速服务的软件部署。In the above embodiments, the software deployment of the acceleration service is realized.
具体地,可以根据实际需求任意选择进行硬件部署还是软件部署,部署时无需修改原本网络的架构体系,不会增大维护成本。Specifically, hardware deployment or software deployment can be arbitrarily selected according to actual needs, and the original network architecture system does not need to be modified during deployment, and maintenance costs will not be increased.
通过上述实施例,能够实现对加速设备或者加速服务的旁路部署,解决了传统代理配置繁琐、占用资源大,部署或者修改会影响原本业务,以及对原始TCP(TransmissionControl Protocol,传输控制协议)链路影响大的问题。Through the above embodiments, the bypass deployment of acceleration devices or acceleration services can be realized, which solves the problem of cumbersome configuration of traditional agents, large resource occupation, deployment or modification that will affect the original business, and the impact on the original TCP (Transmission Control Protocol, transmission control protocol) chain. The road has a big impact on the problem.
在本实施例中,所述将捕获的数据包分流至对应的线程包括:In this embodiment, the splitting the captured data packets to corresponding threads includes:
获取每个数据包的包头格式;Get the header format of each data packet;
根据每个数据包的包头格式确定每个数据包的协议类型;Determine the protocol type of each data packet according to the header format of each data packet;
基于每个数据包的协议类型分析每个数据包的TCP/IP(Transmission ControlProtocol/Internet Protocol,传输控制协议/网际协议)的四元组,得到分析结果;Analyze the TCP/IP (Transmission Control Protocol/Internet Protocol, Transmission Control Protocol/Internet Protocol) quadruple of each data packet based on the protocol type of each data packet, and obtain the analysis result;
根据所述分析结果将每个数据包划分至对应的TCP流;Divide each data packet into a corresponding TCP flow according to the analysis result;
根据每个数据包所属的TCP流为每个数据包配置对应的线程。Configure a corresponding thread for each data packet according to the TCP flow to which each data packet belongs.
其中,每个数据包的协议类型可以包括网际协议版本4(Internet Protocolversion 4,IPv4)、网际协议版本6(Internet Protocol Version 6,IPv6)等。Wherein, the protocol type of each data packet may include Internet Protocol Version 4 (Internet Protocol Version 4, IPv4), Internet Protocol Version 6 (Internet Protocol Version 6, IPv6) and the like.
通过上述实施例,将不同的数据包划分至不同的线程进行处理,能够有效提升数据处理效率。Through the foregoing embodiments, different data packets are divided into different threads for processing, which can effectively improve data processing efficiency.
进一步地,还可以根据各线程的负载压力变化进行动态负载均衡,以充分利用多核性能。Furthermore, dynamic load balancing can also be performed according to the load pressure change of each thread, so as to make full use of multi-core performance.
S11,检测是否有数据包存在丢失风险,并在检测到有数据包存在丢失风险时,结合缓存执行对所述数据包的重传,并将所述数据包重传至所述数据包的接收方。S11. Detect whether there is a risk of data packet loss, and when it is detected that there is a risk of data packet loss, retransmit the data packet in combination with buffering, and retransmit the data packet to the receiver of the data packet square.
在本实施例中,所述结合缓存执行对所述数据包的重传前,所述方法还包括:In this embodiment, before performing the retransmission of the data packet in combination with the cache, the method further includes:
获取所述发送方与所述接收方进行TCP握手时确定的MTU(Maximum TransmissionUnit,最大传输单元);Obtain the MTU (Maximum Transmission Unit, maximum transmission unit) determined when the sender and the receiver perform a TCP handshake;
将未被确认的数据包以所述MTU为长度进行分割,并将分割后的数据包以有序二维链表的形式存储至所述缓存。The unacknowledged data packets are divided according to the length of the MTU, and the divided data packets are stored in the cache in the form of an ordered two-dimensional linked list.
在上述实施例中,由于网卡存在TSO(TCP Segmentation Offload,TCP分段卸载)、GSO(Generic Segmentation Offload,延缓分片技术)等机制,因此会对数据包进行合并,捕获的数据包长度往往会大于MTU。为了能够精准的重发丢失的数据段,本实施例将数据包分割成MTU的长度进行存储,同时修改数据包头的序列号。In the above embodiment, since the network card has mechanisms such as TSO (TCP Segmentation Offload, TCP segment offload), GSO (Generic Segmentation Offload, delayed fragmentation technology), the data packets will be merged, and the length of the captured data packets will often be greater than the MTU. In order to accurately resend the lost data segment, this embodiment divides the data packet into MTU lengths for storage, and modifies the serial number of the data packet header at the same time.
TSO、GSO两种技术都是将数据包的分段和合并操作从CPU移到网卡硬件上,从而降低CPU的负载。Both TSO and GSO technologies move the segmentation and merging operations of data packets from the CPU to the network card hardware, thereby reducing the load on the CPU.
MTU是指在网络通信中可以传输的最大数据包的大小。MTU refers to the size of the largest data packet that can be transmitted in network communication.
其中,当接收到所述缓存中任意数据包的ACK(Acknowledge character,确认字符)包时,从所述缓存中删除所述任意数据包所属的区间的字段。Wherein, when an ACK (Acknowledge character, acknowledgment character) packet of any data packet in the cache is received, the field of the interval to which the arbitrary data packet belongs is deleted from the cache.
例如:检测TCP数据首部的标志位,若是带有ACK字段(用于确认对应数据包是否被确认),则将ACK字段传递到所述缓存,以便通过所述ACK字段检测对应的数据包是否已被确认。进一步地,移除掉已经被确认的缓存中的数据包,及时的清除无用的数据包缓存可以极大程度的降低内存占用。更进一步地,检测数据包是否带有数据,若带有数据,则对这份数据包进行缓存,用于之后可能会发生的重传。For example: detect the flag bit of the TCP data header, if it has an ACK field (used to confirm whether the corresponding data packet is confirmed), then transfer the ACK field to the cache, so as to detect whether the corresponding data packet has been received through the ACK field be confirmed. Furthermore, removing the confirmed data packets in the cache and clearing useless data packet caches in time can greatly reduce the memory usage. Furthermore, it is detected whether the data packet contains data, and if it contains data, the data packet is cached for retransmission that may occur later.
其中,当在所述缓存中查询丢失数据包时,在所述有序二维链表末尾的预设长度范围内进行二分查找。Wherein, when querying the lost data packet in the cache, a binary search is performed within a preset length range at the end of the ordered two-dimensional linked list.
例如:可以在所述有序二维链表末尾20%的长度内进行二分查找,以减少搜索范围,同时结合二分查找,减少了查询次数,降低CPU消耗,进而提升查询效率。For example: binary search can be performed within 20% of the length of the end of the ordered two-dimensional linked list to reduce the search range, and combined with binary search, the number of queries is reduced, CPU consumption is reduced, and query efficiency is improved.
在本实施例中,所述检测是否有数据包存在丢失风险,并在检测到有数据包存在丢失风险时,结合缓存执行对所述数据包的重传包括:In this embodiment, the detecting whether there is a risk of data packet loss, and when it is detected that there is a risk of data packet loss, retransmitting the data packet in conjunction with caching includes:
获取每个数据包所属的TCP流的带宽、历史丢包率,以及在所述缓存中的存储时长;Obtain the bandwidth of the TCP stream to which each data packet belongs, the historical packet loss rate, and the storage duration in the cache;
获取与所述带宽对应的第一权重、与所述历史丢包率对应的第二权重,以及与所述存储时长对应的第三权重;Acquiring a first weight corresponding to the bandwidth, a second weight corresponding to the historical packet loss rate, and a third weight corresponding to the storage duration;
计算所述带宽与所述第一权重的乘积得到第一数值,计算所述历史丢包率与所述第二权重的乘积得到第二数值,及计算所述存储时长与所述第三权重的乘积得到第三数值;Calculate the product of the bandwidth and the first weight to obtain a first value, calculate the product of the historical packet loss rate and the second weight to obtain a second value, and calculate the storage duration and the third weight The product gets the third value;
计算所述第一数值、所述第二数值与所述第三数值的和,得到每个数据包当前的动态丢包率;calculating the sum of the first value, the second value and the third value to obtain the current dynamic packet loss rate of each data packet;
获取预先配置的丢包率阈值;Obtain the pre-configured packet loss rate threshold;
当有数据包对应的所述动态丢包率大于所述丢包率阈值时,确定所述数据包存在丢失风险;When the dynamic packet loss rate corresponding to a data packet is greater than the packet loss rate threshold, it is determined that the data packet has a loss risk;
从所述数据包对应的TCP头中获取SACK(Selective ACK)字段;Obtain the SACK (Selective ACK) field from the TCP header corresponding to the data packet;
根据所述SACK字段获取丢失的数据包序号;Obtain the sequence number of the lost data packet according to the SACK field;
根据所述数据包序号从所述缓存中查询并获取丢失的字段;Querying and obtaining the missing fields from the cache according to the sequence number of the data packet;
根据所述数据包序号对所述丢失的字段进行重传。Retransmit the lost field according to the data packet sequence number.
其中,所述字段是一种TCP的拓展机制,允许接收方向发送方发送多个选择性确认,以指示已经成功接收到的数据范围。通过使用SACK字段,发送方可以更准确地知道哪些数据已经被成功接收。Wherein, the field is an extension mechanism of TCP, allowing the receiver to send multiple selective acknowledgments to the sender to indicate the range of data that has been successfully received. By using the SACK field, the sender can know more precisely which data has been successfully received.
具体而言,基于TCP原有的自身特性可以确认哪些数据包丢失,比如,TCP重复发送某一个ACK或者是发送SACK字段,都能够明确的表明哪些数据包发生了丢失。Specifically, based on the original characteristics of TCP, which data packets are lost can be confirmed. For example, TCP repeatedly sends a certain ACK or sends a SACK field, which can clearly indicate which data packets are lost.
其中,所述历史丢包率可以历史数据进行统计而得到。Wherein, the historical packet loss rate can be obtained by statistics of historical data.
进一步地,所述方法还包括:Further, the method also includes:
在根据所述数据包序号对所述丢失的字段进行重传的过程中,为每个重传的所述丢失的字段配置定时器;In the process of retransmitting the lost field according to the sequence number of the data packet, configuring a timer for each retransmitted lost field;
基于所述定时器对每个重传的所述丢失的字段进行超时重传。Retransmitting the lost fields for each retransmission based on the timer with a timeout.
通过上述实施例,在进行重传时,还可以获取预先配置的定时器,基于所述定时器触发超时重传。具体而言,若迟迟接收不到确认,则可以通过相关函数分析出存在丢包风险,此时可以触发超时重传。例如:每重传一个数据包就会为该数据包设定一个定时器,若迟迟得不到确认,定时器则会进行超时重传。Through the above embodiment, when retransmission is performed, a pre-configured timer can also be obtained, and retransmission with timeout is triggered based on the timer. Specifically, if the acknowledgment is not received for a long time, it can be analyzed through related functions that there is a risk of packet loss, and a timeout retransmission can be triggered at this time. For example: every time a data packet is retransmitted, a timer will be set for the data packet. If the confirmation is not received for a long time, the timer will retransmit after a timeout.
在实际场景中,若捕获到序号为1、2、3、5的数据包,则序号为4的数据包就可能丢失了,或者,若捕获到序号1、2、3、4的数据包,但迟迟没有捕获到序号为5的数据包,则序号为5的数据包可能丢失。In actual scenarios, if packets with sequence numbers 1, 2, 3, and 5 are captured, packets with sequence numbers 4 may be lost, or, if packets with sequence numbers 1, 2, 3, and 4 are captured, But the data packet with the sequence number 5 has not been captured for a long time, and the data packet with the sequence number 5 may be lost.
可以理解的是,无线网络环境中时常会遇见网络波动或者丢包的情况,在确定所述数据包存在丢失风险或者是确定发生数据包丢失后,需要在告知发送方发生了丢包或者是等待超时之后,发送方才会进行重发,重发的数据包同样需要经历一遍完整的链路才能到达接收方,耗时较长。本实施例基于无线网络的特性,将上述重发包过程缩短到从最末尾的中间路由到接收方,即直接从缓存中获取丢失的字段进行重传,而非从发送方重新发送数据包,大大降低了重发包的所需时间。并且,为了保证数据包成功到达对端,为每一个已发送的数据包维护了一个定时器,以便定期触发超时重传。It is understandable that network fluctuations or packet loss are often encountered in the wireless network environment. After determining that the data packet is at risk of loss or that data packet loss has occurred, it is necessary to inform the sender of the occurrence of packet loss or wait. After the timeout, the sender will retransmit, and the retransmitted data packet also needs to go through a complete link to reach the receiver, which takes a long time. Based on the characteristics of the wireless network, this embodiment shortens the process of resending packets from the last intermediate route to the receiver, that is, directly obtains the lost fields from the cache for retransmission instead of resending the data packet from the sender, greatly The time required to resend packets is reduced. Moreover, in order to ensure that the data packet reaches the opposite end successfully, a timer is maintained for each sent data packet, so as to periodically trigger timeout retransmission.
也就是说,当数据包丢失的时候,传统的TCP链路需要从发送方进行重发,而采用了TCP加速服务的TCP链路则可以从中间设备进行数据包的补发,缩短了重传的路径。That is to say, when a data packet is lost, the traditional TCP link needs to be retransmitted from the sender, while the TCP link using the TCP acceleration service can resend the data packet from the intermediate device, shortening the retransmission path of.
TCP流在检测到丢包的时候会降低发送窗口值,大幅降低TCP流速率,TCP加速服务会比原始发送方更敏锐的判断出丢包,从而使得原始TCP流对丢包做出反应之前进行补包,从而提升整体网络的带宽利用率。When the TCP flow detects packet loss, it will reduce the sending window value and greatly reduce the TCP flow rate. The TCP acceleration service will judge the packet loss more sensitively than the original sender, so that the original TCP flow can respond to the packet loss before Packet replenishment, thereby improving the bandwidth utilization of the overall network.
本实施例针对无线网络优化了丢包判断和重传算法,有效改善了无线网络环境下信号不好而导致的带宽下降问题。This embodiment optimizes the packet loss judgment and retransmission algorithm for the wireless network, effectively improving the problem of bandwidth drop caused by bad signals in the wireless network environment.
本实施例动态判断丢包,以便在丢包影响链路之前提前补包,保证链路通畅。本实施例提前确认数据包的到达,屏蔽发送方的丢包感知,最大程度的保证链路的传输速度。In this embodiment, packet loss is determined dynamically, so that packets can be replenished in advance before packet loss affects the link, so as to ensure smooth link. This embodiment confirms the arrival of the data packet in advance, shields the packet loss perception of the sender, and guarantees the transmission speed of the link to the greatest extent.
S12,在重传过程中,检测所述数据包对应的数据流是否发生拥塞,并在检测到所述数据包对应的数据流发生拥塞时执行拥塞控制。S12. During the retransmission process, detect whether the data flow corresponding to the data packet is congested, and perform congestion control when it is detected that the data flow corresponding to the data packet is congested.
丢包一般发生在中间路由到用户终端的无线网络上,而有线网络通常网络质量较好。当丢包发生之后,现有基于丢包的拥塞控制算法会大幅度的降低链路传输速度。Packet loss generally occurs on the wireless network that is routed to the user terminal in the middle, while the wired network usually has better network quality. When packet loss occurs, the existing congestion control algorithm based on packet loss will greatly reduce the link transmission speed.
相比较而言,在本实施例中,所述检测所述数据包对应的数据流是否发生拥塞,并在检测到所述数据包对应的数据流发生拥塞时执行拥塞控制包括:In comparison, in this embodiment, the detecting whether the data flow corresponding to the data packet is congested, and performing congestion control when detecting that the data flow corresponding to the data packet is congested includes:
采用下述公式计算拥塞指数:The congestion index is calculated using the following formula:
; ;
其中,R表示预先配置的理论带宽,S表示所述数据包的大小, tRTT表示所述数据包的往返时延,tRTO表示预先配置的传输超时时限,p表示所述历史丢包率,b表示一次ACK的确认包数;Y表示所述拥塞指数,bw表示所述数据包所属的TCP流的带宽;cwnd表示拥塞窗口的大小;Wherein, R represents the pre-configured theoretical bandwidth, S represents the size of the data packet, t RTT represents the round-trip delay of the data packet, t RTO represents the pre-configured transmission overtime limit, p represents the historical packet loss rate, b represents the number of confirmation packets of an ACK; Y represents the congestion index, bw represents the bandwidth of the TCP flow to which the data packet belongs; cwnd represents the size of the congestion window;
获取预先配置的拥塞指数阈值;Get the pre-configured congestion index threshold;
当所述拥塞指数Y小于所述拥塞指数阈值时,确定所述数据包对应的TCP流发生拥塞;When the congestion index Y is less than the congestion index threshold, it is determined that the TCP flow corresponding to the data packet is congested;
降低所述TCP流中用于提前确认的模拟ACK包的发送频率,并提升所述缓存中所述TCP流对应的数据包的重传频率;reducing the sending frequency of the analog ACK packet used for early confirmation in the TCP flow, and increasing the retransmission frequency of the data packet corresponding to the TCP flow in the cache;
其中,对于具有相同IP的其他TCP流,降低所述其他TCP流中用于提前确认的模拟ACK包的发送频率,并提升所述缓存中所述其他TCP流对应的数据包的重传频率。对相同IP的其他TCP流进行动态评估调控,防止多个TCP流同时阻塞。Wherein, for other TCP flows with the same IP, reduce the sending frequency of the simulated ACK packets used for early confirmation in the other TCP flows, and increase the retransmission frequency of the data packets corresponding to the other TCP flows in the cache. Dynamically evaluate and regulate other TCP flows of the same IP to prevent multiple TCP flows from being blocked at the same time.
其中,所述拥塞指数阈值可以进行自定义配置,如0.86。Wherein, the congestion index threshold can be customized, such as 0.86.
可以理解的是,当发生拥塞时,为了避免频繁发送模拟ACK包进一步导致拥塞加重,因此,降低模拟ACK包的发送频率,进而将对应TCP流的带宽调节至适合的大小;当发生拥塞时也更容易出现丢包问题,因此提升重传频率,以降低丢包率。根据拥塞情况动态调整提前确认和重发包的频率,降低TCP链路的整体负载压力,促使整个TCP链路尽快恢复正常。It can be understood that when congestion occurs, in order to avoid further congestion caused by frequent sending of simulated ACK packets, the frequency of sending simulated ACK packets is reduced, and then the bandwidth of the corresponding TCP stream is adjusted to an appropriate size; when congestion occurs, it is also It is more prone to packet loss, so the retransmission frequency is increased to reduce the packet loss rate. Dynamically adjust the frequency of early confirmation and retransmission according to the congestion situation, reduce the overall load pressure of the TCP link, and promote the entire TCP link to return to normal as soon as possible.
在上述实施例中,采用动态拥塞控制算法,降低了链路拥塞发生的可能性,提高了链路的带宽利用率。In the above embodiments, the dynamic congestion control algorithm is used to reduce the possibility of link congestion and improve link bandwidth utilization.
S13,在执行拥塞控制后,检测所述数据包是否需要提前确认。S13. After performing congestion control, detect whether the data packet needs to be acknowledged in advance.
由于从发送方到中间路由一般是有线网络连接,而中间路由到接收方则是无线网络,发送方到中间路由的一段网络要远优于中间路由到终端(即所述接收方)的网络。因此,如果无休止的提前确认数据包,会在网络的两端形成一个较大的速率差,继而导致数据包在缓存中大量堆积,所以需要依据带宽和丢包率来对该数据包进行分析,以确定是否提前确认该数据包。Since the route from the sender to the intermediate route is generally a wired network connection, while the route from the intermediate route to the receiver is a wireless network, the network from the sender to the intermediate route is much better than the network from the intermediate route to the terminal (ie, the receiver). Therefore, if the data packets are confirmed in advance endlessly, a large rate difference will be formed at both ends of the network, which will cause a large number of data packets to accumulate in the cache, so the data packets need to be analyzed according to the bandwidth and packet loss rate , to determine whether to acknowledge the packet in advance.
具体地,所述检测所述数据包是否需要提前确认包括:Specifically, the detecting whether the data packet needs to be confirmed in advance includes:
获取预先配置的第四权重、第五权重及第六权重;Obtain the pre-configured fourth weight, fifth weight and sixth weight;
计算所述数据包所属的TCP流的带宽与所述第四权重的乘积得到第四数值,计算所述历史丢包率与所述第五权重的乘积得到第五数值,及计算所述拥塞指数与所述第六权重的乘积得到第六数值;Calculate the product of the bandwidth of the TCP stream to which the data packet belongs and the fourth weight to obtain a fourth value, calculate the product of the historical packet loss rate and the fifth weight to obtain a fifth value, and calculate the congestion index multiplied by said sixth weight to obtain a sixth value;
计算所述第四数值、所述第五数值与所述第六数值的和,得到目标值;calculating the sum of the fourth value, the fifth value and the sixth value to obtain a target value;
获取预先配置的预设阈值;Get pre-configured preset thresholds;
当所述目标值大于所述预设阈值时,确定所述数据包需要提前确认。When the target value is greater than the preset threshold, it is determined that the data packet needs to be acknowledged in advance.
在上述实施例中,结合拥塞控制过程中得到的所述拥塞指数、所述带宽及所述历史丢包率进行加权和计算,以检测所述数据包是否需要提前确认,以通过提前回复ACK包和补发数据包的形式,降低链路的总体延迟和丢包率。In the above embodiment, the weighted sum calculation is performed in combination with the congestion index obtained in the congestion control process, the bandwidth and the historical packet loss rate to detect whether the data packet needs to be confirmed in advance, so as to reply the ACK packet in advance and resend data packets to reduce the overall delay and packet loss rate of the link.
在本实施例中,若确定所述数据包不需要提前确认,则将所述数据包存储至所述缓存。In this embodiment, if it is determined that the data packet does not need to be confirmed in advance, the data packet is stored in the cache.
S14,当检测到所述数据包需要提前确认时,生成所述数据包的模拟ACK包,并将所述模拟ACK包传输至所述数据包的发送方。S14. When it is detected that the data packet needs to be acknowledged in advance, generate a simulated ACK packet of the data packet, and transmit the simulated ACK packet to the sender of the data packet.
一个TCP流在初始建立的时候处于慢启动阶段,接收方回复ACK越快,链路速度提升的越快。因此,提前回复ACK可以缩短TCP流到达最大带宽的时间。A TCP stream is in the slow start phase when it is initially established. The faster the receiver replies with ACK, the faster the link speed will increase. Therefore, replying ACK in advance can shorten the time for the TCP flow to reach the maximum bandwidth.
通过模拟ACK包,能够更快地确认数据包,以便让发送方更快的发送之后的数据包,从而提高链路传输速度。By simulating the ACK packet, the data packet can be confirmed faster, so that the sender can send the subsequent data packet faster, thereby improving the link transmission speed.
在上述实施例中,采用旁路补包的方式在不影响原有TCP链路的情况下改善链路状态。不同于传统的TCP加速,由于本实施例不会对TCP链路进行截断,而是在原本链路的基础上进行补包,所以支持热启动、热更新。In the above-mentioned embodiment, the link state is improved without affecting the original TCP link by adopting the way of bypass supplementary packet. Different from traditional TCP acceleration, since this embodiment does not truncate the TCP link, but supplements packets on the basis of the original link, it supports hot start and hot update.
由以上技术方案可以看出,本发明应用于旁路部署的加速设备或者加速服务,在不影响原有TCP链路的情况下改善链路状态,在一段TCP链路中实现类似于传统代理将TCP链路分割成两段的效果(即发送方到加速设备或加速服务的部署节点、加速设备或加速服务的部署节点到接收方两段),将丢包的影响限制在其中任意一段链路中,继而使得丢失的数据包可以更快的重传,且部署灵活;实时捕获数据包,并将捕获的数据包分流至不同线程,以提升并发处理效率;在检测到数据包丢包时,结合缓存执行对数据包的重传,无需从发送方重新发包,从中间加速缓存中获取丢包重传至接收方即可,降低了重发包所需时间,且在丢包影响链路之前提前补包,以保证链路通畅;在检测到数据包对应的数据流发生拥塞时执行拥塞控制,降低了链路拥塞发生的可能性,提高了链路的带宽利用率;检测数据包是否需要提前确认,通过提前回复ACK和补发数据包的形式,均衡发送方到加速设备或加速服务的部署节点、加速设备或加速服务的部署节点到接收方的等效两段速率,降低了链路的总体延迟和丢包率。It can be seen from the above technical solutions that the present invention is applied to the acceleration device or acceleration service deployed by the bypass, and improves the link status without affecting the original TCP link. The effect of splitting the TCP link into two segments (that is, from the sender to the deployment node of the acceleration device or acceleration service, and from the deployment node of the acceleration device or acceleration service to the receiver), limits the impact of packet loss to any one of the links In this way, the lost data packets can be retransmitted faster, and the deployment is flexible; the data packets are captured in real time, and the captured data packets are distributed to different threads to improve the concurrent processing efficiency; when the data packet loss is detected, Combined with the cache to retransmit the data packet, there is no need to resend the packet from the sender, just get the lost packet from the intermediate acceleration cache and retransmit it to the receiver, which reduces the time required for resending the packet, and advances before the packet loss affects the link Supplement the packet to ensure the smooth link; perform congestion control when the data stream corresponding to the data packet is detected to be congested, which reduces the possibility of link congestion and improves the bandwidth utilization of the link; detects whether the data packet needs to be forwarded Confirm that by replying ACK in advance and resending data packets, the equivalent two-stage rate from the sender to the deployment node of the acceleration device or acceleration service, and from the deployment node of the acceleration device or acceleration service to the receiver is balanced, reducing the link speed. Overall latency and packet loss.
如图4所示,是本发明旁路TCP加速装置的较佳实施例的功能模块图。所述旁路TCP加速装置11包括分流单元110、检测单元111、拥塞控制单元112、重传单元113。本发明所称的模块/单元是指一种能够被处理器所执行,并且能够完成固定功能的一系列计算机程序段,其存储在存储器中。在本实施例中,关于各模块/单元的功能将在后续的实施例中详述。As shown in FIG. 4 , it is a functional block diagram of a preferred embodiment of the bypass TCP acceleration device of the present invention. The bypass TCP acceleration device 11 includes a distribution unit 110 , a detection unit 111 , a congestion control unit 112 , and a retransmission unit 113 . The module/unit referred to in the present invention refers to a series of computer program segments that can be executed by a processor and perform fixed functions, and are stored in a memory. In this embodiment, the functions of each module/unit will be described in detail in subsequent embodiments.
在本实施例中,所述旁路TCP加速装置11运行于旁路部署的加速设备或者加速服务,包括:In this embodiment, the bypass TCP acceleration device 11 runs on the bypass-deployed acceleration device or acceleration service, including:
所述分流单元110,用于实时捕获数据包,并在捕获到数据包时,将捕获的数据包分流至对应的线程;The distribution unit 110 is configured to capture data packets in real time, and when capturing data packets, distribute the captured data packets to corresponding threads;
所述检测单元111,用于检测是否有数据包存在丢失风险,并在检测到有数据包存在丢失风险时,结合缓存执行对所述数据包的重传,并将所述数据包重传至所述数据包的接收方;The detection unit 111 is configured to detect whether there is a risk of data packet loss, and when it is detected that there is a risk of data packet loss, retransmit the data packet in combination with the cache, and retransmit the data packet to the recipient of the data packet;
所述拥塞控制单元112,用于在重传过程中,检测所述数据包对应的数据流是否发生拥塞,并在检测到所述数据包对应的数据流发生拥塞时执行拥塞控制;The congestion control unit 112 is configured to detect whether the data flow corresponding to the data packet is congested during the retransmission process, and perform congestion control when it is detected that the data flow corresponding to the data packet is congested;
所述检测单元111,还用于在执行拥塞控制后,检测所述数据包是否需要提前确认;The detection unit 111 is further configured to detect whether the data packet needs to be confirmed in advance after performing congestion control;
所述重传单元113,用于当检测到所述数据包需要提前确认时,生成所述数据包的模拟ACK包,并将所述模拟ACK包传输至所述数据包的发送方。The retransmission unit 113 is configured to generate a simulated ACK packet of the data packet when it is detected that the data packet needs to be confirmed in advance, and transmit the simulated ACK packet to the sender of the data packet.
由以上技术方案可以看出,本发明应用于旁路部署的加速设备或者加速服务,在不影响原有TCP链路的情况下改善链路状态,在一段TCP链路中实现类似于传统代理将TCP链路分割成两段的效果(即发送方到加速设备或加速服务的部署节点、加速设备或加速服务的部署节点到接收方两段),将丢包的影响限制在其中任意一段链路中,继而使得丢失的数据包可以更快的重传,且部署灵活;实时捕获数据包,并将捕获的数据包分流至不同线程,以提升并发处理效率;在检测到数据包丢包时,结合缓存执行对数据包的重传,无需从发送方重新发包,从中间加速缓存中获取丢包重传至接收方即可,降低了重发包所需时间,且在丢包影响链路之前提前补包,以保证链路通畅;在检测到数据包对应的数据流发生拥塞时执行拥塞控制,降低了链路拥塞发生的可能性,提高了链路的带宽利用率;检测数据包是否需要提前确认,通过提前回复ACK和补发数据包的形式,均衡发送方到加速设备或加速服务的部署节点、加速设备或加速服务的部署节点到接收方的等效两段速率,降低了链路的总体延迟和丢包率。It can be seen from the above technical solutions that the present invention is applied to the acceleration device or acceleration service deployed by the bypass, and improves the link status without affecting the original TCP link. The effect of splitting the TCP link into two segments (that is, from the sender to the deployment node of the acceleration device or acceleration service, and from the deployment node of the acceleration device or acceleration service to the receiver), limits the impact of packet loss to any one of the links In this way, the lost data packets can be retransmitted faster, and the deployment is flexible; the data packets are captured in real time, and the captured data packets are distributed to different threads to improve the concurrent processing efficiency; when the data packet loss is detected, Combined with the cache to retransmit the data packet, there is no need to resend the packet from the sender, just get the lost packet from the intermediate acceleration cache and retransmit it to the receiver, which reduces the time required for resending the packet, and advances before the packet loss affects the link Supplement the packet to ensure the smooth link; perform congestion control when the data stream corresponding to the data packet is detected to be congested, which reduces the possibility of link congestion and improves the bandwidth utilization of the link; detects whether the data packet needs to be forwarded Confirm that by replying ACK in advance and resending data packets, the equivalent two-stage rate from the sender to the deployment node of the acceleration device or acceleration service, and from the deployment node of the acceleration device or acceleration service to the receiver is balanced, reducing the link speed. Overall latency and packet loss.
如图5所示,是本发明实现旁路TCP加速方法的较佳实施例的计算机设备的结构示意图。As shown in FIG. 5 , it is a schematic structural diagram of a computer device in a preferred embodiment of the bypass TCP acceleration method of the present invention.
所述计算机设备1可以包括存储器12、处理器13和总线,还可以包括存储在所述存储器12中并可在所述处理器13上运行的计算机程序,例如旁路TCP加速程序。The computer device 1 may include a memory 12, a processor 13 and a bus, and may also include a computer program stored in the memory 12 and operable on the processor 13, such as a bypass TCP acceleration program.
本领域技术人员可以理解,所述示意图仅仅是计算机设备1的示例,并不构成对计算机设备1的限定,所述计算机设备1既可以是总线型结构,也可以是星形结构,所述计算机设备1还可以包括比图示更多或更少的其他硬件或者软件,或者不同的部件布置,例如所述计算机设备1还可以包括输入输出设备、网络接入设备等。Those skilled in the art can understand that the schematic diagram is only an example of the computer device 1 and does not constitute a limitation to the computer device 1. The computer device 1 can be a bus structure or a star structure. The computer The device 1 may also include more or less other hardware or software than shown in the figure, or a different arrangement of components, for example, the computer device 1 may also include input and output devices, network access devices, and the like.
需要说明的是,所述计算机设备1仅为举例,其他现有的或今后可能出现的电子产品如可适应于本发明,也应包含在本发明的保护范围以内,并以引用方式包含于此。It should be noted that the computer device 1 is only an example, and other existing or future electronic products that can be adapted to the present invention should also be included in the protection scope of the present invention, and are included here by reference .
其中,存储器12至少包括一种类型的可读存储介质,所述可读存储介质包括闪存、移动硬盘、多媒体卡、卡型存储器(例如:SD或DX存储器等)、磁性存储器、磁盘、光盘等。存储器12在一些实施例中可以是计算机设备1的内部存储单元,例如该计算机设备1的移动硬盘。存储器12在另一些实施例中也可以是计算机设备1的外部存储设备,例如计算机设备1上配备的插接式移动硬盘、智能存储卡(Smart Media Card,SMC)、安全数字(SecureDigital,SD)卡、闪存卡(Flash Card)等。进一步地,存储器12还可以既包括计算机设备1的内部存储单元也包括外部存储设备。存储器12不仅可以用于存储安装于计算机设备1的应用软件及各类数据,例如旁路TCP加速程序的代码等,还可以用于暂时地存储已经输出或者将要输出的数据。Wherein, the memory 12 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, mobile hard disk, multimedia card, card-type memory (for example: SD or DX memory, etc.), magnetic memory, magnetic disk, optical disk, etc. . The memory 12 may be an internal storage unit of the computer device 1 in some embodiments, such as a removable hard disk of the computer device 1 . In other embodiments, the memory 12 can also be an external storage device of the computer device 1, such as a plug-in mobile hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (SecureDigital, SD) card, flash card (Flash Card), etc. Further, the memory 12 may also include both an internal storage unit of the computer device 1 and an external storage device. The memory 12 can not only be used to store application software and various data installed in the computer device 1, such as the code of the bypass TCP acceleration program, etc., but also can be used to temporarily store data that has been output or will be output.
处理器13在一些实施例中可以由集成电路组成,例如可以由单个封装的集成电路所组成,也可以是由多个相同功能或不同功能封装的集成电路所组成,包括一个或者多个中央处理器(Central Processing unit,CPU)、微处理器、数字处理芯片、图形处理器及各种控制芯片的组合等。处理器13是所述计算机设备1的控制核心(Control Unit),利用各种接口和线路连接整个计算机设备1的各个部件,通过运行或执行存储在所述存储器12内的程序或者模块(例如执行旁路TCP加速程序等),以及调用存储在所述存储器12内的数据,以执行计算机设备1的各种功能和处理数据。In some embodiments, the processor 13 may be composed of integrated circuits, for example, may be composed of a single packaged integrated circuit, or may be composed of multiple integrated circuits with the same function or different functions, including one or more central processing units. Central Processing unit (CPU), microprocessor, digital processing chip, graphics processor and a combination of various control chips, etc. The processor 13 is the control core (Control Unit) of the computer device 1, and uses various interfaces and lines to connect various components of the entire computer device 1, and runs or executes programs or modules stored in the memory 12 (for example, executes bypass TCP acceleration program, etc.), and call the data stored in the memory 12 to execute various functions of the computer device 1 and process data.
所述处理器13执行所述计算机设备1的操作系统以及安装的各类应用程序。所述处理器13执行所述应用程序以实现上述各个旁路TCP加速方法实施例中的步骤,例如图1所示的步骤。The processor 13 executes the operating system of the computer device 1 and various installed application programs. The processor 13 executes the application program to implement the steps in the above embodiments of each bypass TCP acceleration method, for example, the steps shown in FIG. 1 .
示例性的,所述计算机程序可以被分割成一个或多个模块/单元,所述一个或者多个模块/单元被存储在所述存储器12中,并由所述处理器13执行,以完成本发明。所述一个或多个模块/单元可以是能够完成特定功能的一系列计算机可读指令段,该指令段用于描述所述计算机程序在所述计算机设备1中的执行过程。例如,所述计算机程序可以被分割成分流单元110、检测单元111、拥塞控制单元112、重传单元113。Exemplarily, the computer program can be divided into one or more modules/units, and the one or more modules/units are stored in the memory 12 and executed by the processor 13 to complete this invention. The one or more modules/units may be a series of computer-readable instruction segments capable of accomplishing specific functions, and the instruction segments are used to describe the execution process of the computer program in the computer device 1 . For example, the computer program can be divided into a streaming unit 110 , a detection unit 111 , a congestion control unit 112 , and a retransmission unit 113 .
上述以软件功能模块的形式实现的集成的单元,可以存储在一个计算机可读取存储介质中。上述软件功能模块存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机、计算机设备,或者网络设备等)或处理器(processor)执行本发明各个实施例所述旁路TCP加速方法的部分。The above-mentioned integrated units implemented in the form of software function modules can be stored in a computer-readable storage medium. The above-mentioned software function modules are stored in a storage medium, and include several instructions to enable a computer device (which may be a personal computer, computer device, or network device, etc.) or a processor (processor) to execute the side functions described in various embodiments of the present invention. Part of the road TCP acceleration method.
所述计算机设备1集成的模块/单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明实现上述实施例方法中的全部或部分流程,也可以通过计算机程序来指示相关的硬件设备来完成,所述的计算机程序可存储于一计算机可读存储介质中,该计算机程序在被处理器执行时,可实现上述各个方法实施例的步骤。If the integrated modules/units of the computer device 1 are realized in the form of software function units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the present invention realizes all or part of the processes in the methods of the above embodiments, and can also be completed by instructing related hardware devices through computer programs, and the computer programs can be stored in a computer-readable storage medium. When the computer program is executed by the processor, it can realize the steps of the above-mentioned various method embodiments.
其中,所述计算机程序包括计算机程序代码,所述计算机程序代码可以为源代码形式、对象代码形式、可执行文件或某些中间形式等。所述计算机可读介质可以包括:能够携带所述计算机程序代码的任何实体或装置、记录介质、U盘、移动硬盘、磁碟、光盘、计算机存储器、只读存储器(ROM,Read-Only Memory)、随机存取存储器等。Wherein, the computer program includes computer program code, and the computer program code may be in the form of source code, object code, executable file or some intermediate form. The computer readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, removable hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory) , random access memory, etc.
进一步地,计算机可读存储介质可主要包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序等;存储数据区可存储根据区块链节点的使用所创建的数据等。Further, the computer-readable storage medium may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required by at least one function, etc.; Use the created data etc.
本发明所指区块链是分布式数据存储、点对点传输、共识机制、加密算法等计算机技术的新型应用模式。区块链(Blockchain),本质上是一个去中心化的数据库,是一串使用密码学方法相关联产生的数据块,每一个数据块中包含了一批次网络交易的信息,用于验证其信息的有效性(防伪)和生成下一个区块。区块链可以包括区块链底层平台、平台产品服务层以及应用服务层等。The block chain referred to in the present invention is a new application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm. Blockchain (Blockchain), essentially a decentralized database, is a series of data blocks associated with each other using cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify its Validity of information (anti-counterfeiting) and generation of the next block. The blockchain can include the underlying platform of the blockchain, the platform product service layer, and the application service layer.
总线可以是外设部件互连标准(peripheral component interconnect,简称PCI)总线或扩展工业标准结构(extended industry standard architecture,简称EISA)总线等。该总线可以分为地址总线、数据总线、控制总线等。为便于表示,在图5中仅用一根直线表示,但并不表示仅有一根总线或一种类型的总线。所述总线被设置为实现所述存储器12以及至少一个处理器13等之间的连接通信。The bus may be a peripheral component interconnect (PCI for short) bus or an extended industry standard architecture (EISA for short) bus or the like. The bus can be divided into address bus, data bus, control bus and so on. For ease of representation, only one straight line is used in FIG. 5 , but it does not mean that there is only one bus or one type of bus. The bus is configured to realize connection and communication between the memory 12 and at least one processor 13 and the like.
尽管未示出,所述计算机设备1还可以包括给各个部件供电的电源(比如电池),优选地,电源可以通过电源管理装置与所述至少一个处理器13逻辑相连,从而通过电源管理装置实现充电管理、放电管理、以及功耗管理等功能。电源还可以包括一个或一个以上的直流或交流电源、再充电装置、电源故障检测电路、电源转换器或者逆变器、电源状态指示器等任意组件。所述计算机设备1还可以包括多种传感器、蓝牙模块、Wi-Fi模块等,在此不再赘述。Although not shown, the computer device 1 may also include a power supply (such as a battery) for supplying power to various components. Preferably, the power supply may be logically connected to the at least one processor 13 through a power management device, thereby realizing Charge management, discharge management, and power management functions. The power supply may also include one or more DC or AC power supplies, recharging devices, power failure detection circuits, power converters or inverters, power status indicators and other arbitrary components. The computer device 1 may also include various sensors, bluetooth modules, Wi-Fi modules, etc., which will not be repeated here.
进一步地,所述计算机设备1还可以包括网络接口,可选地,所述网络接口可以包括有线接口和/或无线接口(如WI-FI接口、蓝牙接口等),通常用于在该计算机设备1与其他计算机设备之间建立通信连接。Further, the computer device 1 may also include a network interface. Optionally, the network interface may include a wired interface and/or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which are usually used in the computer device 1 Establish a communication connection with other computer equipment.
可选地,该计算机设备1还可以包括用户接口,用户接口可以是显示器(Display)、输入单元(比如键盘(Keyboard)),可选地,用户接口还可以是标准的有线接口、无线接口。可选地,在一些实施例中,显示器可以是LED显示器、液晶显示器、触控式液晶显示器以及OLED(Organic Light-Emitting Diode,有机发光二极管)触摸器等。其中,显示器也可以适当的称为显示屏或显示单元,用于显示在计算机设备1中处理的信息以及用于显示可视化的用户界面。Optionally, the computer device 1 may further include a user interface, which may be a display (Display) or an input unit (such as a keyboard (Keyboard)). Optionally, the user interface may also be a standard wired interface or a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode, Organic Light-Emitting Diode) touch device, and the like. Wherein, the display may also be appropriately referred to as a display screen or a display unit, and is used for displaying information processed in the computer device 1 and for displaying a visualized user interface.
应该了解,所述实施例仅为说明之用,在专利申请范围上并不受此结构的限制。It should be understood that the embodiments are only for illustration, and are not limited by the structure in the scope of the patent application.
图5仅示出了具有组件12-13的计算机设备1,本领域技术人员可以理解的是,图5示出的结构并不构成对所述计算机设备1的限定,可以包括比图示更少或者更多的部件,或者组合某些部件,或者不同的部件布置。FIG. 5 only shows a computer device 1 with components 12-13. Those skilled in the art can understand that the structure shown in FIG. 5 does not constitute a limitation to the computer device 1, and may include less Or more components, or combinations of certain components, or a different arrangement of components.
结合图1,所述计算机设备1中的所述存储器12存储多个指令以实现一种旁路TCP加速方法,所述处理器13可执行所述多个指令从而实现:With reference to FIG. 1, the memory 12 in the computer device 1 stores multiple instructions to implement a bypass TCP acceleration method, and the processor 13 can execute the multiple instructions to achieve:
实时捕获数据包,并在捕获到数据包时,将捕获的数据包分流至对应的线程;Capture data packets in real time, and divert the captured data packets to corresponding threads when capturing data packets;
检测是否有数据包存在丢失风险,并在检测到有数据包存在丢失风险时,结合缓存执行对所述数据包的重传,并将所述数据包重传至所述数据包的接收方;Detecting whether there is a risk of data packet loss, and when detecting that there is a risk of data packet loss, retransmitting the data packet in combination with the buffer, and retransmitting the data packet to the receiver of the data packet;
在重传过程中,检测所述数据包对应的数据流是否发生拥塞,并在检测到所述数据包对应的数据流发生拥塞时执行拥塞控制;During the retransmission process, detect whether the data flow corresponding to the data packet is congested, and perform congestion control when it is detected that the data flow corresponding to the data packet is congested;
在执行拥塞控制后,检测所述数据包是否需要提前确认;After performing congestion control, detecting whether the data packet needs to be confirmed in advance;
当检测到所述数据包需要提前确认时,生成所述数据包的模拟ACK包,并将所述模拟ACK包传输至所述数据包的发送方。When it is detected that the data packet needs to be acknowledged in advance, generate a simulated ACK packet of the data packet, and transmit the simulated ACK packet to the sender of the data packet.
具体地,所述处理器13对上述指令的具体实现方法可参考图1对应实施例中相关步骤的描述,在此不赘述。Specifically, for the specific implementation method of the above instructions by the processor 13, reference may be made to the description of relevant steps in the embodiment corresponding to FIG. 1 , and details are not repeated here.
需要说明的是,本案中所涉及到的数据均为合法取得。It should be noted that the data involved in this case were obtained legally.
在本发明所提供的几个实施例中,应该理解到,所揭露的系统,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述模块的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。In the several embodiments provided by the present invention, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only illustrative. For example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation.
本发明可用于众多通用或专用的计算机系统环境或配置中。例如:个人计算机、服务器计算机、手持设备或便携式设备、平板型设备、多处理器系统、基于微处理器的系统、置顶盒、可编程的消费电子设备、网络PC、小型计算机、大型计算机、包括以上任何系统或设备的分布式计算环境等等。本发明可以在由计算机执行的计算机可执行指令的一般上下文中描述,例如程序模块。一般地,程序模块包括执行特定任务或实现特定抽象数据类型的例程、程序、对象、组件、数据结构等等。也可以在分布式计算环境中实践本发明,在这些分布式计算环境中,由通过通信网络而被连接的远程处理设备来执行任务。在分布式计算环境中,程序模块可以位于包括存储设备在内的本地和远程计算机存储介质中。The invention is applicable to numerous general purpose and special purpose computer system environments or configurations. Examples: personal computers, server computers, handheld or portable devices, tablet-type devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, including A distributed computing environment for any of the above systems or devices, etc. The invention may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The invention may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including storage devices.
所述作为分离部件说明的模块可以是或者也可以不是物理上分开的,作为模块显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple network units. Part or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
另外,在本发明各个实施例中的各功能模块可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用硬件加软件功能模块的形式实现。In addition, each functional module in each embodiment of the present invention may be integrated into one processing unit, or each unit may physically exist separately, or two or more units may be integrated into one unit. The above-mentioned integrated units can be implemented in the form of hardware, or in the form of hardware plus software function modules.
对于本领域技术人员而言,显然本发明不限于上述示范性实施例的细节,而且在不背离本发明的精神或基本特征的情况下,能够以其他的具体形式实现本发明。It will be apparent to those skilled in the art that the invention is not limited to the details of the above-described exemplary embodiments, but that the invention can be embodied in other specific forms without departing from the spirit or essential characteristics of the invention.
因此,无论从哪一点来看,均应将实施例看作是示范性的,而且是非限制性的,本发明的范围由所附权利要求而不是上述说明限定,因此旨在将落在权利要求的等同要件的含义和范围内的所有变化涵括在本发明内。不应将权利要求中的任何附关联图标记视为限制所涉及的权利要求。Accordingly, the embodiments should be regarded in all points of view as exemplary and not restrictive, the scope of the invention being defined by the appended claims rather than the foregoing description, and it is therefore intended that the scope of the invention be defined by the appended claims rather than by the foregoing description. All changes within the meaning and range of equivalents of the elements are embraced in the present invention. Any reference sign in a claim should not be construed as limiting the claim concerned.
此外,显然“包括”一词不排除其他单元或步骤,单数不排除复数。本发明中陈述的多个单元或装置也可以由一个单元或装置通过软件或者硬件来实现。第一、第二等词语用来表示名称,而并不表示任何特定的顺序。In addition, it is obvious that the word "comprising" does not exclude other elements or steps, and the singular does not exclude the plural. A plurality of units or means stated in the present invention may also be realized by software or hardware by one unit or means. The terms first, second, etc. are used to denote names and do not imply any particular order.
最后应说明的是,以上实施例仅用以说明本发明的技术方案而非限制,尽管参照较佳实施例对本发明进行了详细说明,本领域的普通技术人员应当理解,可以对本发明的技术方案进行修改或等同替换,而不脱离本发明技术方案的精神和范围。Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention without limitation. Although the present invention has been described in detail with reference to the preferred embodiments, those of ordinary skill in the art should understand that the technical solutions of the present invention can be Modifications or equivalent replacements can be made without departing from the spirit and scope of the technical solutions of the present invention.
Claims (11)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202310831319.8A CN116566914B (en) | 2023-07-07 | 2023-07-07 | Bypass TCP acceleration method, device, equipment and medium |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202310831319.8A CN116566914B (en) | 2023-07-07 | 2023-07-07 | Bypass TCP acceleration method, device, equipment and medium |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN116566914A true CN116566914A (en) | 2023-08-08 |
| CN116566914B CN116566914B (en) | 2023-09-19 |
Family
ID=87500430
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202310831319.8A Active CN116566914B (en) | 2023-07-07 | 2023-07-07 | Bypass TCP acceleration method, device, equipment and medium |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN116566914B (en) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN120729810A (en) * | 2025-08-29 | 2025-09-30 | 上海芯力基半导体有限公司 | Data transmission system, method and switch for improving PCIe retransmission efficiency |
Citations (13)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| KR20040062822A (en) * | 2003-01-03 | 2004-07-09 | 삼성전자주식회사 | Apparatus for managing buffer in rlc layer and method therof |
| CN101369877A (en) * | 2007-12-27 | 2009-02-18 | 华为技术有限公司 | Wireless transmission control protocol processing method and device |
| US20100020689A1 (en) * | 2007-01-29 | 2010-01-28 | Bob Tang | Immediate ready implementation of virtually congestion free guaranteed service capable network : nextgentcp/ftp/udp intermediate buffer cyclical sack re-use |
| CN102355462A (en) * | 2011-10-09 | 2012-02-15 | 大唐移动通信设备有限公司 | Method and device for realizing TCP (Transmission Control Protocol) transmission |
| US20120290727A1 (en) * | 2009-12-31 | 2012-11-15 | Bce Inc. | Method and system for increasing performance of transmission control protocol sessions in data networks |
| CN103098510A (en) * | 2011-08-30 | 2013-05-08 | 华为技术有限公司 | Method, device and system for controlling data transmission |
| CN103548296A (en) * | 2011-03-21 | 2014-01-29 | 诺基亚西门子通信公司 | Method and apparatus to improve TCP performance in mobile networks |
| US20150089500A1 (en) * | 2013-09-26 | 2015-03-26 | Acelio, Inc. | System and method for improving tcp performance in virtualized environments |
| CN105049369A (en) * | 2015-08-14 | 2015-11-11 | 浙江大学 | Video transmission congestion control method based on MPTCP in heterogeneous wireless network |
| US20170117999A1 (en) * | 2015-10-22 | 2017-04-27 | Harris Corporation | Communications device serving as transmission control protocol (tcp) proxy |
| CN108476231A (en) * | 2015-10-30 | 2018-08-31 | 思杰系统有限公司 | Systems and methods for maintaining sessions via an intermediary |
| CN109639340A (en) * | 2018-12-11 | 2019-04-16 | 成都天奥信息科技有限公司 | A kind of TCP accelerated method suitable for satellite link |
| CN114979839A (en) * | 2021-02-27 | 2022-08-30 | 华为技术有限公司 | A transmission control protocol proxy method and communication device |
-
2023
- 2023-07-07 CN CN202310831319.8A patent/CN116566914B/en active Active
Patent Citations (13)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| KR20040062822A (en) * | 2003-01-03 | 2004-07-09 | 삼성전자주식회사 | Apparatus for managing buffer in rlc layer and method therof |
| US20100020689A1 (en) * | 2007-01-29 | 2010-01-28 | Bob Tang | Immediate ready implementation of virtually congestion free guaranteed service capable network : nextgentcp/ftp/udp intermediate buffer cyclical sack re-use |
| CN101369877A (en) * | 2007-12-27 | 2009-02-18 | 华为技术有限公司 | Wireless transmission control protocol processing method and device |
| US20120290727A1 (en) * | 2009-12-31 | 2012-11-15 | Bce Inc. | Method and system for increasing performance of transmission control protocol sessions in data networks |
| CN103548296A (en) * | 2011-03-21 | 2014-01-29 | 诺基亚西门子通信公司 | Method and apparatus to improve TCP performance in mobile networks |
| CN103098510A (en) * | 2011-08-30 | 2013-05-08 | 华为技术有限公司 | Method, device and system for controlling data transmission |
| CN102355462A (en) * | 2011-10-09 | 2012-02-15 | 大唐移动通信设备有限公司 | Method and device for realizing TCP (Transmission Control Protocol) transmission |
| US20150089500A1 (en) * | 2013-09-26 | 2015-03-26 | Acelio, Inc. | System and method for improving tcp performance in virtualized environments |
| CN105049369A (en) * | 2015-08-14 | 2015-11-11 | 浙江大学 | Video transmission congestion control method based on MPTCP in heterogeneous wireless network |
| US20170117999A1 (en) * | 2015-10-22 | 2017-04-27 | Harris Corporation | Communications device serving as transmission control protocol (tcp) proxy |
| CN108476231A (en) * | 2015-10-30 | 2018-08-31 | 思杰系统有限公司 | Systems and methods for maintaining sessions via an intermediary |
| CN109639340A (en) * | 2018-12-11 | 2019-04-16 | 成都天奥信息科技有限公司 | A kind of TCP accelerated method suitable for satellite link |
| CN114979839A (en) * | 2021-02-27 | 2022-08-30 | 华为技术有限公司 | A transmission control protocol proxy method and communication device |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN120729810A (en) * | 2025-08-29 | 2025-09-30 | 上海芯力基半导体有限公司 | Data transmission system, method and switch for improving PCIe retransmission efficiency |
Also Published As
| Publication number | Publication date |
|---|---|
| CN116566914B (en) | 2023-09-19 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN109936510B (en) | Multipath RDMA transport | |
| US10715282B2 (en) | Method and related device for improving TCP transmission efficiency using delayed ACK | |
| US9385959B2 (en) | System and method for improving TCP performance in virtualized environments | |
| US20020078164A1 (en) | System and method for data transfer acceleration in a TCP network environment | |
| US8996718B2 (en) | TCP-aware receive side coalescing | |
| US10355997B2 (en) | System and method for improving TCP performance in virtualized environments | |
| US10798199B2 (en) | Network traffic accelerator | |
| CN103201989B (en) | The methods, devices and systems of control data transmission | |
| US10230563B2 (en) | Methods and first network node for managing a stream control transmission protocol association | |
| US10063444B2 (en) | Network traffic capture analysis | |
| US20230123387A1 (en) | Window-based congestion control | |
| US11271842B2 (en) | Enhancing transmission control protocol (TCP) performance and scalability on multicore processor architectures | |
| US20250286926A1 (en) | Data transmission method, apparatus, device, and system, and storage medium | |
| EP4496296A1 (en) | In-network collective operations | |
| CN116566914B (en) | Bypass TCP acceleration method, device, equipment and medium | |
| CN120378354A (en) | Communication transmission method, device and storage medium based on multipath delay optimization | |
| CN104836741B (en) | Method and processing board for realizing fragment message processing in network message distribution equipment | |
| WO2019243890A2 (en) | Multi-port data transmission via udp | |
| US20070291782A1 (en) | Acknowledgement filtering | |
| US11044350B1 (en) | Methods for dynamically managing utilization of Nagle's algorithm in transmission control protocol (TCP) connections and devices thereof | |
| Wang et al. | An optimized RDMA QP communication mechanism for hyperscale AI infrastructure | |
| US12438820B2 (en) | System and method for adaptive generic receive offload | |
| US20230208913A1 (en) | In-order streaming in-network computation | |
| Bakhshi | Evaluating Modern TCP Congestion Control Algorithms | |
| Wang et al. | Research on internet acceleration technology in high throughput satellite communication system |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant |