Method, device, storage medium and electronic device for measuring network round trip time
By selecting the path with the smallest transmission time in the network to transmit data, the problem of low data transmission efficiency caused by the difference in network round trip delay in the prior art is solved, and more efficient data transmission is achieved.
Patent Information
- Application Number
- CN202110898311.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-05
- Publication Date
- 2025-05-23
- Estimated Expiration
- 2041-08-05
AI Technical Summary
In the prior art, there may be differences in the network round trip delay, resulting in low data transmission efficiency.
Before sending data packets to the destination address, multiple transmission paths are selected, and the target path with the smallest transmission time is determined according to the transmission time of each path, and the packet is sent through this path.
By selecting the path with the smallest transmission time to transmit data, the efficiency of data transmission is improved and the problem of low data transmission efficiency is solved.
Smart Images

Figure CN115914081B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computers, and in particular to a method, a device, a storage medium and an electronic device for measuring a network round trip time. Background Art
[0002] In the prior art, when the current address sends data to the destination address, due to route load balancing, there may be multiple different paths to the destination address. However, although different paths are equivalent, the round-trip delays may be different. If a path with a high round-trip delay is used to send data, the data transmission efficiency will be low. Summary of the invention
[0003] The embodiments of the present invention provide a method, device, storage medium and electronic device for measuring network round trip time, so as to at least solve the technical problem of low data transmission efficiency.
[0004] According to a first aspect of an embodiment of the present invention, a method for measuring network round-trip time is provided, comprising: before sending a target data packet to a destination address, selecting multiple first paths from all transmission paths used to transmit data packets between the destination address; according to the transmission duration of each first path in the above-mentioned multiple first paths, determining the first target path with the shortest transmission duration from the above-mentioned multiple first paths, wherein the above-mentioned transmission duration is the duration from the sending time point of sending the data packet to the above-mentioned destination address to the receiving time point of receiving a reply packet returned by the above-mentioned destination address; sending the above-mentioned target data packet to the above-mentioned destination address via the above-mentioned first target path.
[0005] According to another aspect of an embodiment of the present invention, a device for measuring network round-trip time is provided, including: a selection unit, used to select multiple first paths from all transmission paths used to transmit data packets between the destination address before sending a target data packet to the destination address; a determination unit, used to determine the first target path with the shortest transmission time from the multiple first paths according to the transmission time of each first path in the multiple first paths, wherein the transmission time is the time from the sending time point of sending the data packet to the above-mentioned destination address to the receiving time point of receiving a reply packet returned by the above-mentioned destination address; a sending unit, used to send the above-mentioned target data packet to the above-mentioned destination address via the above-mentioned first target path.
[0006] According to another aspect of the embodiments 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 method for measuring the network round trip time 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 network round-trip time through the computer program.
[0008] In an embodiment of the present invention, before sending a target data packet to a destination address, multiple first paths are selected from all transmission paths for transmitting data packets between the destination address and the destination address; according to the transmission time of each first path in the multiple first paths, the first target path with the shortest transmission time is determined from the multiple first paths, wherein the transmission time is the time from the sending time point of sending the data packet to the destination address to the receiving time point of receiving the reply packet returned by the destination address; the method of sending the target data packet to the destination address through the first target path, because in the above method, when transmitting data, although there are multiple paths available for transmission, the first target path with the shortest transmission time is selected to transmit data according to the size of the transmission time of the path, thereby improving the efficiency of transmitting data. Thus, the technical problem of low data transmission efficiency is 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 network round trip time according to an embodiment of the present invention;
[0011] Figure 2 is a schematic diagram of selecting a first path in a selection window of an optional method for measuring a network round trip time according to an embodiment of the present invention;
[0012] Figure 3 is a schematic diagram of replacing a first path with a selection window in an optional method for measuring a network round trip time according to an embodiment of the present invention;
[0013] Figure 4 The diagram is a schematic structural diagram of an optional device for measuring network round-trip time 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] 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.
[0018] 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.
[0019] According to a first aspect of an embodiment of the present invention, a method for measuring a network round trip time is provided. Optionally, as follows: Figure 1 As shown, the above method includes:
[0020] S102, before sending a target data packet to a destination address, selecting a plurality of first paths from all transmission paths for transmitting data packets between the destination address and the destination address;
[0021] S104, according to the transmission time of each first path in the plurality of first paths, determining a first target path with the shortest transmission time from the plurality of first paths, wherein the transmission time is the time from the sending time point of sending a data packet to the destination address to the receiving time point of receiving a reply packet returned by the destination address;
[0022] S106, sending the target data packet to the destination address through the first target path.
[0023] Optionally, the above method can be applied to, but not limited to, the process of sending a data packet from the current address to the destination address. If a data packet is to be sent, all transmission paths that can send the data packet can be determined. Then, the RTT of each transmission path is determined, and the transmission path with the smallest RTT is selected to send the data packet. In the process of measuring the network RTT, the sender and receiver of the data packet can transmit the data packet to measure the RTT 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. In this embodiment, the current address can select multiple first paths from all transmission paths, send a data packet to the destination address through the multiple first paths, and receive the reply packet returned by the destination address. Then, for each first path, a corresponding RTT can be obtained. And according to the RTT, the best first target path is determined from the multiple first paths. Sending a data packet to the destination address through the first target path can improve the efficiency of sending data packets.
[0024] Optionally, in this embodiment, the contents of the data packets sent by the above different first paths may be different. For example, the contents of the first data packet sent by path 1 in the first path may be different from the contents of the first data packet sent by path 2 in the first path.
[0025] Through this embodiment, in the process of transmitting data packets, multiple first paths can be used to send data packets from the current address to the destination address, and then the RTT of each path is determined, and the path with the smallest RTT is used to transmit the data packets, thereby improving the transmission efficiency of the data packets.
[0026] As an optional example, after determining a first target path with the shortest transmission time from the multiple first paths according to the transmission time of each of the multiple first paths, the method further includes:
[0027] Repeat the following steps:
[0028] At predetermined time intervals, the plurality of first paths are sorted according to the transmission time lengths of the plurality of first paths to obtain a sorting result;
[0029] In the N sorting results obtained by N sortings, if there is a case where the average transmission time of the second path is smaller than the transmission time of the first target path, the second path is used as a new first target path.
[0030] Optionally, in this embodiment, for the selected multiple first paths, the corresponding RTT may change. Therefore, for multiple first paths, the selection does not stop after the first target path is selected. Instead, the best first target path is selected as time goes by. In this embodiment, the predetermined duration can be a system-set or manually-set duration. Such as 10 seconds, 30 seconds, etc. At every predetermined duration, the multiple first paths are sorted according to the transmission duration of each first path, and the sorting order is in the order of transmission duration from small to large. The first path with the shortest transmission duration is sorted first.
[0031] In this embodiment, the transmission time of the first path that is closest to the front in the sorting result can be compared with the transmission time of the first target path. If the transmission time of the first path that is closest to the front is smaller than the transmission time of the first target path, the first path that is closest to the front is determined as the new first target path. When transmitting data, the new first target path is used to transmit the data.
[0032] Of course, in this embodiment, in order to ensure that the transmission time of a first path caused by network jitter is temporarily short, the results of multiple sortings can be used as the basis. If the transmission time of a path in the first path is the shortest in the sorting results of N sortings, the average transmission time of the path can be determined. If the average value is less than the transmission time of the first target path, the path is used as the new first target path.
[0033] For example, in the three adjacent sortings, if there is a second path whose average transmission time is less than the transmission time of the first target path, then the second path can be used as the first target path and data can be transmitted through the path. If there are multiple second paths that meet the conditions, the second path with the smallest average transmission time can be selected as the first target path.
[0034] As an optional example, at every predetermined time period, the plurality of first paths are sorted according to the transmission time lengths of the plurality of first paths, and after the sorting result is obtained, the method further includes:
[0035] Count the transmission time of each first path in the current sorting result;
[0036] The average transmission time of each first path in the current sorting result and the first N-1 sorting results is calculated, where N is a positive integer.
[0037] Optionally, in this embodiment, when determining the average transmission time of each first path, the transmission time of each sorting result may be counted and the average value may be calculated. Alternatively, the most recent statistical results may be taken to calculate the average transmission time of each first path. Taking the most recent statistical results for calculation may prevent a longer transmission time of a first path with a shorter transmission time from affecting the actual transmission time of the path.
[0038] As an optional example, before sending the target data packet to the destination address, selecting a plurality of first paths from all transmission paths for transmitting data packets between the destination address and the destination address includes:
[0039] A selection window with a length of M is used to select M transmission paths from all transmission paths as a plurality of first paths, wherein M is a positive integer.
[0040] Optionally, in this embodiment, a selection window may be used to select multiple first paths. Figure 2 As shown, for example, there are 10 transmission paths from the current address to the destination address, which are represented by 1 to 10. A selection window 202 is used to select 4 of them (1 to 4) as first paths, and among the 4 first paths, the first target path can be determined according to the RTT.
[0041] As an optional example, after using a selection window with a length of M to select M transmission paths from all transmission paths as the plurality of first paths, the method further includes:
[0042] If, among the multiple first paths, there is a third path whose selection duration reaches a timeout duration, the third path is deleted from the selection window, wherein the selection duration is the duration from when a path is selected as the first path to the current moment, and the timeout duration is the duration configured for each first path;
[0043] From all transmission paths except the plurality of first paths, a transmission path is selected in sequence as a new first path and filled into the selection window.
[0044] Optionally, in this embodiment, the multiple first paths selected by the selection window are not constant. Each first path is configured with a timeout duration. If the selection duration of the first path reaches the timeout duration, it means that the first path has not been selected as the first target path within the selection duration. This means that the RTT of the first path is not optimal. At this time, the first path is deleted from the selection window, and a path is selected from all transmission paths as the first path to complete the selection. At this time, the number of paths in the selection window can be guaranteed to remain unchanged, but the first path with a higher RTT that has not been selected has been deleted from the selection window.
[0045] For example, Figure 3 As shown, Figure 3 In the example, still taking 10 transmission paths 1-10 as an example, the selection window 202 is used to select 4 transmission paths 1 to 4 as the first path, and the first target path is determined. When the selection duration of the first path 3 reaches the timeout duration, the first path 3 is deleted from the selection window 202, and a path is added from all transmission paths as the first path and filled into the selection window. When adding the first path to the selection window, the path that has not been added to the selection window is selected until all transmission paths are traversed. If all transmission paths have been added to the selection window, all transmission paths can be traversed repeatedly.
[0046] As an optional example, determining the first target path from the multiple first paths according to the transmission duration of each first path in the multiple first paths includes:
[0047] Take each first path as the current path and perform the following operations on the current path:
[0048] Sending a first data packet to a destination address via the current path;
[0049] Recording the time point of sending the first data packet;
[0050] Receive a second data packet returned by the destination address through the current path;
[0051] Recording the time point at which the second data packet is received;
[0052] The duration from the sending time point to the receiving time point is determined as the transmission duration of the current path.
[0053] 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. When the current address sends the first data packet, it records the first sending time point of each first path sending the first data packet, 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.
[0054] Optionally, in this embodiment, due to ECMP, the router usually uses the five-tuple (source IP, source port, protocol, destination IP, destination port) of the network as the basis for multi-path load balancing. Therefore, the fixed five-tuple means that in the ECMP scenario, there is a fixed and specific router to bear the traffic, which means that there is a relatively fixed time cost.
[0055] By trying different five-tuples, different data can be sent to different ECMP routes. By measuring their RTT, a five-tuple path with the best RTT can be obtained.
[0056] For example, the ports (paths) available for data transmission are 1024-50000, and a number (for example, 20) of available ports are obtained (sequentially / randomly). The 20 ports are multiple first paths.
[0057] The source address, available port, protocol, destination address and destination port form a five-tuple.
[0058] Pingpong detection is performed on the other end based on each quintuple, and a different RTT can be obtained for each group of quintuples.
[0059] These RTTs are sorted to obtain the quintuple with the optimal RTT.
[0060] The five-tuple is the five-tuple link with the optimal RTT. Therefore, the optimal RTT and related links are obtained. The five-tuple link with the optimal RTT is used to transmit data, thereby improving data transmission efficiency.
[0061] 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.
[0062] According to another aspect of an embodiment of the present invention, a device for implementing the above method for measuring network round trip time is also provided. Figure 4 As shown, the device comprises:
[0063] A selection unit 402, configured to select a plurality of first paths from all transmission paths for transmitting data packets between the destination address and the destination address before sending the target data packet to the destination address;
[0064] The determining unit 404 is configured to determine a first target path with the shortest transmission time from the multiple first paths according to the transmission time of each first path in the multiple first paths, wherein the transmission time is the time from the sending time point of sending a data packet to the destination address to the receiving time point of receiving a reply packet returned by the destination address;
[0065] The sending unit 406 is configured to send a target data packet to a destination address via a first target path.
[0066] Optionally, the above device can be applied to, but not limited to, the process of sending a data packet from the current address to the destination address. If a data packet is to be sent, all transmission paths that can send the data packet can be determined. Then, the RTT of each transmission path is determined, and the transmission path with the smallest RTT is selected to send the data packet. In the process of measuring the network RTT, the sender and receiver of the data packet can transmit the data packet to measure the RTT 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. In this embodiment, the current address can select multiple first paths from all transmission paths, send a data packet to the destination address through the multiple first paths, and receive the reply packet returned by the destination address. Then, for each first path, a corresponding RTT can be obtained. And according to the RTT, the best first target path is determined from the multiple first paths. Sending a data packet to the destination address through the first target path can improve the efficiency of sending data packets.
[0067] Optionally, in this embodiment, the contents of the data packets sent by the above different first paths may be different. For example, the contents of the first data packet sent by path 1 in the first path may be different from the contents of the first data packet sent by path 2 in the first path.
[0068] Through this embodiment, in the process of transmitting data packets, multiple first paths can be used to send data packets from the current address to the destination address, and then the RTT of each path is determined, and the path with the smallest RTT is used to transmit the data packets, thereby improving the transmission efficiency of the data packets.
[0069] As an optional implementation, the above device also includes:
[0070] A processing unit is configured to repeatedly perform the following operations after determining a first target path from the plurality of first paths according to the transmission duration of each of the plurality of first paths:
[0071] At predetermined time intervals, the plurality of first paths are sorted according to the transmission time lengths of the plurality of first paths to obtain a sorting result;
[0072] In the N sorting results obtained by N sortings, if there is a second path whose average transmission time is smaller than the transmission time of the first target path, the second path is used as a new first target path.
[0073] Optionally, in this embodiment, for the selected multiple first paths, the corresponding RTT may change. Therefore, for multiple first paths, the selection does not stop after the first target path is selected. Instead, as time goes by, the best first target path is always selected. In this embodiment, the predetermined duration can be a system-set or manually-set duration. Such as 10 seconds, 30 seconds, etc. At every predetermined duration, the multiple first paths are sorted according to the transmission duration of each first path, and the sorting order is from small to large. The first path with the shortest transmission duration is sorted first.
[0074] In this embodiment, the transmission time of the first path that is closest to the front in the sorting result can be compared with the transmission time of the first target path. If the transmission time of the first path that is closest to the front is smaller than the transmission time of the first target path, the first path that is closest to the front is determined as the new first target path. When transmitting data, the new first target path is used to transmit the data.
[0075] Of course, in this embodiment, in order to ensure that the transmission time of a first path caused by network jitter is temporarily short, the results of multiple sortings can be used as the basis. If the transmission time of a path in the first path is the shortest in the sorting results of N sortings, the average transmission time of the path can be determined. If the average value is less than the transmission time of the first target path, the path is used as the new first target path.
[0076] For example, in the three adjacent sortings, if there is a second path whose average transmission time is less than the transmission time of the first target path, then the second path can be used as the first target path and data can be transmitted through the path. If there are multiple second paths that meet the conditions, the second path with the smallest average transmission time can be selected as the first target path.
[0077] As an optional implementation manner, the processing unit is further configured to:
[0078] At predetermined time intervals, the plurality of first paths are sorted according to the transmission durations of the plurality of first paths, and after obtaining the sorting results, the transmission duration of each first path in the current sorting results is counted;
[0079] The average transmission time of each first path in the current sorting result and the first N-1 sorting results is calculated, where N is a positive integer.
[0080] Optionally, in this embodiment, when determining the average transmission time of each first path, the transmission time of each sorting result may be counted and the average value may be calculated. Alternatively, the most recent statistical results may be taken to calculate the average transmission time of each first path. Taking the most recent statistical results for calculation may prevent a longer transmission time of a first path with a shorter transmission time from affecting the actual transmission time of the path.
[0081] As an optional implementation manner, the selection unit includes:
[0082] The first selection module is used to select M transmission paths from all transmission paths as multiple first paths using a selection window with a length of M, where M is a positive integer.
[0083] Optionally, in this embodiment, a selection window may be used to select multiple first paths. Figure 2 As shown, for example, there are 10 transmission paths from the current address to the destination address, which are represented by 1 to 10. A selection window 202 is used to select 4 of them (1 to 4) as first paths, and among the 4 first paths, the first target path can be determined according to the RTT.
[0084] As an optional implementation manner, the selection unit further includes:
[0085] a deleting module, configured to, after selecting M transmission paths from all transmission paths as a plurality of first paths using a selection window of length M, delete the third path from the selection window if a selection duration of a third path among the plurality of first paths reaches a timeout duration, wherein the selection duration is the duration from when a path is selected as the first path to the current moment, and the timeout duration is the duration configured for each first path;
[0086] The second selection module is used to select a transmission path from all transmission paths except the multiple first paths in sequence and fill it into the selection window as a new first path.
[0087] Optionally, in this embodiment, the multiple first paths selected by the selection window are not fixed. Each first path is configured with a timeout duration. If the selection duration of the first path reaches the timeout duration, it means that the first path has not been selected as the first target path within the selection duration. This means that the RTT of the first path is not optimal. At this time, the first path is deleted from the selection window, and a path is selected from all transmission paths as the first path to complete the selection. At this time, the number of paths in the selection window can be guaranteed to remain unchanged, but the first path with a higher RTT that has not been selected has been deleted from the selection window.
[0088] For example, Figure 3 As shown, Figure 3 In the example, 10 transmission paths 1-10 are still used, and 4 transmission paths 1 to 4 are selected as the first path using the selection window 202, and the first target path is determined. When the selection duration of the first path 3 reaches the timeout duration, the first path 3 is deleted from the selection window 202, and a path is added from all transmission paths as the first path and filled into the selection window.
[0089] As an optional implementation manner, the above-mentioned determination unit includes:
[0090] The processing module is used to take each first path as a current path and perform the following operations on the current path:
[0091] Sending a first data packet to a destination address via the current path;
[0092] Recording the time point of sending the first data packet;
[0093] Receive a second data packet returned by the destination address through the current path;
[0094] Recording the time point at which the second data packet is received;
[0095] The duration from the sending time point to the receiving time point is determined as the transmission duration of the current path.
[0096] 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. When the current address sends the first data packet, it records the first sending time point of each first path sending the first data packet, 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.
[0097] Optionally, in this embodiment, due to ECMP, the router usually uses the five-tuple (source IP, source port, protocol, destination IP, destination port) of the network as the basis for multi-path load balancing. Therefore, the fixed five-tuple means that in the ECMP scenario, there is a fixed and specific router to bear the traffic, which means that there is a relatively fixed time cost.
[0098] By trying different five-tuples, different data can be sent to different ECMP routes. By measuring their RTT, a five-tuple path with the best RTT can be obtained.
[0099] For example, the ports (paths) available for data transmission are 1024-50000, and a number (for example, 20) of available ports are obtained (sequentially / randomly). The 20 ports are multiple first paths.
[0100] The source address, available port, protocol, destination address and destination port form a five-tuple.
[0101] Pingpong detection is performed on the other end based on each quintuple, and a different RTT can be obtained for each group of quintuples.
[0102] These RTTs are sorted to obtain the quintuple with the optimal RTT.
[0103] The five-tuple is the five-tuple link with the optimal RTT. Therefore, the optimal RTT and related links are obtained. The five-tuple link with the optimal RTT is used to transmit data, thereby improving data transmission efficiency.
[0104] According to another aspect of an embodiment of the present invention, an electronic device for implementing the above-mentioned method for measuring network round-trip time is also provided. The electronic device may include a memory and a processor. The memory stores a computer program. The processor is configured to execute the steps in the embodiment of the method for measuring network round-trip time of the above-mentioned first aspect or the method for measuring network round-trip time of the above-mentioned second aspect through the computer program.
[0105] 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 network round-trip time of the first and second aspects mentioned above when running.
[0106] 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.
[0107] 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.
[0108] 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.
[0109] 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.
[0110] 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.
[0111] 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.
[0112] 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.
[0113] 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 network round-trip time, It is characterized in that include: Before sending the target data packet to the destination address, selecting a plurality of first paths from all transmission paths for transmitting data packets between the destination address and the destination address; According to the transmission time of each first path among the multiple first paths, determine the first target path with the shortest transmission time from the multiple first paths, wherein the transmission time is the time from the sending time point of sending the data packet to the destination address to the receiving time point of receiving the reply packet returned by the destination address; Sending the target data packet to the destination address via the first target path; Wherein, before sending the target data packet to the destination address, selecting a plurality of first paths from all transmission paths for transmitting data packets between the destination address comprises: using a selection window with a length of M to select M transmission paths from all transmission paths as the plurality of first paths, wherein M is a positive integer; Among them, after using a selection window with a length of M to select M transmission paths from all the transmission paths as the multiple first paths, the method also includes: when there is a third path among the multiple first paths, the selection duration reaches a timeout duration, deleting the third path from the selection window, wherein the selection duration is the duration from the beginning of a path being selected as the first path to the current moment, and the timeout duration is the duration configured for each first path; from the transmission paths other than the multiple first paths among all the transmission paths, selecting a transmission path in sequence as a new first path and filling it into the selection window.
2. The method according to claim 1, It is characterized in that After determining a first target path from the plurality of first paths according to the transmission duration of each of the plurality of first paths, the method further includes: Repeat the following steps: At predetermined time intervals, the plurality of first paths are sorted according to the transmission time lengths of the plurality of first paths to obtain a sorting result; If, among the N sorting results obtained by N sortings, there is a second path whose average transmission time is less than the transmission time of the first target path, the second path is used as the new first target path.
3. The method according to claim 2, It is characterized in that At predetermined time intervals, the plurality of first paths are sorted according to the transmission durations of the plurality of first paths, and after obtaining the sorting result, the method further includes: Counting the transmission time length of each first path in the current sorting result; The average value of the transmission time of each of the first paths in the current sorting result and the first N-1 sorting results is calculated, where N is a positive integer.
4. The method according to any one of claims 1 to 3, It is characterized in that The determining a first target path from the plurality of first paths according to the transmission duration of each first path in the plurality of first paths comprises: Take each of the first paths as the current path, and perform the following operations on the current path: Sending a first data packet to the destination address via the current path; Recording the time point of sending the first data packet; Receive a second data packet returned by the destination address through the current path; Recording a time point at which the second data packet is received; The duration from the sending time point to the receiving time point is determined as the transmission duration of the current path.
5. A device for measuring network round trip time, It is characterized in that include: A selection unit, configured to select a plurality of first paths from all transmission paths for transmitting data packets between the destination address and the destination address before sending the target data packet to the destination address; a determining unit, configured to determine, from the plurality of first paths, a first target path with the shortest transmission time according to the transmission time of each first path among the plurality of first paths, wherein the transmission time is a time from a sending time point of sending a data packet to the destination address to a receiving time point of receiving a reply packet returned by the destination address; A sending unit, configured to send the target data packet to the destination address via the first target path; The selection unit includes: a first selection module, configured to select M transmission paths from all the transmission paths as the multiple first paths using a selection window of length M, wherein M is a positive integer; The selection unit also includes: a deleting module, configured to, after using a selection window with a length of M to select M transmission paths from all the transmission paths as the multiple first paths, delete the third path from the selection window if the selection duration of a third path among the multiple first paths reaches a timeout duration, wherein the selection duration is the duration from when a path is selected as the first path to the current moment, and the timeout duration is the duration configured for each of the first paths; The second selection module is used to select a transmission path from the transmission paths other than the multiple first paths in the transmission paths in sequence as a new first path to fill into the selection window.
6. The device according to claim 5, It is characterized in that The device also includes: A processing unit, configured to, after determining a first target path from the plurality of first paths according to a transmission duration of each of the plurality of first paths, repeatedly perform the following operations: At predetermined time intervals, the plurality of first paths are sorted according to the transmission time lengths of the plurality of first paths to obtain a sorting result; If, among the N sorting results obtained by N sortings, there is a second path whose average transmission time is less than the transmission time of the first target path, the second path is used as the new first target path.
7. The device according to claim 6, It is characterized in that The processing unit is also used for: At predetermined time intervals, the plurality of first paths are sorted according to the transmission durations of the plurality of first paths, and after obtaining the sorting results, the transmission duration of each of the first paths in the current sorting results is counted; The average value of the transmission time of each of the first paths in the current sorting result and the first N-1 sorting results is calculated, where N is a positive integer.
8. The device according to any one of claims 5 to 7, It is characterized in that The determining unit comprises: A processing module is used to take each of the first paths as a current path and perform the following operations on the current path: Sending a first data packet to the destination address via the current path; Recording the time point of sending the first data packet; Receive a second data packet returned by the destination address through the current path; Recording a time point at which the second data packet is received; The duration from the sending time point to the receiving time point is determined as the transmission duration of the current path.
9. A computer-readable storage medium storing a computer program. It is characterized in that The computer program executes the method described in any one of claims 1 to 4 when executed.
10. An electronic device comprising a memory and a processor, It is 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 4 through the computer program.
Citation Information
Patent Citations
Path selection method and system based on multi-path transmission protocol, and node server
CN108449772A
Communication path selection method, equipment and communication system
CN112040526A