Message forwarding method, device, electronic device and storage medium
By dividing and assigning weighted source port pools on the source device, ECMP path selection is optimized, solving the problem of long service message transmission delays and achieving faster message transmission.
Patent Information
- Application Number
- CN202311220346.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-20
- Publication Date
- 2025-10-03
- Estimated Expiration
- 2043-09-20
AI Technical Summary
When using equal-cost multi-path (ECMP) to forward service messages, the existing technology does not consider the actual transmission conditions of the paths, resulting in a long service message transmission delay.
The source device calculates the path status by sending RTT probe packets, divides source ports with the same path status into the same source port pool, assigns a weight to each source port pool, and polls in descending order of weight to control the forwarding path of service packets.
By optimizing path selection, paths with good path status forward more service packets, while paths with poor path status forward fewer service packets, fully utilizing ECMP paths and shortening packet transmission delay.
Smart Images

Figure CN119728606B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to a message forwarding method, device, electronic device and storage medium. Background Art
[0002] When the source device forwards a service packet to the destination device using ECMP (Equal Cost Multi-Path), it can perform a hash operation based on the service packet's five-tuple information (i.e., the service packet's source IP address, source port number, destination IP address, destination port number, and protocol type) and forward the service packet using the path corresponding to the hash operation result. Alternatively, it can forward the service packet using the currently polled path.
[0003] Regardless of the method used to forward business messages, the actual transmission conditions of the path are not taken into consideration. Even if the network status of a path is poor, business messages will still be transmitted, which will result in a long message transmission delay for the business messages. Summary of the Invention
[0004] In order to overcome the problems existing in the related art, the present application provides a message forwarding method, device, electronic device and storage medium.
[0005] According to a first aspect of an embodiment of the present application, a message forwarding method is provided, the method being applied to a source device, the method comprising:
[0006] For each source port, sending a first message whose source port is the source port to the destination device, wherein the first message is a first service message or a first RTT detection message;
[0007] If a response message to the first message is received within the set time period, the RTT value is calculated based on a first timestamp when the first message is sent and a second timestamp when the response message is received;
[0008] Determining a path state of a path for transmitting the first message according to the calculated RTT value;
[0009] All source ports corresponding to the same path state are divided into the same source port pool, and a weight is assigned to each source port pool. Different source port pools have different weights, and the higher the weight, the shorter the transmission delay of the path corresponding to the path state corresponding to the corresponding source port pool.
[0010] Sort all source port pools that meet the preset conditions in descending order of weight;
[0011] When it is necessary to send a second service message to the destination device for the current time, determine the source port that needs to be polled for the current time according to the polling method of polling the sorted source port pools based on the weight ratio of each sorted source port pool and the last polling information, and use the determined source port as the source port of the second service message;
[0012] Based on the quintuple information of the second service message, ECMP forwarding is performed on the second service message.
[0013] According to a second aspect of an embodiment of the present application, a message forwarding device is provided, the device being applied to a source device, the device comprising:
[0014] A path detection module is configured to send, for each source port, a first message with the source port being the source port to a destination device, wherein the first message is a first service message or a first RTT detection message; if a response message to the first message is received within a set time period, calculate an RTT value based on a first timestamp when the first message is sent and a second timestamp when the response message is received; and determine, based on the calculated RTT value, a path state of a path for transmitting the first message;
[0015] A multipath control module is configured to divide all source ports corresponding to the same path state into the same source port pool and assign a weight to each source port pool, wherein different source port pools correspond to different weights, and the higher the weight, the shorter the transmission delay of the path corresponding to the path state corresponding to the corresponding source port pool; sort the source port pools that meet preset conditions in all source port pools in descending order of weight; and when a second service message needs to be sent to the destination device for the current time, determine the source port that needs to be polled for the current time according to the polling method of the sorted source port pools based on the weight ratio of each sorted source port pool and the last polling information, and use the determined source port as the source port of the second service message;
[0016] The ECMP module is used to perform ECMP forwarding on the second business message based on the quintuple information of the second business message.
[0017] According to the third aspect of an embodiment of the present application, an electronic device is provided, comprising a processor and a machine-readable storage medium, wherein the machine-readable storage medium stores machine-executable instructions that can be executed by the processor, and the processor is prompted by the machine-executable instructions to implement the method steps of the above-mentioned message forwarding method.
[0018] According to a fourth aspect of an embodiment of the present application, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps of the above-mentioned message forwarding method are implemented.
[0019] The technical solutions provided by the embodiments of the present application may have the following beneficial effects:
[0020] In an embodiment of the present application, the source device can divide the source ports configured on the source device into different port pools based on the path status, and control the source ports used for the service messages that need to be sent to the destination device based on the polling mechanism of the polling-related port pools, so that the path with a good path status can forward more service messages, and the path with a poor path status can forward fewer service messages, thereby making full use of the ECMP path and shortening the message transmission delay to a certain extent.
[0021] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0023] Figure 1 A flowchart of a message forwarding method provided in an embodiment of the present application;
[0024] Figure 2 A schematic diagram of determining the source port of a service message provided in an embodiment of the present application;
[0025] Figure 3 A schematic diagram of the structure of a message forwarding device provided in an embodiment of the present application;
[0026] Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0027] Exemplary embodiments will be described in detail herein, with examples illustrated in the accompanying drawings. In the following description, when referring to the drawings, identical numerals in different figures represent identical or similar elements, unless otherwise indicated. The embodiments described in the following exemplary embodiments are not intended to represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present application, as detailed in the appended claims.
[0028] The terms used in this application are for the purpose of describing specific embodiments only and are not intended to limit this application. As used in this application and the appended claims, the singular forms "a," "an," "the," and "the" are intended to include the plural forms, unless the context clearly indicates otherwise. It should also be understood that the term "and / or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.
[0029] It should be understood that although the terms first, second, third, etc. may be used in this application to describe various information, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from each other. For example, without departing from the scope of this application, first information may also be referred to as second information, and similarly, second information may also be referred to as first information. Depending on the context, the words "if" or "if" as used herein may be interpreted as "when" or "when".
[0030] Next, the embodiments of the present application are described in detail.
[0031] The embodiment of the present application provides a message forwarding method, which is applied to a source device, such as Figure 1 As shown, the method may include the following steps:
[0032] S11 . For each source port, send a first message whose source port is the source port to a destination device.
[0033] In this step, the first message is a first service message or a first round-trip time (RTT) detection message.
[0034] S12. If a response message to the first message is received within the set time period, the RTT value is calculated based on a first timestamp when the first message is sent and a second timestamp when the response message is received.
[0035] S13: Determine the path status of the path for transmitting the first message according to the calculated RTT value.
[0036] In this step, the path for transmitting the first message refers to a path in the ECMP path between the source device and the destination device.
[0037] S14. Divide all source ports corresponding to the same path state into the same source port pool, and assign a weight to each source port pool.
[0038] In this step, different source port pools correspond to different weights, and the higher the weight, the smaller the transmission delay of the path corresponding to the path state corresponding to the corresponding source port pool.
[0039] S15. Sort the source port pools that meet the preset conditions in all source port pools in descending order of weight.
[0040] S16. When the second service message needs to be sent to the destination device this time, the source port that needs to be polled this time is determined according to the polling method of the sorted source port pool based on the weight ratio of each sorted source port pool and the last polling information, and the determined source port is used as the source port of the second service message.
[0041] S17: Perform ECMP forwarding on the second service message based on the quintuple information of the second service message.
[0042] Specifically, in the above step S11, when the first message is a first service message, the first service messages sent to the destination device may be different service messages of the same service flow or service messages of different service flows.
[0043] Specifically, in step S12 above, the source device calculates the RTT value in the following manner:
[0044] A subtraction operation is performed on the second timestamp and the first timestamp to obtain an RTT value.
[0045] It should be noted that, in the above step S12, the set duration can be set by the administrator based on experience and pre-configured on the source device.
[0046] In the above step S13, the source device may determine the path status of the path for transmitting the first message by the following method, specifically including:
[0047] If the calculated RTT value is not greater than the preset reference value, the path state of the path is determined to be the optimal path state;
[0048] If the calculated RTT value is greater than a preset reference value but not greater than a first threshold, determining that the path state of the path is a suboptimal path state;
[0049] If the calculated RTT value is greater than the first threshold but not greater than the second threshold, determining that the path state of the path is a congested path state;
[0050] If the calculated RTT value is greater than the second threshold, the path state of the path is determined to be an unavailable path state.
[0051] Of course, in the embodiment of the present application, the source-end device may also determine the path status of the path for transmitting the first message in other ways, which are not listed here one by one.
[0052] It should be noted that the above-mentioned preset reference value, first threshold value and second threshold value can be set by an administrator based on experience and pre-configured on the source device.
[0053] In one example, when the preset reference value is D, the first threshold may be (1+20%)×D, and the second threshold may be (1+50%)×D.
[0054] It should be further explained that, in the embodiment of the present application, for the source device, if no response message is received within a set time period, the path status of the above path is determined to be an unavailable path status.
[0055] Specifically, in the above step S14, the source device may determine a source port pool that meets the preset conditions in the following manner:
[0056] The source port pools whose corresponding path states are not in the unavailable path state among all the source port pools are determined as target source port pools that meet the preset conditions.
[0057] In this way, subsequent service messages sent from the source device to the destination device will not be transmitted on the path corresponding to the unavailable path state, which shortens the message transmission delay to a certain extent.
[0058] Specifically, in the above step S15, when the source end device sorts the source port pools that meet the preset conditions in all source port pools in order of weight from high to low, it can sort the source port pools whose corresponding path status is not an unavailable path status in all source port pools in order of weight from high to low.
[0059] In the above step S16, the source device may determine the source port that needs to be polled currently by:
[0060] If the current time is the first time, the source port to be polled is determined to be the first source port in the first source port pool after sorting;
[0061] If the current time is not for the first time and the source port of the last poll included in the polling information is not the last source port in the source port pool of the last poll included in the polling information, then determine that the source port that needs to be polled at the current time is the next source port corresponding to the source port of the last poll;
[0062] If the current time is not the first time, and the source port of the last poll is the last source port in the source port pool of the last poll, then when the polling number value corresponding to the source port pool of the last poll included in the polling information does not reach the weight ratio corresponding to the source port pool of the last poll, it is determined that the source port to be polled currently is the first source port in the source port pool of the last poll; or,
[0063] When the polling number value corresponding to the source port pool polled last time reaches the weight ratio value corresponding to the source port pool polled last time, it is determined that the source port to be polled currently is the first source port in the next source port pool corresponding to the source port pool polled last time, wherein, when the source port pool polled last time is the last source port pool after sorting, the next source port pool is the first source port pool after sorting.
[0064] For example, Figure 2 As shown in the figure, it is assumed that the sorted source port pools are source port pool 1, source port pool 2, and source port pool 3; the path state corresponding to source port pool 1 is the optimal path state, the path state corresponding to source port pool 2 is the suboptimal path state, and the path state corresponding to source port pool 3 is the congested path state; and the weight ratio of these three source port pools is 3:2:1. It is assumed that source port pool 1 includes source port 1, source port 2, and source port 3; source port pool 2 includes source port 4 and source port 5; and source port pool 3 includes source port 6 and source port 7. Here, Figure 2 Only the port numbers are shown.
[0065] Assuming that the source device needs to send service message 1 (abbreviated as message 1) to the destination device this time, and this is the first time, then the source device determines that the source port that needs to be polled for the first time is the first source port in source port pool 1 (i.e., source port 1), and uses source port 1 as the source port of message 1.
[0066] Assume that the source device needs to send service message 11 (abbreviated as message 11) to the destination device this time, and the current time is not the first time, and assume that the source port of the last poll included in the polling information is source port 4 (not the last source port in the source port pool of the last poll included in the polling information (i.e., source port pool 2), at this time, the source device determines that the source port that needs to be polled this time is the next source port corresponding to the source port of the last poll (i.e., source port 5), and uses source port 5 as the source port of message 11.
[0067] Assume that the source device needs to send service message 12 (abbreviated as message 12) to the destination device this time, and the current time is not the first time, and assume that the source port of the last poll is source port 5 (the last source port in the source port pool of the last poll (i.e., source port pool 2), and the polling number value corresponding to the source port pool of the last poll (i.e., source port pool 2) included in the polling information (assumed to be 1) is different from the weight ratio value corresponding to the source port pool of the last poll (i.e., source port pool 2) (i.e., 2). At this time, the source device determines that the source port that needs to be polled this time is the first source port in the source port pool of the last poll (i.e., source port 4), and uses source port 4 as the source port of message 12.
[0068] Assume that the source device needs to send service message 14 (abbreviated as message 14) to the destination device this time, and the current time is not the first time, and assume that the source port of the last poll is source port 5 (the last source port in the source port pool of the last poll (i.e., source port pool 2), and the polling number value corresponding to the source port pool of the last poll (i.e., source port pool 2) (assumed to be 2) is the same as the weight ratio value (i.e., 2) corresponding to the source port pool of the last poll (i.e., source port pool 2). At this time, the source device determines that the source port that needs to be polled this time is the first source port in the next source port pool corresponding to the source port pool of the last poll (i.e., source port 6), and uses source port 6 as the source port of message 14.
[0069] Assume that the source device needs to send service message 16 (abbreviated as message 16) to the destination device at this time. Figure 2 ), and the current time is not the first time, and assuming that the source port of the last poll is source port 7 (the last source port in the source port pool of the last poll (i.e., source port pool 3), and the polling number value (assuming it is 1) corresponding to the source port pool of the last poll (i.e., source port pool 3) is the same as the weight ratio (i.e., 1) corresponding to the source port pool of the last poll (i.e., source port pool 3), at this time, the source end device determines that the source port that needs to be polled this time is the first source port (i.e., source port 1) in the next source port pool corresponding to the source port pool of the last poll, and uses source port 1 as the source port of message 16.
[0070] It should be noted that, in the above step S17, the specific forwarding process of the source device performing ECMP forwarding on the second service message is an existing technology and will not be described in detail here.
[0071] Furthermore, in the embodiment of the present application, the source device may further perform the following operations:
[0072] The first operation: after all source ports corresponding to the same path state are divided into the same source port pool, for each source port, a second RTT detection message with the source port as the source port is sent to the destination device according to a set period;
[0073] If no RTT response message is received for the second RTT probe message within the set period, the path state of the path for transmitting the second RTT probe message is determined to be an unavailable path state, and when the determined path state is different from the path state corresponding to the source port pool where the source port is currently located, the source port is deleted from the corresponding source port pool and added to the source port pool corresponding to the unavailable path state, or when the determined path state is the same as the path state corresponding to the source port pool where the source port is currently located, no operation is performed;
[0074] If an RTT response message is received within a set period, the RTT value is calculated based on the third timestamp when the second RTT detection message is sent and the fourth timestamp when the RTT response message is received. According to the calculated RTT value, the path state of the path for transmitting the second RTT detection message is determined. When the determined path state is different from the path state corresponding to the source port pool where the source port is currently located, the source port is deleted from the corresponding source port pool and added to the source port pool corresponding to the determined path state. Alternatively, when the determined path state is the same as the path state corresponding to the source port pool where the source port is currently located, no operation is performed.
[0075] The second operation is: when receiving a response message to the second service message, calculating an RTT value based on a fifth timestamp when the second service message is sent and a sixth timestamp when the response message to the second service message is received, and determining a path status of a path for transmitting the second service message based on the calculated RTT value;
[0076] When the determined path state is different from the path state corresponding to the source port pool where the source port is currently located, the source port is deleted from the corresponding source port pool and added to the source port pool corresponding to the determined path state, or,
[0077] When the determined path state is the same as the path state corresponding to the source port pool where the source port currently resides, no operation is performed.
[0078] Regardless of which of the first and second operations the source device performs, the corresponding source port pool can be refreshed in a timely manner in combination with the path status, and the ECMP path can be fully utilized to transmit service messages, thereby speeding up message forwarding, that is, shortening message transmission delay.
[0079] It should be noted that the above-mentioned set period can be set by the administrator based on experience and configured in advance on the source device.
[0080] It can be seen from the above technical solution that in an embodiment of the present application, the source device can divide the source ports configured on the source device into different port pools based on the path status, and control the source ports used for the service messages that need to be sent to the destination device based on the polling mechanism of the polling-related port pools, so that the path with a good path status can forward more service messages, and the path with a poor path status can forward fewer service messages, thereby making full use of the ECMP path and shortening the message transmission delay to a certain extent.
[0081] Based on the same inventive concept, the present application also provides a message forwarding device, which is applied to the source device, and its structural diagram is shown as follows: Figure 3 As shown, specifically including:
[0082] The path detection module 31 is configured to send, for each source port, a first message with the source port being the source port to a destination device, wherein the first message is a first service message or a first round-trip time (RTT) detection message; if a response message to the first message is received within a set time period, calculate an RTT value based on a first timestamp when the first message is sent and a second timestamp when the response message is received; and determine, based on the calculated RTT value, a path status of a path for transmitting the first message;
[0083] The multipath control module 32 is configured to divide all source ports corresponding to the same path state into the same source port pool and assign a weight to each source port pool, wherein different source port pools correspond to different weights, and the higher the weight, the shorter the transmission delay of the path corresponding to the path state corresponding to the corresponding source port pool; sort the source port pools that meet the preset conditions in order of weight from high to low; and when a second service message needs to be sent to the destination device for the current time, determine the source port that needs to be polled for the current time according to the polling method of the sorted source port pools based on the weight ratio of each sorted source port pool and the last polling information, and use the determined source port as the source port of the second service message;
[0084] The ECMP module 33 is configured to perform equal-cost multi-path ECMP forwarding on the second service message based on the quintuple information of the second service message.
[0085] Preferably, the path detection module 31 is specifically configured to calculate the RTT value in the following manner:
[0086] A subtraction operation is performed on the second timestamp and the first timestamp to obtain an RTT value.
[0087] Preferably, the path detection module 31 is specifically configured to determine the path status of the path for transmitting the first message in the following manner:
[0088] If the calculated RTT value is not greater than a preset reference value, determining that the path state of the path is the optimal path state;
[0089] If the calculated RTT value is greater than the preset reference value but not greater than the first threshold, determining that the path state of the path is a suboptimal path state;
[0090] If the calculated RTT value is greater than the first threshold but not greater than the second threshold, determining that the path state of the path is a congested path state;
[0091] If the calculated RTT value is greater than the second threshold, the path status of the path is determined to be an unavailable path status.
[0092] Preferably, the path detection module 31 is further configured to:
[0093] If the response message is not received within the set time period, it is determined that the path status of the path is an unavailable path status.
[0094] Preferably, the multipath control module 32 is specifically configured to:
[0095] In descending order of weight, the source port pools whose corresponding path states are not in the unavailable path state in all the source port pools are sorted.
[0096] Preferably, the multipath control module 32 is specifically configured to determine the source port that needs to be polled currently by:
[0097] If the current time is the first time, the source port to be polled is determined to be the first source port in the first source port pool after sorting;
[0098] If the current time is not the first time and the source port of the last poll included in the polling information is not the last source port in the source port pool of the last poll included in the polling information, then determining that the source port that needs to be polled currently is the next source port corresponding to the source port of the last poll;
[0099] If the current time is not the first time and the source port polled last time is the last source port in the source port pool polled last time, then when the polling number value corresponding to the source port pool polled last time included in the polling information is different from the weight ratio corresponding to the source port pool polled last time, it is determined that the source port to be polled this time is the first source port in the source port pool polled last time; or,
[0100] When the polling number value corresponding to the source port pool polled last time is the same as the weight ratio corresponding to the source port pool polled last time, it is determined that the source port to be polled currently is the first source port in the next source port pool corresponding to the source port pool polled last time, wherein, when the source port pool polled last time is the last source port pool after sorting, the next source port pool is the first source port pool after sorting.
[0101] Preferably, the path detection module 31 is further configured to:
[0102] After all source ports corresponding to the same path state are divided into the same source port pool, for each source port, a second RTT detection message having a source port as the source port is sent to the destination device according to a set period;
[0103] If no RTT response message is received for the second RTT detection message within the set period, the path state of the path for transmitting the second RTT detection message is determined to be an unavailable path state, and the multipath control module 32 is triggered to delete the source port from the corresponding source port pool and add it to the source port pool corresponding to the unavailable path state when the path state determined by the path detection module 31 is different from the path state corresponding to the source port pool where the source port is currently located, or, when the path state determined by the path detection module 31 is the same as the path state corresponding to the source port pool where the source port is currently located, no operation is performed;
[0104] If the RTT response message is received within the set period, the RTT value is calculated based on the third timestamp when the second RTT detection message is sent and the fourth timestamp when the RTT response message is received. According to the calculated RTT value, the path state of the path for transmitting the second RTT detection message is determined, and the multi-path control module 32 is triggered to delete the source port from the corresponding source port pool and add it to the source port pool corresponding to the determined path state when the path state determined by the path detection module 31 is different from the path state corresponding to the source port pool where the source port is currently located. Alternatively, no operation is performed when the path state determined by the path detection module 31 is the same as the path state corresponding to the source port pool where the source port is currently located.
[0105] Preferably, the path detection module 31 is further configured to:
[0106] Upon receiving a response message to the second service message, calculating an RTT value based on a fifth timestamp when the second service message was sent and a sixth timestamp when the response message to the second service message was received, and determining a path status of a path for transmitting the second service message based on the calculated RTT value;
[0107] The multipath control module 32 is further configured to:
[0108] When the path state determined by the path detection module 31 is different from the path state corresponding to the source port pool where the source port is currently located, the source port is deleted from the corresponding source port pool and added to the source port pool corresponding to the determined path state, or,
[0109] When the path status determined by the path detection module 31 is the same as the path status corresponding to the source port pool where the source port currently resides, no operation is performed.
[0110] It can be seen from the above technical solution that in an embodiment of the present application, the source device can divide the source ports configured on the source device into different port pools based on the path status, and control the source ports used for the service messages that need to be sent to the destination device based on the polling mechanism of the polling-related port pools, so that the path with a good path status can forward more service messages, and the path with a poor path status can forward fewer service messages, thereby making full use of the ECMP path and shortening the message transmission delay to a certain extent.
[0111] The present application also provides an electronic device, such as Figure 4 As shown, it includes a processor 41 and a machine-readable storage medium 42, wherein the machine-readable storage medium 42 stores machine-executable instructions that can be executed by the processor 41, and the processor 41 is prompted by the machine-executable instructions to implement the steps of the above-mentioned message forwarding method.
[0112] The machine-readable storage medium may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage device. Alternatively, the machine-readable storage medium may be at least one storage device located remote from the processor.
[0113] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, and discrete hardware components.
[0114] In another embodiment provided in the present application, a computer-readable storage medium is further provided, wherein a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the steps of the above-mentioned message forwarding method are implemented.
[0115] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application.
Claims
1. A message forwarding method, characterized in that: The method is applied to a source device, and includes: For each source port, send a first message whose source port is the source port to the destination device, wherein the first message is a first service message or a first round-trip time delay RTT detection message; If a response message to the first message is received within the set time period, the RTT value is calculated based on a first timestamp when the first message is sent and a second timestamp when the response message is received; Determining a path state of a path for transmitting the first message according to the calculated RTT value; All source ports corresponding to the same path state are divided into the same source port pool, and a weight is assigned to each source port pool. Different source port pools have different weights, and the higher the weight, the shorter the transmission delay of the path corresponding to the path state corresponding to the corresponding source port pool. Sort all source port pools that meet the preset conditions in descending order of weight; When it is necessary to send a second service message to the destination device for the current time, determine the source port that needs to be polled for the current time according to the polling method of polling the sorted source port pools based on the weight ratio of each sorted source port pool and the last polling information, and use the determined source port as the source port of the second service message; Based on the quintuple information of the second service message, equal-cost multi-path ECMP forwarding is performed on the second service message.
2. The method according to claim 1, characterized in that Calculating an RTT value based on a first timestamp when the first message is sent and a second timestamp when the response message is received, specifically comprising: A subtraction operation is performed on the second timestamp and the first timestamp to obtain an RTT value.
3. The method according to claim 1, characterized in that Determining, according to the calculated RTT value, a path status of a path for transmitting the first message, specifically including: If the calculated RTT value is not greater than a preset reference value, determining that the path state of the path is the optimal path state; If the calculated RTT value is greater than the preset reference value but not greater than the first threshold, determining that the path state of the path is a suboptimal path state; If the calculated RTT value is greater than the first threshold but not greater than the second threshold, determining that the path state of the path is a congested path state; If the calculated RTT value is greater than the second threshold, the path status of the path is determined to be an unavailable path status.
4. The method according to claim 1, wherein The method further comprises: If the response message is not received within the set time period, it is determined that the path status of the path is an unavailable path status.
5. The method according to claim 3, characterized in that Sort all source port pools that meet the preset conditions in descending order of weight, including: In descending order of weight, the source port pools whose corresponding path states are not in the unavailable path state in all the source port pools are sorted.
6. The method according to claim 1, characterized in that Determining the source port to be polled currently based on the polling method of the sorted source port pools based on the weight ratios of the sorted source port pools and the last polling information, specifically including: If the current time is the first time, the source port to be polled is determined to be the first source port in the first source port pool after sorting; If the current time is not the first time and the source port of the last poll included in the polling information is not the last source port in the source port pool of the last poll included in the polling information, then determining that the source port that needs to be polled currently is the next source port corresponding to the source port of the last poll; If the current time is not the first time and the source port polled last time is the last source port in the source port pool polled last time, then when the polling number value corresponding to the source port pool polled last time included in the polling information is different from the weight ratio corresponding to the source port pool polled last time, it is determined that the source port to be polled this time is the first source port in the source port pool polled last time; or, When the polling number value corresponding to the source port pool polled last time is the same as the weight ratio corresponding to the source port pool polled last time, it is determined that the source port to be polled currently is the first source port in the next source port pool corresponding to the source port pool polled last time, wherein, when the source port pool polled last time is the last source port pool after sorting, the next source port pool is the first source port pool after sorting.
7. The method according to claim 1, characterized in that The method further comprises: After all source ports corresponding to the same path state are divided into the same source port pool, for each source port, a second RTT detection message having a source port as the source port is sent to the destination device according to a set period; If no RTT response message is received for the second RTT probe message within the set period, determining that the path state of the path for transmitting the second RTT probe message is an unavailable path state, and when the determined path state is different from the path state corresponding to the source port pool where the source port is currently located, deleting the source port from the corresponding source port pool and adding it to the source port pool corresponding to the unavailable path state, or, when the determined path state is the same as the path state corresponding to the source port pool where the source port is currently located, not performing any operation; If the RTT response message is received within the set period, the RTT value is calculated based on the third timestamp when the second RTT probe message is sent and the fourth timestamp when the RTT response message is received, and the path state of the path for transmitting the second RTT probe message is determined according to the calculated RTT value. When the determined path state is different from the path state corresponding to the source port pool where the source port is currently located, the source port is deleted from the corresponding source port pool and added to the source port pool corresponding to the determined path state. Alternatively, when the determined path state is the same as the path state corresponding to the source port pool where the source port is currently located, no operation is performed.
8. The method according to claim 1, characterized in that The method further comprises: Upon receiving a response message to the second service message, calculating an RTT value based on a fifth timestamp when the second service message was sent and a sixth timestamp when the response message to the second service message was received, and determining a path status of a path for transmitting the second service message based on the calculated RTT value; When the determined path state is different from the path state corresponding to the source port pool where the source port is currently located, the source port is deleted from the corresponding source port pool and added to the source port pool corresponding to the determined path state, or, When the determined path state is the same as the path state corresponding to the source port pool where the source port currently resides, no operation is performed.
9. A message forwarding device, characterized in that: The device is applied to a source device, and includes: A path detection module is configured to send, for each source port, a first message with the source port being the source port to a destination device, wherein the first message is a first service message or a first round-trip time (RTT) detection message; if a response message to the first message is received within a set time period, calculate an RTT value based on a first timestamp when the first message is sent and a second timestamp when the response message is received; and determine, based on the calculated RTT value, a path status of a path for transmitting the first message; A multipath control module is configured to divide all source ports corresponding to the same path state into the same source port pool and assign a weight to each source port pool, wherein different source port pools correspond to different weights, and the higher the weight, the shorter the transmission delay of the path corresponding to the path state corresponding to the corresponding source port pool; sort the source port pools that meet preset conditions in all source port pools in descending order of weight; and when a second service message needs to be sent to the destination device for the current time, determine the source port that needs to be polled for the current time according to the polling method of the sorted source port pools based on the weight ratio of each sorted source port pool and the last polling information, and use the determined source port as the source port of the second service message; The ECMP module is used to perform equal-cost multi-path ECMP forwarding on the second service message based on the quintuple information of the second service message.
10. The device according to claim 9, characterized in that The path detection module is specifically configured to determine the path status of the path for transmitting the first message in the following manner: If the calculated RTT value is not greater than a preset reference value, determining that the path state of the path is the optimal path state; If the calculated RTT value is greater than the preset reference value but not greater than the first threshold, determining that the path state of the path is a suboptimal path state; If the calculated RTT value is greater than the first threshold but not greater than the second threshold, determining that the path state of the path is a congested path state; If the calculated RTT value is greater than the second threshold, the path status of the path is determined to be an unavailable path status.
11. The device according to claim 9, characterized in that The path detection module is further used to: If the response message is not received within the set time period, it is determined that the path status of the path is an unavailable path status.
12. The device according to claim 9, characterized in that The multipath control module is specifically configured to determine the source port that needs to be polled currently by: If the current time is the first time, the source port to be polled is determined to be the first source port in the first source port pool after sorting; If the current time is not the first time and the source port of the last poll included in the polling information is not the last source port in the source port pool of the last poll included in the polling information, then determining that the source port that needs to be polled currently is the next source port corresponding to the source port of the last poll; If the current time is not the first time and the source port polled last time is the last source port in the source port pool polled last time, then when the polling number value corresponding to the source port pool polled last time included in the polling information is different from the weight ratio corresponding to the source port pool polled last time, it is determined that the source port to be polled this time is the first source port in the source port pool polled last time; or, When the polling number value corresponding to the source port pool polled last time is the same as the weight ratio corresponding to the source port pool polled last time, it is determined that the source port to be polled currently is the first source port in the next source port pool corresponding to the source port pool polled last time, wherein, when the source port pool polled last time is the last source port pool after sorting, the next source port pool is the first source port pool after sorting.
13. An electronic device, characterized in that: The method comprises a processor and a machine-readable storage medium, wherein the machine-readable storage medium stores machine-executable instructions that can be executed by the processor, and the processor is prompted by the machine-executable instructions to implement the method steps according to any one of claims 1 to 8.
14. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps according to any one of claims 1 to 8 are implemented.
Citation Information
Patent Citations
Method, device and system for forwarding message
CN114157600A
End-to-end path discovery and use method and apparatus
WO2022007653A1