Packet loss detection method, device and equipment and computer readable storage medium
By sending TCP packet groups with non-sequential sequence numbers and receiving SACK, the problem of low packet loss detection accuracy in existing technologies is solved, and accurate packet loss detection and path location of end-to-end communication paths are achieved, improving the accuracy of packet loss rate calculation.
Patent Information
- Application Number
- CN202410605365.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-15
- Publication Date
- 2025-11-18
AI Technical Summary
Existing technologies struggle to accurately distinguish and detect packet loss paths in end-to-end communication, resulting in low accuracy in packet loss rate measurement and an inability to effectively locate packet loss paths and calculate packet loss rates on different paths.
By sending TCP packet groups with non-sequential sequence numbers and receiving selective acknowledgments (SACK), and combining the ACK and SACK field information, lost TCP packets and SACKs can be accurately identified, thus achieving packet loss detection.
It improves the accuracy and richness of packet loss detection, and can accurately distinguish the packet loss rate on the forward and backward paths, and realize the location of packet loss path and the calculation of packet loss rate.
Smart Images

Figure CN120979984A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communication technology, and in particular to packet loss detection methods, apparatus, devices, and computer-readable storage media. Background Technology
[0002] In the field of communication technology, information is transmitted between two devices by transmitting messages. During message transmission, due to network or device failures, messages may be lost during transmission; this phenomenon is called packet loss.
[0003] Packet loss detection on the communication path between two devices can determine the transmission quality of the communication path based on the packet loss detection results, and can promptly identify faulty paths with abnormalities based on the packet loss detection results, restore the fault, and ensure the communication quality between the two devices. Summary of the Invention
[0004] This application provides a packet loss detection method, apparatus, device, and computer-readable storage medium to achieve highly accurate packet loss detection. The technical solution is as follows:
[0005] Firstly, a packet loss detection method is provided, comprising: sending a first packet loss detection message group, the first packet loss detection message group consisting of at least three transmission control protocol (TCP) messages, each TCP message carrying a sequence number, the sequence number carried by each TCP message indicating the sequence number of the first byte in the data carried by each TCP message, wherein in any two adjacent TCP messages sent, the sequence number of the last byte in the data carried by the earlier TCP message and the sequence number of the first byte in the data carried by the later TCP message are not consecutive; receiving at least one selective acknowledgment (SACK) for the first packet loss detection message group; and performing packet loss detection based on the sequence number information carried by at least one SACK.
[0006] In this application, by sending at least three TCP packets with non-contiguous sequence numbers and receiving a SACK returned for each TCP packet, the received TCP packets, unreceived TCP packets, received SACKs, and unreceived SACKs can be accurately determined based on the sequence number information carried by at least one SACK, thereby accurately realizing packet loss detection.
[0007] In one possible implementation, at least three TCP packets include a first TCP packet, a second TCP packet, and a third TCP packet sent consecutively. The first TCP packet carries data with the sequence number n1 for the first byte and the sequence number m1 for the last byte. The second TCP packet carries data with the sequence number n2 for the first byte and the sequence number m2 for the last byte. The third TCP packet carries data with the sequence number n3 for the first byte and the sequence number m3 for the last byte.
[0008] Receiving at least one SACK for a first packet loss detection message group includes: receiving a first SACK for a third TCP message, wherein the sequence number information carried by the first SACK includes the sequence number carried by the third TCP message; performing packet loss detection based on the sequence number information carried by at least one SACK includes: in response to not receiving a second SACK for a second TCP message, performing packet loss detection based on whether the first SACK includes the sequence number carried by the second TCP message.
[0009] If a first SACK for a third TCP packet is received but a second SACK for a second TCP packet is not received, it means that the second TCP packet or the second SACK for the second TCP packet is lost. Based on the sequence number information carried by the first SACK, it can be further determined whether the lost packet is the second TCP packet or the second SACK, thus achieving highly accurate and detailed packet loss detection.
[0010] In one possible implementation, packet loss detection is performed based on whether the first SACK includes the sequence number carried by the second TCP packet, including: when the first SACK does not include the sequence number carried by the second TCP packet, determining that packet loss has occurred on the path that sent the second TCP packet; or, when the first SACK includes the sequence number carried by the second TCP packet, determining that packet loss has occurred on the path that received the second SACK.
[0011] If the first SACK does not include the sequence number carried by the second TCP packet, it means the second TCP packet was not received, and it can be determined that the second TCP packet was lost on the sending path. If the first SACK includes the sequence number carried by the second TCP packet, it means the second TCP packet has been received and was not lost; rather, the second SACK for the second TCP packet was not received, so it can be determined that the second SACK was lost. Therefore, this application can accurately detect packet loss by determining the lost packet and the path of packet loss based on the first SACK, even when the second SACK has not been received.
[0012] In one possible implementation, the packet to which the first SACK belongs includes the sequence number information and the acknowledgment number carried by the first SACK. The acknowledgment number is x+1, where x is the sequence number of the last byte in the data carried by the first received TCP packet. When the first SACK does not include the sequence number carried by the second TCP packet, it is determined that packet loss has occurred on the path for sending the second TCP packet. This includes determining that packet loss has occurred on the path for sending the second TCP packet when the first SACK does not include the sequence number carried by the second TCP packet and x is not equal to m2.
[0013] Since the second TCP packet may be the first TCP packet received by the receiver, the reception status of the second TCP packet may not be indicated by the first SACK, but by the acknowledgement number in the packet to which the first SACK belongs. Therefore, determining whether the second TCP packet is lost by combining the sequence number included in the first SACK and the value of the acknowledgement number in the packet to which the first SACK belongs can improve the accuracy of packet loss detection.
[0014] In one possible implementation, the length of the data carried by the second TCP packet is greater than the length of the data carried by the third TCP packet. In this application, the larger the data length carried by the TCP packet, the larger the TCP packet size and the greater the probability of loss; conversely, the smaller the data length carried by the TCP packet, the smaller the TCP packet size and the lower the probability of loss. The third TCP packet is smaller in size, making it less likely to be lost, and the probability of receiving a second SACK for the second TCP packet is higher. Therefore, the loss path of the second TCP packet or the second SACK can be determined by the sequence number information carried by the second SACK.
[0015] In one possible implementation, sending a first packet loss detection message group includes: sending multiple packet loss detection message groups, the multiple packet loss detection message groups including the first packet loss detection message group, each packet loss detection message group consisting of at least three TCP packets, and any two adjacent TCP packets sent in each packet loss detection message group being TCP segments with non-contiguous sequence numbers; performing packet loss detection based on sequence number information carried by at least one SACK, including: performing packet loss detection based on multiple SACKs received for the multiple packet loss detection message groups.
[0016] By sending multiple packet loss detection message groups and performing packet loss detection based on multiple received SACKs, the accuracy of packet loss detection can be improved, and the randomness of packet loss detection results can be avoided.
[0017] In one possible implementation, packet loss detection includes locating the packet loss path and / or calculating the packet loss rate. In this application, it is possible to locate the packet loss path and calculate the packet loss rate. Furthermore, based on the location of the packet loss path, it is possible to calculate the packet loss rate on different paths. The packet loss rate on different paths includes, but is not limited to, the forward packet loss rate on the path for sending TCP packets, the return packet loss rate on the path for receiving SACKs, and the bidirectional packet loss rate on both paths.
[0018] Secondly, a packet loss detection device is provided. This device is a first communication device, comprising: a sending module for sending a first packet loss detection message group, the first packet loss detection message group consisting of at least three Transmission Control Protocol (TCP) messages, each TCP message carrying a sequence number indicating the sequence number of the first byte in the data carried by each TCP message, wherein in any two adjacent TCP messages, the sequence number of the last byte in the data carried by the earlier TCP message and the sequence number of the first byte in the data carried by the later TCP message are not consecutive; a receiving module for receiving at least one SACK for the first packet loss detection message group; and a detection module for performing packet loss detection based on the sequence number information carried by at least one SACK.
[0019] In one possible implementation, at least three TCP packets include a first TCP packet, a second TCP packet, and a third TCP packet sent consecutively. The first TCP packet carries a data packet with the sequence number n1 for the first byte and the sequence number m1 for the last byte. The second TCP packet carries a data packet with the sequence number n2 for the first byte and the sequence number m2 for the last byte. The third TCP packet carries a data packet with the sequence number n3 for the first byte and the sequence number m3 for the last byte. A receiving module is used to receive a first SACK for the third TCP packet, wherein the sequence number information carried by the first SACK includes the sequence number carried by the third TCP packet. A detection module is used to perform packet loss detection in response to the absence of a second SACK for the second TCP packet, based on whether the first SACK includes the sequence number carried by the second TCP packet.
[0020] In one possible implementation, the detection module is configured to determine that packet loss has occurred on the path of sending the second TCP packet when the first SACK does not include the sequence number carried by the second TCP packet; or, when the first SACK includes the sequence number carried by the second TCP packet, determine that packet loss has occurred on the path of receiving the second SACK.
[0021] In one possible implementation, the packet to which the first SACK belongs includes the sequence number information carried by the first SACK and the acknowledgement number, where the acknowledgement number is x+1, and x is the sequence number of the last byte in the data carried by the first received TCP packet; the detection module is used to determine that packet loss has occurred on the path of sending the second TCP packet when the first SACK does not include the sequence number carried by the second TCP packet and x is not equal to m2.
[0022] In one possible implementation, the length of the data carried by the second TCP segment is greater than the length of the data carried by the third TCP segment.
[0023] In one possible implementation, a sending module is used to send multiple packet loss detection message groups, including a first packet loss detection message group, each packet loss detection message group consisting of at least three TCP packets, and any two adjacent TCP packets sent in each packet loss detection message group being TCP segments with non-contiguous sequence numbers; a detection module is used to perform packet loss detection based on the received multiple SACKs for the multiple packet loss detection message groups.
[0024] In one possible implementation, packet loss detection includes locating the packet loss path and / or calculating the packet loss rate.
[0025] Thirdly, a packet loss detection device is provided, the device including a processor coupled to a memory; the memory stores at least one instruction, which is loaded and executed by the processor to enable the packet loss detection device to implement the packet loss detection method in the first aspect and any possible implementation thereof.
[0026] Fourthly, a computer program (product) is provided, comprising: computer program code, which, when executed by a computer, causes the computer to perform the packet loss detection method described in the first aspect and any possible implementation thereof.
[0027] Fifthly, a computer-readable storage medium is provided that stores a program or instructions, wherein when the program or instructions are run on a computer, the packet loss detection method described in the first aspect and any possible implementation thereof is executed.
[0028] In a sixth aspect, a chip is provided, including a processor for calling and executing instructions stored in a memory, causing a computer equipped with the chip to execute the packet loss detection method described in the first aspect and any possible implementation thereof.
[0029] In a seventh aspect, another chip is provided, comprising: an input interface, an output interface, a processor, and a memory. The input interface, output interface, processor, and memory are connected via an internal connection path. The processor is used to execute code in the memory. When the code is executed, a computer with the chip installed executes the packet loss detection method in the first aspect and any possible implementation thereof.
[0030] It should be understood that the beneficial effects of the technical solutions and corresponding possible implementations of the second to seventh aspects of this application can be found in the above description of the technical effects of the first aspect and its corresponding possible implementations, and will not be repeated here. Attached Figure Description
[0031] Figure 1 This is a schematic diagram illustrating an implementation scenario of a packet loss detection method provided in an embodiment of this application.
[0032] Figure 2 An implementation scenario diagram of another packet loss detection method provided in this application embodiment;
[0033] Figure 3 A flowchart illustrating a packet loss detection method provided in an embodiment of this application;
[0034] Figure 4 A flowchart illustrating a SACK mechanism provided in an embodiment of this application;
[0035] Figure 5 This is a schematic diagram illustrating a scenario where no packet loss occurs, as provided in an embodiment of this application.
[0036] Figure 6 This is a schematic diagram illustrating a forward packet loss scenario provided in an embodiment of this application.
[0037] Figure 7 This is a schematic diagram illustrating a case of packet loss during return flow, provided in an embodiment of this application.
[0038] Figure 8 A schematic diagram illustrating the complete process of a packet loss detection method provided in an embodiment of this application;
[0039] Figure 9 This is a schematic diagram of the structure of a packet loss detection device provided in an embodiment of this application;
[0040] Figure 10 This is a schematic diagram of the structure of a packet loss detection device provided in an embodiment of this application. Detailed Implementation
[0041] The terminology used in the implementation section of this application is for the purpose of explaining specific embodiments of this application only, and is not intended to limit this application.
[0042] In the field of communication technology, various anomalies may occur during the operation of communication networks. Through various network detection methods, the operational status of the communication network can be determined in a timely manner, anomalies can be eliminated, and the normal operation of the communication network can be ensured. For example, by detecting network congestion, it can be determined whether congestion has occurred in the communication network; by locating network performance bottlenecks, nodes with abnormal performance within the communication network can be identified.
[0043] Packet loss measurement is also an important aspect of network testing. It determines the extent of data packet loss during communication and plays a crucial role in the compliance testing of critical network management functions. Critical network functions, such as anomaly detection, troubleshooting, and service-level agreements (SLAs), can identify anomalies based on data packet loss.
[0044] Packet loss measurement methods in the field of communication technology include passive measurement and active measurement. In passive measurement, measurement devices at both ends of the tested path observe network traffic along that path, determining the packet loss rate by comparing the number of received data packets with the number of sent data packets. In active measurement, a selected measurement point (measurement device) sends probe data packets to the measurement destination and receives data packets in response. By comparing the number of probe data packets sent by the measurement point with the number of data packets received from the destination, the packet loss rate of the link between the measurement point and the destination is determined.
[0045] Comparing active and passive measurement methods, active measurement requires injecting a large amount of probe streams into the path under test, introducing additional network load. Passive measurement, on the other hand, does not require injecting additional probe streams into the path under test, thus avoiding additional network load. However, passive measurement requires collecting a large amount of real-time streaming data along the path under test, which may lead to some data leakage. Therefore, most end-to-end packet loss measurements employ active measurement methods.
[0046] Active measurement methods include two-end measurement and single-end measurement. Two-end measurement can locate packet loss paths during packet loss measurement, but it requires deployment on both ends of the measurement device, resulting in high deployment costs. Furthermore, when the two ends of the measurement device belong to different operators, it is difficult for different operators to deploy the two ends of the measurement device in the same way, making two-end measurement difficult to implement.
[0047] Single-end measurement only requires deployment of a single-end device to perform the measurement, resulting in low deployment costs. However, it cannot pinpoint packet loss paths during packet loss measurement. For example, one related technology is a packet loss measurement scheme based on the Internet Control Message Protocol (ICMP) packet internet groper (Ping). The probe host, acting as the end with packet loss measurement capabilities, sends echo request packets to the target host and analyzes the echo response packets returned by the target host. This analysis assesses the network connectivity between the probe host and the target host, determining the bidirectional packet loss rate.
[0048] The implementation methods of related technologies include: 1. The probe host constructs an echo request packet based on the ICMP protocol. The main elements of the echo request packet include the source Internet Protocol (IP) address, the destination IP address, the sequence number, and the sending time; 2. After receiving the echo request packet sent by the probe host, the destination host also constructs an echo reply packet based on ICMP; 3. The probe host counts the number of received echo reply packets and the number of sent echo request packets to determine the bidirectional packet loss rate between the two hosts. The bidirectional packet loss rate is the ratio of the number of echo reply packets to the number of echo request packets.
[0049] In related technology one, if the probing host does not receive the echo response data packet b in response to the echo request data packet a, packet loss may occur in either the forward transmission path or the backward reply path. For example, if packet loss occurs in the forward transmission path, the echo request data packet a is lost on the forward transmission path to the destination host, and the destination host does not receive the echo request data packet a, thus not sending the echo response data packet b to the probing host, resulting in the probing host not receiving the echo response data packet b. Conversely, if the destination host receives the echo request data packet a and returns the echo response data packet b to the probing host in response to the echo request data packet a, but the echo response data packet b is lost on the backward reply path to the probing host, the probing host will also fail to receive the echo response data packet b.
[0050] Therefore, the packet loss rate measured by related technology one is a two-way packet loss rate, which can reflect the total packet loss situation of the round-trip path. However, the round-trip path of end-to-end communication is usually asymmetrical, so related technology one cannot distinguish whether packet loss occurs in the forward transmission path or the backward response path, and the accuracy of the packet loss rate measured by related technology one is low.
[0051] This application provides a packet loss detection method that can determine the occurrence path of end-to-end packet loss and determine the packet loss rate on different paths, thereby improving the richness and accuracy of packet loss detection.
[0052] See Figure 1 This illustration shows an implementation scenario of a packet loss detection method provided in this application. The implementation scenario includes a first communication device 11 and a second communication device 12, which can establish a communication connection via wired or wireless means. Optionally, the connection between the first communication device 11 and the second communication device 12 can be a TCP connection, through which TCP packets can be transmitted. This application does not limit the types of the first communication device 11 and the second communication device 12. For example, the first communication device 11 and the second communication device 12 can be devices, chips on devices, or modules, etc., and the types of the first communication device 11 and the second communication device 12 can be the same or different.
[0053] See Figure 2 This diagram illustrates an implementation scenario of another packet loss detection method provided in this application. The implementation scenario includes an application server, router, gateway, campus switch, and terminal. In this scenario, the application server can be various types of servers deployed in a public cloud or a data center built by the application vendor. The software layout model of the application server can be Software as a Service (SaaS), under which the application server can handle traffic uploaded by users through the terminal or respond to requests uploaded by the terminal. For example, the application server can store content uploaded by the terminal through a cloud drive, or if the application server is an audio / video server, it can forward audio and video streams uploaded by the terminal, and can also download videos from content providers through a video player.
[0054] In this implementation scenario, the gateway can be of various types, such as an access router (AR). The gateway possesses a TCP protocol stack, enabling it to independently write and send TCP packets, providing Layer 3 interface services for accessing the wide area network (WAN), and providing packet forwarding functions for both the local area network (LAN) and the WAN. The gateway communicates with the application server through one or more routers (such as…). Figure 2 The gateway can also connect to the campus switch. (Router 1, Router 2 and Router 3 in the system)
[0055] The campus switch allows terminal devices to access the network, aggregates all campus traffic, and provides an uplink for traffic transmission to the gateway. Terminals can be of various types, such as mobile terminals and personal computers as shown in the diagram. The terminal can be a computer with application clients installed, and it can function as a data transceiver and a data source for uplink traffic in this implementation scenario.
[0056] The packet loss detection method provided in this application embodiment can be executed by a first communication device, which may be a first communication device. Figure 2 Devices such as gateways in the system. See also Figure 3 The diagram shows a flowchart of a packet loss detection method provided in an embodiment of this application, which includes, but is not limited to, the following steps S301-S303.
[0057] S301, Send the first packet loss detection message group. The first packet loss detection message group consists of at least three Transmission Control Protocol (TCP) messages. Each TCP message carries a sequence number, which indicates the sequence number of the first byte in the data carried by each TCP message. In any two adjacent TCP messages, the sequence number of the last byte in the data carried by the earlier TCP message and the sequence number of the first byte in the data carried by the later TCP message are not consecutive.
[0058] In one possible implementation, the embodiments of this application can be based on the SACK mechanism. Therefore, before introducing the packet loss detection method provided by the embodiments of this application, the SACK mechanism will be explained first.
[0059] The SACK mechanism is based on TCP. The sequence number (SEQ) field in the TCP header contains the sequence number carried by the TCP segment, representing the sequence number of the first byte in the TCP segment's data. The TCP segment length (TCP segment LEN) field in the TCP header contains the length of the data carried by the TCP segment, or the number of bytes. Combining the values of the SEQ and LEN fields in the TCP segment, we can determine the sequence number of the last byte in the TCP segment's data.
[0060] For example, if the value of the SEQ field in a TCP segment is 0 and the value of the TCP segment LEN field is 16, it means that the TCP segment carries a total of 16 bytes of data, with the first byte having a sequence number of 0 and the last byte having a sequence number of 15.
[0061] After the sender sends a TCP segment to the receiver, the receiver can return a TCP segment to the sender to indicate that it has received the TCP segment sent by the sender. If the sequence numbers of the bytes in multiple TCP segments received by the receiver are consecutive, the receiver can return a TCP segment to the sender after receiving each TCP segment, or the receiver can return a TCP segment to the sender after receiving multiple TCP segments.
[0062] The TCP segment returned by the receiver to the sender includes an acknowledgment (ACK) field. The value in the ACK field is the acknowledgment number, which is the sequence number of the last byte in the data carried by the received TCP segment, plus 1. For example, if the sequence number of the last byte in the received TCP segment is 199, the value in the ACK field of the returned TCP segment will be 200, indicating that the segment including bytes with sequence number 199 and preceding byte has been received. After receiving the TCP segment returned by the receiver, the sender uses the value in the ACK field of the returned TCP segment to determine whether the receiver has received the TCP segment.
[0063] If the sequence number of the first byte in the data carried by the TCP segment currently received by the receiver is not consecutive to the sequence number of the last byte in the data carried by the TCP segment previously received by the receiver, the receiver will immediately return a TCP segment to the sender, carrying the SACK option (or simply SACK) in the TCP segment. SACK is used to indicate that the receiver has received a segment with a non-consecutive sequence number.
[0064] SACK includes the sequence number of the first byte of data carried in the currently received TCP segment and the sequence number connected to the sequence number of the last byte of data carried in the TCP segment. The sequence number of the first byte of data carried in the currently received TCP segment is located in the sequence left edge (SLE) field of the TCP header, and the sequence number connected to the sequence number of the last byte of data carried in the currently received TCP segment is located in the sequence right edge (SRE) field of the TCP header.
[0065] See Figure 4This diagram illustrates a flowchart of a SACK mechanism provided in an embodiment of this application. The sender sends TCP segment 1, containing bytes with sequence numbers 100-199, to the receiver. After receiving TCP segment 1, the receiver stores it in its receive buffer and sends reply message 1 back to the sender. Reply message 1 is the TCP segment returned by the receiver to the sender. The ACK field in reply message 1 contains a value of 200, indicating that the receiver has received TCP segments with sequence numbers 100-199, and the next byte to be received has a sequence number of 200.
[0066] The sender sends TCP packet 2 containing bytes with sequence numbers 200-299 to the receiver. However, due to network failure or other reasons, TCP packet 2 is lost on the forward path to the receiver, resulting in the receiver not receiving TCP packet 2. Therefore, the receiver does not send a reply message 2 back to the sender.
[0067] The sender sends TCP segment 3, containing bytes with sequence numbers 300-399, to the receiver. Upon receiving TCP segment 3, the receiver stores it in its receive buffer. The receiver recognizes that the sequence number of the first byte of TCP segment 3 is not consecutive to the sequence number of the last byte of TCP segment 1. Therefore, in the reply message 3 returned to the sender, the ACK field value remains 200, while the SACK option values are 300 and 400. The combined values of the ACK field and the SACK option indicate that the receiver should have received bytes starting with sequence number 200, but instead received bytes with sequence numbers 300-399. Furthermore, the sequence number of the next byte consecutive to the last received byte with sequence number 399 should be 400.
[0068] The sender continues to send TCP segment 4, containing bytes with sequence numbers 400-499, to the receiver. After receiving TCP segment 4, the receiver stores it in its receive buffer. Since the receiver has still not received the byte with sequence number 200, and the sequence numbers of all received bytes remain discontinuous, the ACK field in the receiver's reply message 4 is still 200, while the SACK option values are 300 and 500. The combined values of the ACK field and the SACK option indicate that the receiver should have received bytes starting with sequence number 200, but instead received bytes with sequence numbers 300-499. Furthermore, the sequence number of the next byte consecutively following the last received byte with sequence number 499 should be 500.
[0069] Through the Figure 4As can be seen from the description, if the receiver supports the SACK mechanism, when the receiver receives a packet with a non-contiguous sequence number, it will use the ACK and SACK fields to send back the sequence number of the received byte and the sequence number of the missing byte to the sender. This allows the sender to determine whether the sent TCP packet has been received by the receiver based on the reply message from the receiver.
[0070] Furthermore, the path of packet loss can be determined through SACK's related mechanisms. For example, please see [link to relevant documentation]. Figure 4 If the reply message 3 from the receiver is lost on the return path to the sender, the sender will not receive reply message 3 and cannot determine whether the receiver received TCP packets 2 and 3. However, if the sender receives reply message 4 from the receiver, it can be determined that the receiver did not receive TCP packet 2, but received TCP packets 3 and 4. Therefore, it can be determined that TCP packet 2 was lost on the forward path, while reply message 3 was lost on the return path.
[0071] In other words, by sending multiple reply messages carrying the ACK field and the SACK option, the sender can determine each TCP packet received by the receiver, as well as the TCP packets lost on the forward path and the reply messages lost on the return path. Therefore, the sender can accurately determine the forward packet loss rate from the sender to the receiver and the return packet loss rate from the receiver to the sender.
[0072] In this embodiment, packet loss detection based on the SACK mechanism enables more accurate and detailed packet loss detection results. In S301, before the first communication device sends the first packet loss detection message group, the first packet loss detection message group can be constructed based on the packet loss detection requirements. This allows the second communication device to respond to each TCP packet in the received first packet loss detection message group by sending the first packet loss detection message group, thereby achieving accurate packet loss detection.
[0073] For example, the first packet loss detection message group can also be called the first probe message group or the first probe packet. The first packet loss detection message group contains at least three TCP packets, including a first TCP packet, a second TCP packet, and a third TCP packet sent consecutively. The first byte of data carried in the first TCP packet has a sequence number of n1, and the last byte of data carried in the first TCP packet has a sequence number of m1; the first byte of data carried in the second TCP packet has a sequence number of n2, and the last byte of data carried in the second TCP packet has a sequence number of m2; the first byte of data carried in the third TCP packet has a sequence number of n3, and the last byte of data carried in the third TCP packet has a sequence number of m3.
[0074] Where n2 is not equal to m1+1 and n3 is not equal to m2+1, the sequence number of the last byte in the data carried by the earlier TCP packet and the sequence number of the first byte in the data carried by the later TCP packet are not consecutive. The sequence number interval between the last byte in the data carried by the earlier TCP packet and the first byte in the data carried by the later TCP packet is N, which can be an integer greater than or equal to 1. The value of N can be determined according to the accuracy of packet loss detection or can be specified based on experience. The N between different adjacent packets can be the same or different.
[0075] In this embodiment, the second TCP message can also be called an observation message or observation packet, and the first and third TCP messages can also be called decision messages or decision packets. In this embodiment, the validity of each packet loss detection message group can be determined by determining whether the observation messages in each packet loss detection message group are lost, and by determining whether the decision messages in each packet loss detection message group are lost. Valid packet loss detection message groups can be used for packet loss path detection and packet loss rate detection, instead of performing packet loss path detection and packet loss rate detection on invalid packet loss detection message groups.
[0076] Based on the preceding explanation of the SACK mechanism, the SACK returned by the second communication device for any received TCP packet includes the sequence numbers carried by one or more TCP packets currently received by the second communication device. Furthermore, the sequence number included in the SACK returned by the second communication device for any given TCP packet can be used to determine the reception status of the previous TCP packet sent by the first communication device to the second communication device.
[0077] Since the third TCP packet is sent after the second TCP packet in the first packet loss detection packet group, the first communication device can not only determine the reception status of the second TCP packet through the SACK returned by the second communication device for the second TCP packet, but also more accurately determine the reception status of the second TCP packet and whether the SACK returned for the second TCP packet is lost through the SACK returned by the second communication device for the third TCP packet.
[0078] Therefore, in this embodiment, it is necessary to control the loss probability of the third TCP packet to be small and less than that of the second TCP packet, so as to accurately determine the reception status of the second TCP packet and whether the SACK returned by the second communication device for the third TCP packet is lost based on the SACK returned for the third TCP packet. This embodiment does not limit the method for controlling the loss probability of the second and third TCP packets. In some cases, the larger the packet size, the greater the probability of loss during transmission. Therefore, in this embodiment, the loss probability of the second and third TCP packets can be controlled by controlling their sizes. Optionally, the size of the second and third TCP packets can be controlled by controlling the length of the data carried by the second and third TCP packets. Thus, the length of the data carried by the second TCP packet can be greater than the length of the data carried by the third TCP packet, thereby making the size of the second TCP packet larger than that of the third TCP packet, and thus making the loss probability of the second TCP packet greater than that of the third TCP packet.
[0079] For example, the length of the data carried by the third TCP packet can be 100, and the length of the data carried by the second TCP packet can be 900, so that the size of the second TCP packet in the first packet loss detection packet group is greater than the size of the third TCP packet.
[0080] In one possible implementation, if the size of the third TCP packet is small enough, it can be considered a packet that is not easily lost. Furthermore, when constructing the second TCP packet, specific service-related information can be added to it, making the second TCP packet more consistent with the characteristics of packets in the actual service flow transmitted along the transmission path. This results in a more realistic and accurate packet loss rate determined based on the loss of the second TCP packet.
[0081] In this embodiment, the first packet loss detection message group further includes a first TCP message. The first TCP message is sent before the second TCP message. The length of the data carried by the first TCP message can be shorter than the length of the data carried by the second TCP message. The length of the data carried by the first TCP message can be the same as or different from the length of the data carried by the third TCP message. In this embodiment, the total number of the second TCP message, the third TCP message, and the first TCP message can be the ratio of the number of bytes used to carry the sequence number in any SACK to the number of bytes occupied by any sequence number, such that the SACK returned by the second communication device for the third TCP message includes the sequence numbers carried by each TCP message in the first packet loss detection message group received by the second communication device.
[0082] For example, if the ratio of the number of bytes that can carry sequence numbers in SACK to the number of bytes occupied by any sequence number is 3, then the total number of the second TCP packet, the third TCP packet, and the first TCP packet is 3. If the ratio of the number of bytes that can carry sequence numbers in SACK to the number of bytes occupied by any sequence number is 4, then the total number of the second TCP packet, the third TCP packet, and the first TCP packet is 4. Optionally, in this embodiment, the number of the second TCP packet and the third TCP packet can be fixed at 1, and the number of the first TCP packet can be adaptively adjusted according to the size of this ratio.
[0083] The number of bytes that can carry sequence numbers in SACK can be the total number of bytes in the options field of the TCP packet header used to carry sequence numbers. For example, if the total number of bytes in the options is 40, but 10 bytes are used to carry timestamps, then the number of bytes that can carry sequence numbers in the SACK of that TCP packet is 30. If any sequence number occupies 10 bytes, then the ratio of the number of bytes that can carry sequence numbers in SACK to the number of bytes occupied by any single sequence number is 3.
[0084] If the first packet loss detection packet group includes three TCP packets, then the first packet loss detection packet group can be represented as Decision Packet 1 - Observation Packet - Decision Packet 2; if the first packet loss detection packet group includes four TCP packets, then the first packet loss detection packet group can be represented as Decision Packet 0 - Decision Packet 1 - Observation Packet - Decision Packet 2.
[0085] In this embodiment, since the total number of packets in the first packet loss detection packet group is equal to the number of sequence numbers that can be carried in the SACK, when no packet loss has occurred, the SACK returned for the last TCP packet in the first packet loss detection packet group includes the sequence numbers carried by each TCP packet in the first packet loss detection packet group; conversely, if the SACK returned for the last TCP packet in the first packet loss detection packet group does not include the sequence numbers carried by each TCP packet in the first packet loss detection packet group, it indicates that packet loss has occurred. Therefore, ensuring that the total number of TCP packets in the first packet loss detection packet group is equal to the number of sequence numbers that can be carried in the SACK facilitates the confirmation of packet loss.
[0086] In other words, for any TCP packet other than the first TCP packet sent by the first communication device, in the absence of packet loss, the SACK returned by the second communication device contains multiple SACKs that carry the sequence number carried by any TCP packet, and the number of SACKs that include the sequence number carried by the TCP packet is the same as the maximum number of sequence numbers carried by the currently received TCP packets that can be carried in the SACK.
[0087] Taking any TCP packet as the seventh TCP packet sent by the first communication device to the second communication device, and the SACK returned by the second communication device including at most three sequence numbers carried by the currently received packets as an example, when the second communication device receives the seventh TCP packet sent by the first communication device, the returned SACK includes the sequence number carried by the fifth TCP packet, the sequence number carried by the sixth TCP packet, and the sequence number carried by the seventh TCP packet received by the second communication device.
[0088] When the second communication device receives the eighth TCP packet sent by the first communication device, the returned SACK includes the sequence number carried by the sixth TCP packet, the sequence number carried by the seventh TCP packet, and the sequence number carried by the eighth TCP packet received by the second communication device.
[0089] When the second communication device receives the ninth TCP packet sent by the first communication device, the returned SACK includes the sequence number carried by the seventh TCP packet, the sequence number carried by the eighth TCP packet, and the sequence number carried by the ninth TCP packet received by the second communication device.
[0090] When the second communication device receives the tenth TCP packet sent by the first communication device, the returned SACK includes the sequence number carried by the eighth TCP packet, the ninth TCP packet, and the tenth TCP packet. Therefore, the number of SACKs including the sequence number carried by the seventh TCP packet is three, which is the same as the maximum number of sequence numbers that a SACK can carry from currently received TCP packets.
[0091] Therefore, when performing packet loss detection using the first packet loss detection message group constructed according to the embodiments of this application, since the total number of TCP packets in the first packet loss detection message group is equal to the maximum number of sequence numbers that can be carried in any SACK, if the SACK for the third TCP packet does not include the sequence numbers carried by each packet in the first packet loss detection message group, it can be accurately determined that packet loss has occurred, and the packet loss detection result is accurate.
[0092] In one possible implementation, sending the first packet loss detection message group includes: sending multiple packet loss detection message groups, the multiple packet loss detection message groups including the first packet loss detection message group, each packet loss detection message group consisting of at least three TCP packets, and any two adjacent TCP packets sent in each packet loss detection message group being TCP segments with non-sequential sequence numbers.
[0093] For example, the first communication device can construct a detection stream for packet loss detection. The detection stream includes multiple packet loss detection message groups. The construction method of the multiple packet loss detection message groups can refer to the construction method of the first packet loss detection message group, and will not be repeated here. In any two packet loss detection message groups with adjacent transmission order in the detection stream, the sequence number between the last byte of the data carried by the last TCP message in the earlier sent packet loss detection message group and the sequence number of the first byte of the data carried by the first TCP message in the earlier sent packet loss detection message group is not consecutive, and the interval is M. M can be an integer greater than or equal to 1. The value of M can be determined according to the accuracy of packet loss detection, or it can be specified based on experience. The value of M can be the same as or different from the value of N.
[0094] Optionally, when sending the various packet loss detection message groups in the detection stream, the packet loss detection message groups can be sent continuously or intermittently at a specified frequency. The specified frequency can be positively correlated with the detection accuracy of packet loss. For example, if the detection stream includes packet loss detection message group 1 and packet loss detection message group 2, when sending the detection stream, after sending each TCP packet in packet loss detection message group 1, each TCP packet in packet loss detection message group 2 is sent.
[0095] In one possible implementation, the first communication device and the second communication device communicate based on a TCP connection. Therefore, the first communication device can establish a TCP connection with the second communication device before sending the detection stream. For example, the first and second communication devices can establish a TCP connection through a three-way handshake. The first communication device sends a TCP packet to the second communication device, completing the first handshake. The synchronization (SYN) flag in the TCP packet is set to 1, and the value of the SEQ field in the TCP packet is a randomly generated value x.
[0096] After receiving the TCP packet, the second communication device determines that the first communication device is requesting to establish a TCP connection based on the SYN flag being set to 1. The second communication device then returns a TCP packet to the first communication device, indicating that the second communication device agrees to establish a TCP connection with the first communication device, thus completing the second handshake between the two devices. In this TCP packet, both the SYN flag and ACK flag are set to 1, the ACK value is x+1, and the SEQ value is a randomly generated value y.
[0097] After receiving the TCP packet sent by the second communication device, the first communication device sends another TCP packet to the second communication device. In this new TCP packet, the ACK flag is set to 1, and the ACK value is y+1. Upon receiving this second TCP packet from the first communication device, the TCP connection between the two devices is successfully established. Both devices then enter the ESTABLISHED state, completing the three-way handshake.
[0098] After the TCP connection between the first communication device and the second communication device is established, the first communication device and the second communication device can communicate based on the TCP connection. The first communication device can send each packet loss detection message group in the detection stream to the second communication device through the TCP connection. The second communication device can also return each SACK to the first communication device based on the TCP packets in the received packet loss detection message groups, so that the first communication device can determine the reception status of the second communication device for multiple TCP packets.
[0099] S302, receive at least one SACK for the first packet loss detection message group.
[0100] After the second communication device returns at least one SACK to the first communication device according to the above description, the first communication device can store the at least one SACK for subsequent packet loss detection. This application embodiment does not limit the method by which the first communication device stores the at least one SACK. For example, the first communication device can store the at least one SACK in the storage space according to the order in which it receives the at least one SACK.
[0101] In one possible implementation, each of the at least three TCP packets also carries the length of the data carried in each TCP packet. The SACK corresponding to each TCP packet then includes the sequence number and termination number carried by the TCP packet. The termination number is the sum of the sequence number and the length of the data carried by the TCP packet. The sequence number is the value of the SLE field in the SACK above, and the termination number is the value of the SRE field in the SACK above.
[0102] In one possible implementation, the third TCP packet is small and not easily lost. Therefore, if the third TCP packet is lost on the forward path between the first and second communication devices, it may be due to instability or failure of the forward path. In some cases, packet loss detection performed when the forward path between the first and second communication devices is unstable is not representative or universal. Therefore, if the third TCP packet in the packet loss detection packet group is lost on the forward path, the packet loss detection packet group can be identified as an invalid packet loss detection packet group, and when the first communication device performs packet loss detection, the invalid packet loss detection packet group will no longer be considered as a lost packet loss detection packet group.
[0103] If the third TCP packet within the packet loss detection packet group is not lost on the forward path, it indicates that the forward path from the first communication device to the second communication device is stable, and the packet loss detection packet group can be considered a valid packet loss detection packet group. Valid packet loss detection packet groups include packet loss detection packet groups that are not lost, packet loss detection packet groups lost on the forward path, and packet loss detection packet groups lost on the return path. Packet loss detection packet groups lost on the forward path and packet loss detection packet groups lost on the return path are both packet loss detection packet groups that have been lost.
[0104] As explained above, for the first packet loss detection packet group, packet loss detection can be performed by determining whether the second TCP packet is lost and whether the SACK for the second TCP packet is lost. Determining whether the second TCP packet is lost and whether the SACK for the second TCP packet is lost requires the sequence number information carried by the SACK for the third TCP packet. Therefore, in this embodiment, receiving at least one selective acknowledgment (SACK) for the first packet loss detection packet group includes receiving a first SACK for the third TCP packet, where the sequence number information carried by the first SACK includes the sequence number carried by the third TCP packet. Upon receiving the first SACK for the third TCP packet, the first packet loss detection packet group is considered a valid packet loss detection packet group, and packet loss detection can continue for the first packet loss detection packet group.
[0105] S303 performs packet loss detection based on the sequence number information carried by at least one SACK.
[0106] Packet loss detection includes locating the packet loss path and / or calculating the packet loss rate. The packet loss rate includes the forward packet loss rate on the path for sending TCP packets, the return packet loss rate on the path for receiving SACKs, and the bidirectional packet loss rate across both paths. In this embodiment, packet loss detection can be performed on a per-packet-loss-detection-packet-group basis. That is, packet loss in this embodiment refers to the loss of a packet loss-detection-packet-group.
[0107] Taking packet loss detection of the first packet loss detection message group as an example, when a first SACK for a third TCP packet is received, packet loss detection is performed based on the sequence number information carried by at least one SACK, including: in response to not receiving a second SACK for a second TCP packet, packet loss detection is performed based on whether the first SACK includes the sequence number carried by the second TCP packet.
[0108] For example, packet loss detection is performed based on whether the first SACK includes the sequence number carried by the second TCP packet, including: when the first SACK does not include the sequence number carried by the second TCP packet, determining that packet loss has occurred on the path of sending the second TCP packet; or, when the first SACK includes the sequence number carried by the second TCP packet, determining that packet loss has occurred on the path of receiving the second SACK.
[0109] For example, see Figure 5 This diagram illustrates a scenario where no packet loss occurs, as provided in this application. A first communication device sends a first TCP packet to a second communication device, the first TCP packet including bytes with sequence numbers 0-99. The first communication device then continues to send a second TCP packet to the second communication device, the second TCP packet including bytes with sequence numbers 199-999. After receiving the second TCP packet, the second communication device returns a SACKb to the first communication device. Since the second TCP packet is the second packet received by the second communication device, and the sequence number of the first byte in the second TCP packet is not consecutive to the sequence number of the last byte in the first TCP packet, SACKb includes the sequence number 199 and the termination number 1000 carried in the second TCP packet currently received by the second communication device.
[0110] The first communication device continues to send a third TCP packet to the second communication device. The third TCP packet includes bytes with sequence numbers 1099-1198. After receiving the third TCP packet, the second communication device returns a SACKc to the first communication device. Since the third TCP packet is the third packet received by the second communication device, and the sequence number of the first byte in the third TCP packet is not consecutive to the sequence numbers of the last bytes in the first and second TCP packets, the SACKc includes the sequence number 199 and termination number 1000 carried in the second TCP packet currently received by the second communication device, and the sequence number 1099 and termination number 1199 carried in the third TCP packet.
[0111] The first communication device determines, by the sequence number included in each SACK received, that both the second TCP packet and the third TCP packet sent by the first communication device have been received by the second communication device. Therefore, the first communication device can determine that no packet loss occurred during this communication between the first communication device and the second communication device.
[0112] See Figure 6 The diagram illustrates a forward packet loss scenario provided in an embodiment of this application. Figure 6 The situation shown is the same as Figure 5 The difference between the situations shown is: Figure 6 The second TCP packet sent by the first communication device to the second communication device was lost on the forward path to the second communication device. The second communication device did not receive the second TCP packet and therefore did not return a SACKb to the first communication device based on it. However, the second communication device received a third TCP packet sent by the first communication device. The sequence numbers of the bytes in the two packets received by the second communication device are 0-99 and 1099-1198, respectively. Therefore, the SACKc returned by the second communication device to the first communication device for the third TCP packet includes the sequence number 1099 and the termination number 1199 of the third TCP packet, indicating that the sequence number of the first byte in the third TCP packet received by the second communication device is not consecutive to the sequence number of the last byte of the first TCP packet received.
[0113] SACKc includes the sequence number carried by the third TCP packet but not the sequence number carried by the second TCP packet. Therefore, at least one SACK received by the first communication device includes the first SACK but not the second SACK. The first communication device can determine that the second communication device has received the third TCP packet and the first TCP packet, but has not received the second TCP packet. Thus, it can be determined that the second TCP packet was lost on the forward path from which it was sent. Therefore, it can be determined that the first packet loss detection packet group to which the second TCP packet belongs has experienced packet loss, and the packet loss path is the forward path.
[0114] See Figure 7 The diagram illustrates a case of packet loss during a return journey, as provided in an embodiment of this application. Figure 7 and Figure 5 The difference lies in the fact that the SACKb returned by the second communication device for the second TCP packet is lost on the return path to the first communication device. However, since the second communication device received the second TCP packet, after receiving the third TCP packet, the SACKc returned by the second communication device for the third TCP packet carries not only the sequence number of the third TCP packet but also the sequence number of the second TCP packet. Therefore, the first communication device can determine that the second communication device received the second TCP packet, but the SACKb returned by the second communication device for the second TCP packet is lost on the return path of the first communication device receiving the SACKb.
[0115] In one possible implementation, the message to which the first SACK belongs includes the sequence number information carried by the first SACK and the acknowledgement number, where the acknowledgement number is x+1, and x is the sequence number of the last byte in the data carried by the first received TCP message; therefore, when the first SACK does not include the sequence number carried by the second TCP message, determining that the path for sending the second TCP message has lost packets may also include: when the first SACK does not include the sequence number carried by the second TCP message and x is not equal to m2, determining that the path for sending the second TCP message has lost packets.
[0116] like Figures 5-7 As shown, since the first TCP packet is the first packet sent by the first communication device and received by the second communication device, the acknowledgement number in the ACK field of the packets to which SACKb and SACKc belong is 100, indicating that the second communication device has received the first TCP packet including bytes with sequence numbers 0-99.
[0117] Since the first packet loss detection message group may be the first packet loss detection message group sent by the first communication device to the second communication device, and the first TCP packet may be lost on the forward path to the second communication device, the second TCP packet may be the first TCP packet received by the second communication device. In this case, even if the second communication device receives the second TCP packet, the first SACK returned for the third TCP packet may not include the sequence number carried by the second TCP packet. Therefore, whether the acknowledgement number in the packet to which the first SACK belongs is the sequence number of the last byte carried by the second TCP packet + 1 determines whether the second TCP packet was lost on the forward path.
[0118] If the first SACK does not include the sequence number carried by the second TCP packet and x is not equal to m2, it can be determined that the second communication device has not received the second TCP packet. However, if the first SACK does not include the sequence number carried by the second TCP packet but x is equal to m2, it can be determined that the second communication device has received the second TCP packet, and the second TCP packet is the first TCP packet received by the second communication device.
[0119] The above describes the process of determining the packet loss path based on the first packet loss detection group. In this embodiment, packet loss detection can be achieved by sending multiple packet loss detection message groups. Therefore, packet loss detection based on the sequence number information carried by at least one SACK can include: performing packet loss detection based on multiple SACKs received for multiple packet loss detection message groups. The process of performing packet loss detection based on multiple SACKs received for multiple packet loss detection message groups can refer to the process of performing packet loss detection based on at least one SACK for the first packet loss detection message group, and will not be elaborated further here.
[0120] After determining whether each packet loss detection message group is lost and the packet loss path of the lost packet loss detection message group according to the above method, the first communication device can also determine the forward packet loss rate on the forward path and the return packet loss rate on the return path.
[0121] For example, the number of packet loss detection packets lost on the forward path and the number of invalid packet loss detection packets can be determined based on the sequence numbers included in multiple SACKs and the sequence numbers carried by multiple TCP packets. The forward packet loss rate is determined by the ratio between the number of packet loss detection packets lost on the forward path and the number of valid packet loss detection packets. The number of valid packet loss detection packets is the difference between the number of at least one packet loss detection packet group and the number of invalid packet loss detection packets.
[0122] In other words, the forward packet loss rate = number of forward lost packet groups / total number of probe packet groups, where the number of forward lost packet groups is the number of lost packet detection packets lost in the forward direction, and the total number of probe packet groups is the total number of valid lost packet detection packets. For example, if the number of forward lost packet detection packets is 10 and the number of valid lost packet detection packets is 100, then the return packet loss rate is 10%.
[0123] In this embodiment, the criterion for determining a packet loss detection packet group as invalid is: the sequence number carried by the third TCP packet within the invalid packet loss detection packet group is not present in at least one sequence number included in a SACK. Based on the foregoing explanation, in the absence of packet loss, for any TCP packet, there are multiple SACKs that include the sequence number carried by that packet. Alternatively, even if some SACKs including the sequence number carried by the TCP packet are lost on the return path to the first communication device, as long as one SACK includes the sequence number carried by the TCP packet, it can be determined that the TCP packet has been received by the second communication device. If none of the sequence numbers included in the SACKs returned by the second communication device contain the sequence number carried by the TCP packet, it can be determined that the TCP packet was not received by the second communication device, and therefore it can be determined that the TCP packet was lost on the forward path to the second communication device.
[0124] In one possible implementation, the fact that at least one SACK received by the first communication device does not include the sequence number carried by any TCP segment could also be due to consecutive return packet losses. Since the number of SACKs that include the sequence number carried by any TCP segment is limited, if the number of consecutive packet losses exceeds the number of sequence numbers carried by TCP segments that a SACK can include, then at least one SACK may also not include the sequence number carried by that TCP segment.
[0125] Therefore, in this embodiment of the application, if the sequence number carried by the third TCP packet in any packet loss detection packet group does not exist in the sequence number included in at least one SACK received by the first communication device, regardless of whether continuous back-end packet loss occurs or the third TCP packet is lost on the forward path, the packet loss detection packet group including the third TCP packet can be determined as an invalid packet loss detection packet group.
[0126] By using the aforementioned method, it is determined whether each packet loss detection packet group is a packet loss detection packet group lost on the forward path, thereby determining the number of packet loss detection packet groups lost on the forward path and the number of valid packet loss detection packet groups. This allows for an accurate determination of the forward packet loss rate on the forward path, resulting in a more precise and detailed determination of the packet loss rate.
[0127] Accordingly, after the first communication device performs packet loss detection based on the sequence numbers included in the multiple SACKs and the sequence numbers carried in the multiple TCP packets, it may further include: determining, based on the sequence numbers included in the multiple SACKs and the sequence numbers carried in the multiple TCP packets, the number of packet loss detection packet groups lost on the return path and the number of invalid packet loss detection packet groups, wherein the invalid packet loss detection packet groups are the packet loss detection packet groups lost in the third TCP packet; and determining the return packet loss rate as the ratio between the number of packet loss detection packet groups lost on the return path and the number of valid packet loss detection packet groups, wherein the number of valid packet loss detection packet groups is the difference between the number of at least one packet loss detection packet group and the number of invalid packet loss detection packet groups.
[0128] In other words, the return packet loss rate = number of lost return packet groups / total number of probe packet groups, where the number of lost return packet groups is the number of lost packet detection packets lost on the return path, and the total number of probe packet groups is the total number of valid lost packet detection packets. For example, if the number of lost packet detection packets lost on the return path is 3, and the number of valid lost packet detection packets is 100, then the return packet loss rate is 3%.
[0129] In this application, the method described above is used to determine whether each packet loss detection packet group is a packet loss detection packet group lost on the return path, to determine the number of packet loss detection packet groups lost on the return path, and to determine the number of valid packet loss detection packet groups, thereby accurately determining the return packet loss rate on the return path, making the determined packet loss rate more accurate and detailed.
[0130] Optionally, the first communication device can also determine the number of packet loss detection packets lost on the two paths and the number of invalid packet loss detection packets in the multiple packet loss detection packet groups based on the sequence numbers included in the multiple SACKs and the sequence numbers carried by the multiple TCP packets; and determine the bidirectional packet loss rate as the ratio between the number of packet loss detection packets lost on the two paths and the number of valid packet loss detection packets.
[0131] In one possible implementation, since the number of probe packets consisting of a packet loss detection packet group and a SACK is the same as the number of packet loss detection packets, the forward packet loss rate and the return packet loss rate can also be calculated based on the number of probe packets.
[0132] Therefore, the packet loss detection method provided in this application can solve the problem of not being able to distinguish the path where packet loss occurs, and can calculate the forward packet loss rate on the forward path and the return packet loss rate on the return path respectively.
[0133] See Figure 8This diagram illustrates the complete process of a packet loss detection method provided in this application embodiment. The gateway is the first communication device described above, and the application server is the second communication device described above. In step ①, before sending multiple TCP packets to the application server, the gateway establishes a TCP connection with the application server. In step ②, the gateway constructs a probe stream using a probe packet construction module and sends multiple TCP packets to the application server sequentially, with the sequence numbers of the bytes in the multiple TCP packets being non-contiguous. In step ③, the application server receives the TCP packets sent by the gateway. When the application server identifies that the sequence numbers of the bytes in the received TCP packets are non-contiguous, it immediately sends back a SACK including the SACK option. In step ④, the gateway receives the SACK sent by the application server and analyzes the SACK using a data analysis module, determining the packet loss situation and packet loss rate of each path based on the received SACK.
[0134] In summary, in this embodiment of the application, by carrying TCP packets with non-contiguous sequence numbers, the SACK returned for each TCP packet is received, thereby accurately determining the received TCP packets, unreceived TCP packets, received SACKs, and unreceived SACKs based on the sequence number information carried by at least one SACK, thus accurately realizing packet loss detection.
[0135] Furthermore, the packet loss detection method provided in this application embodiment can be implemented based on a first communication device and a second communication device that support the SACK mechanism, and only requires adaptive single-end deployment of the first communication device, so that the first communication device can send TCP packets with non-contiguous byte sequence numbers to the second communication device without changing or deploying the second communication device. Therefore, this application embodiment can achieve high-precision active packet loss detection explicitly rather than probabilistically through single-end deployment.
[0136] The packet loss detection method provided in the embodiments of this application has been described above. Corresponding to the above method, the embodiments of this application also provide a packet loss detection device. This device is a first communication device. This device is used to... Figure 9 Each module shown performs the above... Figure 3 Packet loss detection methods in [the context of the text]. For example... Figure 9 As shown in the embodiments of this application, the packet loss detection device includes the following modules.
[0137] The sending module 901 is used to send a first packet loss detection message group, which consists of at least three Transmission Control Protocol (TCP) messages. Each TCP message carries a sequence number, which indicates the sequence number of the first byte in the data carried by each TCP message. In any two adjacent TCP messages, the sequence number of the last byte in the data carried by the earlier TCP message and the sequence number of the first byte in the data carried by the later TCP message are not consecutive. The receiving module 902 is used to receive at least one SACK for the first packet loss detection message group. The detection module 903 is used to perform packet loss detection based on the sequence number information carried by at least one SACK.
[0138] In one possible implementation, at least three TCP packets include a first TCP packet, a second TCP packet, and a third TCP packet sent consecutively. The first TCP packet carries a data packet with the sequence number n1 for the first byte and the sequence number m1 for the last byte. The second TCP packet carries a data packet with the sequence number n2 for the first byte and the sequence number m2 for the last byte. The third TCP packet carries a data packet with the sequence number n3 for the first byte and the sequence number m3 for the last byte. A receiving module 902 is used to receive a first SACK for the third TCP packet, wherein the sequence number information carried by the first SACK includes the sequence number carried by the third TCP packet. A detection module 903 is used to perform packet loss detection in response to the absence of a second SACK for the second TCP packet, based on whether the first SACK includes the sequence number carried by the second TCP packet.
[0139] In one possible implementation, the detection module 903 is used to determine that packet loss has occurred on the path of sending the second TCP packet when the first SACK does not include the sequence number carried by the second TCP packet; or, when the first SACK includes the sequence number carried by the second TCP packet, to determine that packet loss has occurred on the path of receiving the second SACK.
[0140] In one possible implementation, the packet to which the first SACK belongs includes the sequence number information carried by the first SACK and the acknowledgement number, where the acknowledgement number is x+1, and x is the sequence number of the last byte in the data carried by the first received TCP packet; the detection module 903 is used to determine that packet loss has occurred on the path of sending the second TCP packet when the first SACK does not include the sequence number carried by the second TCP packet and x is not equal to m2.
[0141] In one possible implementation, the length of the data carried by the second TCP segment is greater than the length of the data carried by the third TCP segment.
[0142] In one possible implementation, the sending module 901 is used to send multiple packet loss detection message groups, including a first packet loss detection message group, each packet loss detection message group consisting of at least three TCP packets, and any two adjacent TCP packets sent in each packet loss detection message group are TCP segments with non-contiguous sequence numbers; the detection module 903 is used to perform packet loss detection based on the received multiple SACKs for the multiple packet loss detection message groups.
[0143] In one possible implementation, packet loss detection includes locating the packet loss path and / or calculating the packet loss rate.
[0144] It should be understood that the above Figure 9 The beneficial effects that the provided device possesses in performing its function are... Figure 3 The provided packet loss detection methods offer the same beneficial effects, which will not be elaborated upon here. Additionally, Figure 9 The provided device, when implementing its functions, is only illustrated by the division of the above-mentioned functional modules. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. Furthermore, the device and method embodiments provided in the above embodiments belong to the same concept, and their specific implementation process is detailed in the method embodiments, which will not be repeated here. The packet loss detection device provided in this application can be, for example, a gateway, which can be, for example, a switch or other device. The packet loss detection device can also be a functional component deployed in a network device for all or part of the operations described in the above method embodiments of this application, such as a chip, a single board, etc.
[0145] See Figure 10 , Figure 10 A schematic diagram of an exemplary packet loss detection device 1000 of this application is shown. The packet loss detection device 1000 includes at least one processor 1001, a memory 1003, and at least one network interface 1004.
[0146] The processor 1001 is, for example, a general-purpose central processing unit (CPU), a digital signal processor (DSP), a network processor (NP), a neural-network processing unit (NPU), a data processing unit (DPU), a microprocessor, or one or more integrated circuits or application-specific integrated circuits (ASICs), programmable logic devices (PLDs), other general-purpose processors or other programmable logic devices, discrete gates, transistor logic devices, discrete hardware components, or any combination thereof used to implement the scheme of this application. The PLD is, for example, a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), generic array logic (GAL), or any combination thereof. The general-purpose processor can be a microprocessor or any conventional processor. It is worth noting that the processor can be a processor supporting an advanced reduced instruction set machine (RISC) machine (ARM) architecture. It can implement or execute the various logic blocks, modules, and circuits described in conjunction with the disclosure of this application. A processor can also be a combination of components that perform computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, and so on.
[0147] Optionally, the packet loss detection device 1000 also includes a bus 1002. The bus 1002 is used to transmit information between the various components of the packet loss detection device 1000. The bus 1002 can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus 1002 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 10 The symbol is represented by only one line, but this does not mean that there is only one bus or one type of bus.
[0148] The memory 1003 may be, for example, volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory may be random access memory (RAM), which is used as an external cache.
[0149] By way of example, but not limitation, many forms of ROM and RAM are available. For example, ROM is a compact disc read-only memory (CD-ROM). RAM includes, but is not limited to, static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous linked dynamic random access memory (SLDRAM), and direct rambus RAM (DR RAM).
[0150] The memory 1003 can also be other types of storage devices capable of storing static information and instructions. Alternatively, it can be other types of dynamic storage devices capable of storing information and instructions. It can also be other optical disc storage, optical disk storage (including compressed optical discs, laser discs, optical discs, digital versatile optical discs, Blu-ray discs, etc.), magnetic disk storage media, or other magnetic storage devices, or any other medium capable of carrying or storing desired program code in the form of instructions or data structures that can be accessed by a computer, but is not limited thereto. The memory 1003 may exist independently and be connected to the processor 1001 via bus 1002. The memory 1003 may also be integrated with the processor 1001.
[0151] Network interface 1004 uses any transceiver-like device for communicating with other devices or communication networks, such as Ethernet, radio access network (RAN), or wireless local area network (WLAN). Network interface 1004 can include wired network interfaces and wireless network interfaces. Specifically, network interface 1004 can be an Ethernet interface, such as Fast Ethernet (FE), Gigabit Ethernet (GE), Asynchronous Transfer Mode (ATM), WLAN, cellular network, or combinations thereof. The Ethernet interface can be an optical interface, an electrical interface, or a combination thereof. In some embodiments of this application, network interface 1004 can be used by packet loss detection device 1000 to communicate with other devices.
[0152] In specific implementations, as some embodiments, the processor 1001 may include one or more CPUs, such as Figure 10 The CPU0 and CPU1 shown are examples of processors. Each of these processors can be a single-core processor or a multi-core processor. A processor here can refer to one or more devices, circuits, and / or processing cores used to process data (e.g., computer program instructions).
[0153] In specific implementations, as some methods, the packet loss detection device 1000 may include multiple processors, such as... Figure 10 The processors 1001 and 1005 are shown. Each of these processors may be a single-core processor or a multi-core processor. A processor here may refer to one or more devices, circuits, and / or processing cores used to process data (such as computer program instructions).
[0154] In some embodiments, the memory 1003 is used to store program instructions 1010 for executing the scheme of this application, and the processor 1001 can execute the program instructions 1010 stored in the memory 1003. That is, the packet loss detection device 1000 can implement the method provided in the method embodiment through the processor 1001 and the program instructions 1010 in the memory 1003. Figure 3 The method is illustrated. Program instructions 1010 may include one or more software modules. Optionally, processor 1001 itself may also store program instructions for executing the scheme of this application.
[0155] In specific implementation, the packet loss detection device 1000 of this application can correspond to a first communication device for executing the above method. The processor 1001 in the packet loss detection device 1000 reads the instructions in the memory 1003, causing... Figure 10 The packet loss detection device 1000 shown can perform all or part of the steps in the method embodiments.
[0156] The packet loss detection device 1000 can also correspond to the above. Figure 9 The device shown, Figure 9 Each functional module in the illustrated device is implemented using the software of the packet loss detection device 1000. In other words, Figure 9 The device shown includes functional modules generated by the processor 1001 of the packet loss detection device 1000 after reading the program instructions 1010 stored in the memory 1003.
[0157] in, Figure 3 Each step of the method shown is completed through integrated logic circuits in the hardware or instructions in the software form of the processor of the packet loss detection device 1000. The steps of the method embodiments disclosed in this application can be directly implemented by the hardware processor, or by a combination of hardware and software modules in the processor. The software modules can reside in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. Since this storage medium is located in memory, the processor reads information from the memory and, in conjunction with its hardware, completes the steps of the above method embodiments. To avoid repetition, these steps will not be described in detail here.
[0158] In an exemplary embodiment, a packet loss detection system is provided, the system including a first communication device and a second communication device, the first communication device being used to perform... Figure 3 The method executed by the first communication device, and the method executed by the second communication device. Figure 3 The method performed by the second communication device.
[0159] In an exemplary embodiment, a computer program (product) is provided, comprising: computer program code, which, when executed by a computer, causes the computer to perform... Figure 3 The method in the middle.
[0160] In an exemplary embodiment, a computer-readable storage medium is provided that stores a program or instructions, which, when executed on a computer, cause the computer to perform the aforementioned actions. Figure 3 The method in the middle.
[0161] In an exemplary embodiment, a chip is provided, including a processor for recalling and executing instructions stored in memory, causing a computer with the chip installed to perform... Figure 3 The method in the middle.
[0162] In an exemplary embodiment, another chip is provided, including: an input interface, an output interface, a processor, and a memory. The input interface, output interface, processor, and memory are connected via internal interconnection paths. The processor is used to execute code in the memory. When the code is executed, a computer with the chip installed performs... Figure 3 The method in the middle.
[0163] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium accessible to a computer or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state drive).
[0164] In this application, the terms "first," "second," etc., are used to distinguish identical or similar items with substantially the same function. It should be understood that there is no logical or temporal dependency between "first," "second," and "nth," nor does it limit the quantity or order of execution. It should also be understood that although the following description uses the terms "first," "second," etc., to describe various elements, these elements should not be limited by the terms. These terms are merely used to distinguish one element from another.
[0165] It should also be understood that, in the various embodiments of this application, the sequence number of each process does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0166] In this application, the term "at least one" means one or more, and the term "multiple" means two or more. For example, multiple second devices means two or more second devices. The terms "system" and "network" are often used interchangeably herein.
[0167] It should be understood that the terminology used in the description of the various examples herein is for the purpose of describing particular examples only and is not intended to be limiting. As used in the description of the various examples and the appended claims, the singular forms “a” and “the” are intended to include the plural forms as well, unless the context clearly indicates otherwise.
[0168] It should also be understood that the term "and / or" as used herein refers to and covers any and all possible combinations of one or more of the associated listed items. The term "and / or" describes an association between related objects, indicating that three relationships can exist; for example, A and / or B can represent: A alone, A and B simultaneously, or B alone. Additionally, the character " / " in this application generally indicates that the preceding and following related objects are in an "or" relationship.
[0169] It should also be understood that the terms “if” and “if” can be interpreted as meaning “when” or “upon”, or “in response to determination” or “in response to detection”. Similarly, depending on the context, the phrases “if determination…” or “if detection [the stated condition or event]” can be interpreted as meaning “when determination…”, or “in response to determination…”, or “when detection [the stated condition or event]” or “in response to detection [the stated condition or event]”.
[0170] The above description is merely an embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the principles of this application should be included within the protection scope of this application.
Claims
1. A packet loss detection method, characterized in that, The method includes: Send a first packet loss detection message group, which consists of at least three Transmission Control Protocol (TCP) messages. Each TCP message carries a sequence number, which indicates the sequence number of the first byte in the data carried by each TCP message. In any two adjacent TCP messages, the sequence number of the last byte in the data carried by the first TCP message and the sequence number of the first byte in the data carried by the second TCP message are not consecutive. Receive at least one Selective Acknowledgment (SACK) for the first packet loss detection message group; Packet loss detection is performed based on the sequence number information carried by at least one SACK.
2. The method according to claim 1, characterized in that, The at least three TCP packets include a first TCP packet, a second TCP packet, and a third TCP packet sent consecutively. The first TCP packet carries a data packet with the sequence number n1 for the first byte and the sequence number m1 for the last byte. The second TCP packet carries a data packet with the sequence number n2 for the first byte and the sequence number m2 for the last byte. The third TCP packet carries a data packet with the sequence number n3 for the first byte and the sequence number m3 for the last byte. Receiving at least one Selective Acknowledgment (SACK) for the first packet loss detection packet group includes: Receive a first SACK for the third TCP packet, wherein the sequence number information carried by the first SACK includes the sequence number carried by the third TCP packet; The step of performing packet loss detection based on the sequence number information carried by the at least one SACK includes: In response to the absence of a second SACK for the second TCP packet, packet loss detection is performed based on whether the first SACK includes the sequence number carried by the second TCP packet.
3. The method according to claim 2, characterized in that, The step of performing packet loss detection based on whether the first SACK includes the sequence number carried by the second TCP packet includes: When the first SACK does not include the sequence number carried by the second TCP packet, it is determined that packet loss occurred on the path where the second TCP packet was sent; or When the first SACK includes the sequence number carried by the second TCP packet, it is determined that packet loss occurred on the path receiving the second SACK.
4. The method according to claim 3, characterized in that, The message to which the first SACK belongs includes the sequence number information and the acknowledgment number carried by the first SACK. The acknowledgment number is x+1, where x is the sequence number of the last byte in the data carried by the first received TCP message. The step of determining that packet loss occurred on the path leading to the second TCP packet when the first SACK does not include the sequence number carried by the second TCP packet includes: When the first SACK does not include the sequence number carried by the second TCP packet and x is not equal to m2, it is determined that packet loss occurred on the path where the second TCP packet was sent.
5. The method according to any one of claims 2-4, characterized in that, The length of the data carried in the second TCP packet is greater than the length of the data carried in the third TCP packet.
6. The method according to any one of claims 1-5, characterized in that, The sending of the first packet loss detection message group includes: Send multiple packet loss detection message groups, the multiple packet loss detection message groups including the first packet loss detection message group, each packet loss detection message group consists of at least three TCP packets, and any two adjacent TCP packets sent in each packet loss detection message group are TCP segments with non-contiguous sequence numbers; The step of performing packet loss detection based on the sequence number information carried by the at least one SACK includes: Packet loss detection is performed based on the multiple SACKs received for the multiple packet loss detection message groups.
7. The method according to any one of claims 1-6, characterized in that, The packet loss detection includes locating the packet loss path and / or calculating the packet loss rate.
8. A packet loss detection device, characterized in that, The device is a first communication device, the device comprising: The sending module is used to send a first packet loss detection message group, which consists of at least three Transmission Control Protocol (TCP) messages. Each TCP message carries a sequence number, which indicates the sequence number of the first byte in the data carried by each TCP message. In any two adjacent TCP messages, the sequence number of the last byte in the data carried by the first TCP message and the sequence number of the first byte in the data carried by the second TCP message are not consecutive. The receiving module is configured to receive at least one Selective Acknowledgment (SACK) for the first packet loss detection message group; The detection module is used to perform packet loss detection based on the sequence number information carried by the at least one SACK.
9. The apparatus according to claim 8, characterized in that, The at least three TCP packets include a first TCP packet, a second TCP packet, and a third TCP packet sent consecutively. The first TCP packet carries a data packet with the sequence number n1 for the first byte and the sequence number m1 for the last byte. The second TCP packet carries a data packet with the sequence number n2 for the first byte and the sequence number m2 for the last byte. The third TCP packet carries a data packet with the sequence number n3 for the first byte and the sequence number m3 for the last byte. The receiving module is configured to receive a first SACK for the third TCP packet, wherein the sequence number information carried by the first SACK includes the sequence number carried by the third TCP packet. The detection module is configured to perform packet loss detection based on whether the first SACK includes the sequence number carried by the second TCP packet in response to the absence of a second SACK for the second TCP packet.
10. The apparatus according to claim 9, characterized in that, The detection module is used to determine that packet loss has occurred on the path of sending the second TCP packet when the first SACK does not include the sequence number carried by the second TCP packet; or, when the first SACK includes the sequence number carried by the second TCP packet, to determine that packet loss has occurred on the path of receiving the second SACK.
11. The apparatus according to claim 10, characterized in that, The message to which the first SACK belongs includes the sequence number information and the acknowledgment number carried by the first SACK. The acknowledgment number is x+1, where x is the sequence number of the last byte in the data carried by the first received TCP message. The detection module is used to determine that packet loss has occurred on the path where the second TCP packet was sent when the first SACK does not include the sequence number carried by the second TCP packet and x is not equal to m2.
12. The apparatus according to any one of claims 9-11, characterized in that, The length of the data carried in the second TCP packet is greater than the length of the data carried in the third TCP packet.
13. The apparatus according to any one of claims 8-12, characterized in that, The sending module is used to send multiple packet loss detection message groups, the multiple packet loss detection message groups include the first packet loss detection message group, each packet loss detection message group consists of at least three TCP packets, and any two adjacent TCP packets sent in each packet loss detection message group are TCP segments with non-contiguous sequence numbers; The detection module is used to perform packet loss detection based on the multiple SACKs received for the multiple packet loss detection message groups.
14. The apparatus according to any one of claims 8-13, characterized in that, The packet loss detection includes locating the packet loss path and / or calculating the packet loss rate.
15. A packet loss detection device, characterized in that, The packet loss detection device includes a processor coupled to a memory; the memory stores at least one instruction, which is loaded and executed by the processor to enable the packet loss detection device to implement the packet loss detection method according to any one of claims 1-7.
16. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores at least one instruction, which is loaded and executed by a processor to implement the packet loss detection method as described in any one of claims 1-7.
17. A computer program product, characterized in that, The computer program product includes a computer program / instruction, which is executed by a processor to enable the computer to implement the packet loss detection method according to any one of claims 1-7.