Method, device, storage medium and electronic device for measuring one-way network delay
By sending data packets to destination addresses from multiple paths and receiving reply packets, selecting the best path to calculate network unidirectional delay, the problem of inaccurate measurement in the prior art is solved and the measurement accuracy is improved.
Patent Information
- Application Number
- CN202110897104.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-05
- Publication Date
- 2025-03-21
- Estimated Expiration
- 2041-08-05
AI Technical Summary
The prior art is inaccurate when measuring network unidirectional delay, mainly due to path changes caused by factors such as routing load configuration.
By sending data packets to the destination address from multiple first paths and second paths and receiving reply packets from fixed paths, the round trip time (RTT) of each path is determined, thereby selecting the best path and calculating the network one-way delay.
By determining the optimal path measurement network unidirectional delay, the measurement accuracy is improved, and the problem of inaccurate measurement in the prior art is solved.
Smart Images

Figure CN115706707B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computers, and in particular to a method, device, storage medium and electronic device for measuring one-way delay of a network. Background Art
[0002] In the prior art, in the process of measuring the one-way delay of the network, a data packet can be sent from the sending address to the receiving address, and the receiving address immediately returns a reply packet to the sending address after receiving the data packet. The one-way delay of the network is obtained by subtracting the time of sending the data packet from the time of receiving the reply packet and dividing it by 2. However, since the routing load configuration and the like may be different, the above method causes inaccurate measurement of the one-way delay of the network. Summary of the invention
[0003] The embodiments of the present invention provide a method, device, storage medium and electronic device for measuring one-way network delay, so as to at least solve the technical problem of inaccurate measurement of one-way network delay.
[0004] According to a first aspect of an embodiment of the present invention, a method for measuring a one-way delay of a network is provided, comprising: sending a first data packet to a destination address from multiple first paths and receiving a first reply packet of the first data packet from the destination address from a first fixed path; determining a first target path from the multiple first paths according to a first time duration from sending the first data packet to receiving the first reply packet on each of the first paths; receiving a second data packet sent by the destination address from multiple second paths, and sending a second reply packet of the second data packet to the destination address from the second fixed path; determining a second target path from the multiple second paths according to a second time duration from a sending time point of the second data packet to a receiving time point of the second reply packet on each of the second paths; determining a one-way delay from a current address to the destination address according to the first target path and the second target path.
[0005] According to another aspect of an embodiment of the present invention, there is provided an apparatus for measuring one-way delay of a network, comprising: a first sending unit, configured to send a first data packet to a destination address from a plurality of first paths and to receive a first reply packet of the first data packet from the destination address from a first fixed path; a first receiving unit, configured to determine a first target path from the plurality of first paths according to a first time duration from sending the first data packet to receiving the first reply packet on each of the first paths; a second sending unit, configured to receive a second data packet sent from the destination address from a plurality of second paths, and to send a second reply packet of the second data packet to the destination address from the second fixed path; a second receiving unit, configured to determine a second target path from the plurality of second paths according to a second time duration from a sending time point of the second data packet to a receiving time point of the second reply packet on each of the second paths; and a determining unit, configured to determine the one-way delay from a current address to the destination address according to the first target path and the second target path.
[0006] According to another aspect of an embodiment of the present invention, a storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the above-mentioned method for measuring one-way network delay when running.
[0007] According to another aspect of an embodiment of the present invention, there is provided an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the method for measuring one-way network delay through the computer program.
[0008] In an embodiment of the present invention, a method is adopted in which a first data packet is sent from a plurality of first paths to a destination address and a first reply packet of the first data packet is received from the destination address through a first fixed path; a first target path is determined from the plurality of first paths according to a first time length from sending the first data packet to receiving the first reply packet through each of the first paths; a second data packet sent from the destination address is received from a plurality of second paths, and a second reply packet of the second data packet is sent from the second fixed path to the destination address; a second target path is determined from the plurality of second paths according to a second time length from the sending time point of the second data packet to the receiving time point of the second reply packet through each of the second paths; a method is provided in which a one-way delay from the current address to the destination address is determined based on the first target path and the second target path. In the above method, in the process of determining the one-way delay of the network, the best path for sending a data packet from the current address to the destination address can be determined, and then the best path for sending a data packet from the destination address to the current address can be determined, and the one-way delay of the network can be determined using the best path. The one-way delay is determined more accurately through the best path, and thus the accuracy of determining the one-way delay of the network is improved. The technical problem of inaccurate measurement of one-way delay of the network is thus solved. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0010] Figure 1 is a flow chart of an optional method for measuring one-way network delay according to an embodiment of the present invention;
[0011] Figure 2 is a flowchart of another optional method for measuring one-way network delay according to an embodiment of the present invention;
[0012] Figure 3 is a system schematic diagram of an optional method for measuring one-way network delay according to an embodiment of the present invention;
[0013] Figure 4 It is a schematic diagram of the structure of an optional device for measuring one-way network delay according to an embodiment of the present invention. DETAILED DESCRIPTION
[0014] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0015] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0016] Round-trip time (RTT) is the time it takes for a network request to travel from its origin to its destination and back again. RTT is an important metric for determining the health of a connection on a local network or the larger Internet.
[0017] One-Way Delay (OWD) refers to the time it takes for a network request to go from the starting point to the destination. Compared with RTT, it does not include the time it takes to return from the destination to the starting point.
[0018] Equal Cost Multi-path (ECMP) means that there are multiple paths with the same cost to reach the same destination address. When the device supports equal-cost routing, the Layer 3 forwarding traffic sent to the destination IP or destination network segment can be shared through different paths to achieve network load balancing. When some paths fail, other paths can replace them to complete the forwarding process, thus achieving routing redundancy backup function.
[0019] Ping: A method for testing RTT. It sends a test data packet to the other end, records the sending time of the data packet, and requires the other end to reply immediately after receiving the packet. After the sender receives the reply packet from the other end, it records the receiving time again. The RTT is obtained by subtracting the sending time from the receiving time.
[0020] According to a first aspect of an embodiment of the present invention, a method for measuring a one-way delay of a network is provided. Optionally, as follows: Figure 1 As shown, the above method includes:
[0021] S102, sending a first data packet to a destination address from a plurality of first paths and receiving a first reply packet of the first data packet from the destination address through a first fixed path;
[0022] S104, determining a first target path from the plurality of first paths according to a first time duration from sending the first data packet to receiving the first reply packet on each first path;
[0023] S106, receiving a second data packet sent by the destination address from multiple second paths, and sending a second reply packet of the second data packet to the destination address from the second fixed path;
[0024] S108, determining a second target path from the plurality of second paths according to a second duration from a sending time point of the second data packet to a receiving time point of the second reply packet of each second path;
[0025] S110, determining a one-way delay from a current address to a destination address according to the first target path and the second target path.
[0026] Optionally, the above method can be applied to, but not limited to, the process of measuring the one-way delay of the network. In the process of measuring the one-way delay of the network, the sender and the receiver of the data packet can transmit the data packet to measure the one-way delay of the network between the sender and the receiver. For example, with the current address as the sender of the data packet and the destination address as the receiver of the data packet, the current address can send a data packet to the destination address, and the destination address will immediately return a reply packet to the current address after receiving the data packet. The current address obtains the RTT by recording the time point from when the data packet is sent to when the reply packet is received. If OWD is to be determined, it is inaccurate to simply divide the RTT by 2. In this embodiment, the current address can send a first data packet to the destination address through multiple first paths, and receive the first reply packet returned by the destination address from a first fixed path. Then, for each path, a corresponding RTT can be obtained. And according to the RTT, the best first target path is determined from the multiple first paths. Similarly, the destination address can also send a second data packet to the current address through multiple second paths, and the current address sends a second reply packet to the destination address through the second fixed path after receiving the second data packet. For each second path, there is a corresponding RTT. According to the RTT, the best second target path is selected from multiple second paths. Finally, data packets are sent and reply packets are received according to the first target path and the second target path, so as to calculate the one-way delay.
[0027] Optionally, in this embodiment, the first data packet and the second data packet may have different contents when sent through different paths. For example, the first data packet sent through path 1 in the first path may have different contents from the first data packet sent through path 2 in the first path. The second data packet sent through path 3 in the second path may also have different contents from the second data packet sent through path 4 in the second path.
[0028] Optionally, in this embodiment, the current address can send a first data packet to the destination address through multiple first paths, and the sending delays of different paths may be different. The first reply packet is received through the same first fixed path, so the RTTs of different first paths can be obtained. The destination address can also send a second data packet to the current address through multiple second paths, and the sending delays of different paths may be different. The second reply packet is received through the same second fixed path, so the RTTs of different second paths can be obtained. The path with the smallest RTT is selected from the different first paths as the first target path, and the path with the smallest RTT is selected from the second paths as the second target path. The minimum RTT is determined based on the first target path and the second target path, and the minimum RTT is divided by 2 to determine the most accurate OWD.
[0029] Through this embodiment, in the process of determining the one-way delay of the network, the best path for sending a data packet from the current address to the destination address can be determined, and then the best path for sending a data packet from the destination address to the current address can be determined, and the one-way delay of the network can be determined using the best path. Determining the one-way delay through the best path is more accurate, thereby improving the accuracy of determining the one-way delay of the network.
[0030] As an optional implementation manner, sending a first data packet to a destination address from multiple first paths and receiving a first reply packet of the first data packet from the destination address through a first fixed path includes:
[0031] Take each first path as the current path and perform the following operations on the current path:
[0032] Sending a first data packet to a destination address under the current path;
[0033] Recording a first sending time point of a first data packet;
[0034] receiving a first reply packet of a first data packet of a current path from a first fixed path;
[0035] Record the first receiving time point when the first reply packet is received.
[0036] Optionally, in this embodiment, the current address sends a first data packet to the destination address, and the first data packet may be sent through multiple first paths. The contents of the first data packets of the multiple first paths may be different. If the first data packet is sent through different first paths, the OWD at which the destination address receives the first data packet is different. When the current address sends the first data packet, the first sending time point of each first path sending the first data packet is recorded, and then the first data packet is sent to the destination address, and the destination address immediately returns a first reply packet. The current address records the first receiving time point of receiving the first reply packet, and then the RTT corresponding to the first path can be determined.
[0037] As an optional implementation manner, according to a first time duration from sending a first data packet to receiving a first reply packet on each first path, determining a first target path from multiple first paths includes:
[0038] Determine the difference between the first receiving time point and the first sending time point of the current path as the first duration of the current path;
[0039] Among the multiple first paths, the path with the shortest first duration is determined as the first target path.
[0040] Optionally, in this embodiment, when the current address sends a first data packet to the destination address via a first path and receives a first reply packet sent by the destination address via a first fixed path, the difference between the first receiving time point when the first reply packet is received and the first sending time point when the first data packet is sent can be used as the RTT between the current address and the destination address. The minimum RTT indicates that the transmission delay of the first path is the minimum. Therefore, the first path is the best path for the current address to send data packets to the destination address.
[0041] As an optional implementation manner, receiving a second data packet sent by a destination address from multiple second paths, and sending a second reply packet of the second data packet to the destination address from a second fixed path includes:
[0042] Take each second path as the current path and perform the following operations on the current path:
[0043] Receive a second data packet sent by the destination address under the current path;
[0044] A second reply packet of the second data packet of the current path is sent from the second fixed path to the destination address.
[0045] Optionally, in this embodiment, the destination address sends a second data packet to the current address, and the second data packet may be sent through multiple second paths. The contents of the second data packets of the multiple second paths may be different. If the second data packet is sent through different second paths, the OWD at which the current address receives the second data packet is different. When sending the second data packet, the destination address records the second sending time point of each second path sending the second data packet, and then the second data packet is sent to the current address, and the current address immediately returns a second reply packet. The destination address records the second receiving time point of receiving the second reply packet, and then the RTT corresponding to the second path can be determined.
[0046] As an optional implementation, determining the second target path from the plurality of second paths according to the second duration from the sending time point of the second data packet to the receiving time point of the second reply packet of each second path includes:
[0047] Obtain a second sending time point of a second data packet of the current path and a second receiving time point of a second reply packet of the current path received by the destination address;
[0048] Determine the difference between the second receiving time point and the second sending time point as the second duration of the current path;
[0049] Among the multiple second paths, the path with the shortest second duration is determined as the second target path.
[0050] Optionally, in this embodiment, when the destination address sends a second data packet to the current address via a second path and receives a second reply packet sent by the current address via a second fixed path, the difference between the second receiving time point of receiving the second reply packet and the second sending time point of sending the second data packet can be used as the RTT between the current address and the destination address. The minimum RTT indicates that the transmission delay of the second path is the minimum. Therefore, the second path is the best path for the destination address to send data packets to the current address.
[0051] As an optional implementation, Figure 2 As shown, determining the one-way delay from the current address to the destination address according to the first target path and the second target path includes:
[0052] S202, sending a third data packet from the first target path to the destination address;
[0053] S204, recording a third sending time point of the third data packet;
[0054] S206, receiving a third reply packet of the third data packet returned by the destination address from the second target path;
[0055] S208, recording a third receiving time point of the third reply packet;
[0056] S210: Determine half of the difference between the third receiving time point and the third sending time point as a one-way delay from the current address to the destination address.
[0057] Optionally, in this embodiment, after the first target path and the second target path are determined, data can be transmitted through the first target path and the second target path to calculate the minimum RTT. The current address can send a third data packet to the destination address through the first target path and record the third sending time point. After receiving the third data packet, the destination address immediately returns a third reply packet. When the current address receives the third reply packet, it records the third receiving time point of the third reply packet. Subtract the third sending time point from the third receiving time point to determine the shortest RTT between the current address and the destination address. Divide the RTT by 2, and determine the resulting value as the OWD from the current address to the destination address.
[0058] In this embodiment, for ECMP, the router uses the five-tuple of the network (source IP, source port, protocol, destination IP, destination port) as the basis for multi-path load balancing. Therefore, a fixed five-tuple means that in the ECMP scenario, there is a fixed and specific router to bear the traffic, which means a relatively fixed time cost.
[0059] By trying different five-tuples, different data can be sent to different ECMP routes. By measuring their RTTs, a five-tuple path with the best RTT can be obtained.
[0060] By fixing the quintuple of the returned packet and the one-way delay of the returned packet, the optimal RTT is obtained by trying different five-tuples for packet removal. Since the packet return OWD can be considered fixed, the optimal RTT-fixed packet return OWD=optimal packet removal OWD, so this five-tuple is the optimal packet removal five-tuple (marked as A). Similarly, the same operation is performed on the reverse link to obtain the optimal five-tuple in the reverse direction (marked as B). At this time, A is used as the packet sending five-tuple and B is used as the packet return five-tuple to perform ping-pong. The RTT obtained can be considered as the optimal RTT. Let this RTT / 2, which is a more accurate OWD.
[0061] Flowchart as Figure 3 shown. Figure 3 In the example, Aping B, A uses ports 10001-10003 to ping B port 20000, and lets B use port 20000 as the source address of the return packet, and return it to A:10000. At this time, the quintuple is (A:10001-10020)-UDP→(B:20000). The optimal quintuple in this range can be obtained, such as: (A:10003)-UDP→(B:20000). The return packet quintuple is: (B:20000)-UDP→(A:10000). The semantics of the optimal quintuple is: the quintuple with the lowest packet removal delay on the fixed return packet path.
[0062] In the reverse direction, let B ping A again. Similarly, the reply packet quintuple is A:20000-UDP->B:10000, and the optimal quintuple is (B:10013)-UDP→(A:20000).
[0063] At this time, A pings B using (A:10003)-UDP→(B:20000), and B replies using (B:10013)-UDP→(A:20000). The optimal RTT can be calculated, and RTT / 2 is closer to the actual OWD.
[0064] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should know that the present invention is not limited by the described action sequence, because according to the present invention, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present invention.
[0065] According to another aspect of an embodiment of the present invention, a device for implementing the above method for measuring one-way delay of a network is also provided. Figure 4 As shown, the device comprises:
[0066] A first sending unit 402, configured to send a first data packet to a destination address from a plurality of first paths and receive a first reply packet of the first data packet from the destination address through a first fixed path;
[0067] A first receiving unit 404, configured to determine a first target path from the plurality of first paths according to a first time duration from sending the first data packet to receiving the first reply packet on each first path;
[0068] A second sending unit 406, configured to receive a second data packet sent by a destination address from a plurality of second paths, and send a second reply packet of the second data packet to the destination address from a second fixed path;
[0069] A second receiving unit 408, configured to determine a second target path from the plurality of second paths according to a second duration from a sending time point of the second data packet to a receiving time point of the second reply packet of each second path;
[0070] The determining unit 410 is configured to determine a one-way delay from a current address to a destination address according to the first destination path and the second destination path.
[0071] Optionally, the above device can be applied to, but not limited to, the process of measuring the one-way delay of the network. In the process of measuring the one-way delay of the network, the sender and the receiver of the data packet can transmit the data packet to measure the one-way delay of the network between the sender and the receiver. For example, with the current address as the sender of the data packet and the destination address as the receiver of the data packet, the current address can send a data packet to the destination address, and the destination address will immediately return a reply packet to the current address after receiving the data packet. The current address obtains the RTT by recording the time point from when the data packet is sent to when the reply packet is received. If OWD is to be determined, it is inaccurate to simply divide the RTT by 2. In this embodiment, the current address can send a first data packet to the destination address through multiple first paths, and receive the first reply packet returned by the destination address from a first fixed path. Then, for each path, a corresponding RTT can be obtained. And according to the RTT, the best first target path is determined from the multiple first paths. Similarly, the destination address can also send a second data packet to the current address through multiple second paths, and the current address sends a second reply packet to the destination address through the second fixed path after receiving the second data packet. For each second path, there is a corresponding RTT. According to the RTT, the best second target path is selected from multiple second paths. Finally, data packets are sent and reply packets are received according to the first target path and the second target path, so as to calculate the one-way delay.
[0072] Optionally, in this embodiment, the first data packet and the second data packet may have different contents when sent through different paths. For example, the first data packet sent through path 1 in the first path may have different contents from the first data packet sent through path 2 in the first path. The second data packet sent through path 3 in the second path may also have different contents from the second data packet sent through path 4 in the second path.
[0073] Optionally, in this embodiment, the current address can send a first data packet to the destination address through multiple first paths, and the sending delays of different paths may be different. The first reply packet is received through the same first fixed path, so the RTTs of different first paths can be obtained. The destination address can also send a second data packet to the current address through multiple second paths, and the sending delays of different paths may be different. The second reply packet is received through the same second fixed path, so the RTTs of different second paths can be obtained. The path with the smallest RTT is selected from the different first paths as the first target path, and the path with the smallest RTT is selected from the second paths as the second target path. The minimum RTT is determined based on the first target path and the second target path, thereby determining the most accurate OWD.
[0074] Through this embodiment, in the process of determining the one-way delay of the network, the best path for sending a data packet from the current address to the destination address can be determined, and then the best path for sending a data packet from the destination address to the current address can be determined, and the one-way delay of the network can be determined using the best path. Determining the one-way delay through the best path is more accurate, thereby improving the accuracy of determining the one-way delay of the network.
[0075] As an optional implementation manner, the first sending unit includes:
[0076] The first processing module is used to take each first path as a current path and perform the following operations on the current path:
[0077] Sending a first data packet to a destination address under the current path;
[0078] Recording a first sending time point of a first data packet;
[0079] receiving a first reply packet of a first data packet of a current path from a first fixed path;
[0080] Record the first receiving time point when the first reply packet is received.
[0081] Optionally, in this embodiment, the current address sends a first data packet to the destination address, and the first data packet may be sent through multiple first paths. The contents of the first data packets of the multiple first paths may be different. If the first data packet is sent through different first paths, the OWD at which the destination address receives the first data packet is different. When the current address sends the first data packet, the first sending time point of each first path sending the first data packet is recorded, and then the first data packet is sent to the destination address, and the destination address immediately returns a first reply packet. The current address records the first receiving time point of receiving the first reply packet, and then the RTT corresponding to the first path can be determined.
[0082] As an optional implementation manner, the first receiving unit includes:
[0083] A first determining module, configured to determine a difference between a first receiving time point and a first sending time point of a current path as a first duration of the current path;
[0084] The second determination module is used to determine the path with the shortest first duration among the multiple first paths as the first target path.
[0085] Optionally, in this embodiment, when the current address sends a first data packet to the destination address via a first path and receives a first reply packet sent by the destination address via a first fixed path, the difference between the first receiving time point when the first reply packet is received and the first sending time point when the first data packet is sent can be used as the RTT between the current address and the destination address. The minimum RTT indicates that the transmission delay of the first path is the minimum. Therefore, the first path is the best path for the current address to send data packets to the destination address.
[0086] As an optional implementation manner, the second sending unit includes:
[0087] The second processing module is used to take each second path as the current path and perform the following operations on the current path:
[0088] Receive a second data packet sent by the destination address under the current path;
[0089] A second reply packet of the second data packet of the current path is sent from the second fixed path to the destination address.
[0090] Optionally, in this embodiment, the destination address sends a second data packet to the current address, and the second data packet may be sent through multiple second paths. The contents of the second data packets of the multiple second paths may be different. If the second data packet is sent through different second paths, the OWD at which the current address receives the second data packet is different. When sending the second data packet, the destination address records the second sending time point of each second path sending the second data packet, and then the second data packet is sent to the current address, and the current address immediately returns a second reply packet. The destination address records the second receiving time point of receiving the second reply packet, and then the RTT corresponding to the second path can be determined.
[0091] As an optional implementation manner, the second sending unit includes:
[0092] An acquisition module, used to acquire a second sending time point of a second data packet of the current path and a second receiving time point of a second reply packet of the current path received by the destination address;
[0093] A third determining module, configured to determine a difference between a second receiving time point and a second sending time point as a second duration of the current path;
[0094] The fourth determination module is used to determine the path with the shortest second duration among the multiple second paths as the second target path.
[0095] Optionally, in this embodiment, when the destination address sends a second data packet to the current address via a second path and receives a second reply packet sent by the current address via a second fixed path, the difference between the second receiving time point of receiving the second reply packet and the second sending time point of sending the second data packet can be used as the RTT between the current address and the destination address. The minimum RTT indicates that the transmission delay of the second path is the minimum. Therefore, the second path is the best path for the destination address to send data packets to the current address.
[0096] As an optional implementation manner, the above-mentioned determination unit includes:
[0097] A sending module, used for sending a third data packet from the first target path to the destination address;
[0098] A first recording module, used to record a third sending time point of a third data packet;
[0099] A receiving module, configured to receive a third reply packet of a third data packet returned by a destination address from a second target path;
[0100] A second recording module, used to record a third receiving time point of a third reply packet;
[0101] The fifth determining module is used to determine half of the difference between the third receiving time point and the third sending time point as the one-way delay from the current address to the destination address.
[0102] Optionally, in this embodiment, after the first target path and the second target path are determined, data can be transmitted through the first target path and the second target path to calculate the RTT. The current address can send a third data packet to the destination address through the first target path and record the third sending time point. After receiving the third data packet, the destination address immediately returns a third reply packet. When the current address receives the third reply packet, it records the third receiving time point of the third reply packet. Subtract the third sending time point from the third receiving time point to determine the shortest RTT between the current address and the destination address. Divide the RTT by 2, and determine the resulting value as the OWD from the current address to the destination address.
[0103] In this embodiment, for ECMP, the router uses the five-tuple of the network (source IP, source port, protocol, destination IP, destination port) as the basis for multi-path load balancing. Therefore, a fixed five-tuple means that in the ECMP scenario, there is a fixed and specific router to bear the traffic, which means a relatively fixed time cost.
[0104] By trying different five-tuples, different data can be sent to different ECMP routes. By measuring their RTTs, a five-tuple path with the best RTT can be obtained.
[0105] By fixing the five-tuple of the returned packet, the one-way delay of the returned packet is fixed; the optimal RTT is obtained by trying different five-tuples for packet removal; since the packet return OWD can be considered fixed, the optimal RTT-fixed packet return OWD=optimal packet removal OWD, so this five-tuple is the optimal packet removal five-tuple (marked as A). Similarly, the same operation is performed on the reverse link to obtain the optimal five-tuple in the reverse direction (marked as B). At this time, A is used as the packet sending five-tuple and B is used as the packet return five-tuple, and ping-pong is performed. The RTT obtained can be considered as the optimal RTT. Let this RTT / 2, which is a more accurate OWD.
[0106] Flowchart as Figure 3 shown. Figure 3 In the example, A pings B. A uses ports 10001-10003 to ping B port 20000, and lets B use port 20000 as the source address of the return packet, and return it to A:10000. At this time, the quintuple is (A:10001-10020)-UDP→(B:20000). The optimal quintuple in this range can be obtained, such as: (A:10003)-UDP→(B:20000). The return packet quintuple is: (B:20000)-UDP→(A:10000). The semantics of the optimal quintuple is: the quintuple with the lowest packet removal delay on the fixed return packet path.
[0107] In the reverse direction, let B ping A again. Similarly, the reply packet quintuple is A:20000-UDP->B:10000, and the optimal quintuple is (B:10013)-UDP→(A:20000).
[0108] At this time, A pings B using (A:10003)-UDP→(B:20000), and B replies using (B:10013)-UDP→(A:20000). The optimal RTT can be calculated, and RTT / 2 is closer to the actual OWD.
[0109] According to another aspect of an embodiment of the present invention, an electronic device for implementing the above-mentioned method for measuring one-way delay in a network is also provided. The electronic device may include a memory and a processor. A computer program is stored in the memory. The processor is configured to execute the steps in the embodiment of the method for measuring one-way delay in a network according to the first aspect or the method for measuring one-way delay in a network according to the second aspect through the computer program.
[0110] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the steps of the method embodiments for measuring one-way delay of a network according to the first and second aspects mentioned above when running.
[0111] Optionally, in this embodiment, a person of ordinary skill in the art may understand that all or part of the steps in the various methods of the above embodiments may be completed by instructing hardware related to the terminal device through a program, and the program may be stored in a computer-readable storage medium, and the storage medium may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, etc.
[0112] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0113] If the integrated units in the above embodiments are implemented in the form of software functional units and sold or used as independent products, they can be stored in the above computer-readable storage medium. Based on such understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling one or more computer devices (which can be personal computers, servers or network devices, etc.) to perform all or part of the steps of the methods of various embodiments of the present invention.
[0114] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0115] In the several embodiments provided in the present application, it should be understood that the disclosed client can be implemented in other ways. Among them, the device embodiments described above are only schematic, for example, the division of units is only a logical function division, and there may be other division methods in actual implementation, for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0116] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0117] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0118] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A method for measuring one-way network delay, characterized in that: include: sending a first data packet to a destination address from a plurality of first paths and receiving a first reply packet of the first data packet from the destination address from a first fixed path; Determine a first target path from the plurality of first paths according to a first time duration from sending the first data packet to receiving the first reply packet on each of the first paths; receiving a second data packet sent by a destination address from a plurality of second paths, and sending a second reply packet of the second data packet to the destination address from a second fixed path; Determine a second target path from the plurality of second paths according to a second duration from a sending time point of the second data packet to a receiving time point of the second reply packet of each second path; Determine a one-way delay from a current address to the destination address according to the first target path and the second target path; The determining of the first target path from the plurality of first paths according to the first time duration from sending the first data packet to receiving the first reply packet on each of the first paths comprises: determining the difference between the first receiving time point of the first reply packet of the first data packet received from the first fixed path and the first sending time point of sending the first data packet to the destination address on the first path as the first time duration of the first path; determining the path with the smallest first time duration among the plurality of first paths as the first target path; Among them, determining the second target path from the multiple second paths according to the second duration from the sending time point of the second data packet to the receiving time point of the second reply packet of each second path includes: obtaining the second sending time point of the second data packet in the second path and the second receiving time point of the second reply packet of the second data packet received by the destination address on the second path; determining the difference between the second receiving time point and the second sending time point as the second duration of the second path; determining the path with the smallest second duration among the multiple second paths as the second target path; The method of determining the one-way delay from the current address to the destination address based on the first target path and the second target path includes: sending a third data packet from the first target path to the destination address; recording a third sending time point of the third data packet; receiving a third reply packet of the third data packet returned from the destination address from the second target path; recording a third receiving time point of the third reply packet; and determining half of the difference between the third receiving time point and the third sending time point as the one-way delay from the current address to the destination address.
2. The method according to claim 1, characterized in that The sending of the first data packet to the destination address from the plurality of first paths and receiving the first reply packet of the first data packet from the destination address from the first fixed path comprises: Take each of the first paths as the current path, and perform the following operations on the current path: Sending the first data packet to the destination address under the current path; Recording a first sending time point of the first data packet; receiving the first reply packet of the first data packet of the current path from the first fixed path; Record a first receiving time point when the first reply packet is received.
3. The method according to claim 1, characterized in that The step of receiving a second data packet sent by a destination address from a plurality of second paths, and sending a second reply packet of the second data packet to the destination address from a second fixed path includes: Take each of the second paths as the current path, and perform the following operations on the current path: receiving the second data packet sent by the destination address under the current path; The second reply packet of the second data packet of the current path is sent from the second fixed path to the destination address.
4. A device for measuring one-way network delay, characterized in that: include: a first sending unit, configured to send a first data packet to a destination address from a plurality of first paths and receive a first reply packet of the first data packet from the destination address from a first fixed path; a first receiving unit, configured to determine a first target path from the plurality of first paths according to a first time length from sending the first data packet to receiving the first reply packet on each of the first paths; A second sending unit, configured to receive a second data packet sent by a destination address from a plurality of second paths, and send a second reply packet of the second data packet to the destination address from a second fixed path; A second receiving unit, configured to determine a second target path from the plurality of second paths according to a second duration from a sending time point of the second data packet to a receiving time point of the second reply packet of each second path; a determining unit, configured to determine a one-way delay from a current address to the destination address according to the first target path and the second target path; The determining of the first target path from the plurality of first paths according to the first time duration from sending the first data packet to receiving the first reply packet on each of the first paths comprises: determining the difference between the first receiving time point of the first reply packet of the first data packet received from the first fixed path and the first sending time point of sending the first data packet to the destination address on the first path as the first time duration of the first path; determining the path with the smallest first time duration among the plurality of first paths as the first target path; Among them, determining the second target path from the multiple second paths according to the second duration from the sending time point of the second data packet to the receiving time point of the second reply packet of each second path includes: obtaining the second sending time point of the second data packet in the second path and the second receiving time point of the second reply packet of the second data packet received by the destination address on the second path; determining the difference between the second receiving time point and the second sending time point as the second duration of the second path; determining the path with the smallest second duration among the multiple second paths as the second target path; The method of determining the one-way delay from the current address to the destination address based on the first target path and the second target path includes: sending a third data packet from the first target path to the destination address; recording a third sending time point of the third data packet; receiving a third reply packet of the third data packet returned from the destination address from the second target path; recording a third receiving time point of the third reply packet; and determining half of the difference between the third receiving time point and the third sending time point as the one-way delay from the current address to the destination address.
5. The device according to claim 4, characterized in that The first sending unit includes: The first processing module is configured to take each of the first paths as a current path and perform the following operations on the current path: Sending the first data packet to the destination address under the current path; Recording a first sending time point of the first data packet; receiving the first reply packet of the first data packet of the current path from the first fixed path; Record a first receiving time point when the first reply packet is received.
6. The device according to claim 4, characterized in that The second sending unit includes: The second processing module is configured to take each of the second paths as a current path and perform the following operations on the current path: receiving the second data packet sent by the destination address under the current path; The second reply packet of the second data packet of the current path is sent from the second fixed path to the destination address.
7. A computer-readable storage medium storing a computer program, characterized in that: The computer program executes the method described in any one of claims 1 to 3 when executed.
8. An electronic device, comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to execute the method according to any one of claims 1 to 3 through the computer program.
Citation Information
Patent Citations
Method and device for determining preferred path, and server
CN108833276A
Relative One-Way Delay Measurements Over Multiple Paths Between Devices
US20090190482A1