Message forwarding method and device, electronic equipment and storage medium

By sending RTT detection messages in the source device to determine the path status, and polling and selecting the transmission path according to the path status, the problem of not considering the path transmission situation in ECMP is solved, and a shorter message transmission delay is achieved.

CN119728606AActive Publication Date: 2025-03-28NEW H3C TECH CO LTD
View PDF 10 Cites 0 Cited by

Patent Information

Application Number
CN202311220346.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-09-20
Publication Date
2025-03-28
Estimated Expiration
2043-09-20

AI Technical Summary

Technical Problem

The prior art does not consider the actual transmission of the path in equivalent multipath (ECMP), resulting in service packets still being transmitted when the network state is poor, increasing the message transmission delay.

Method used

In the source device, the path state is determined by sending RTT probe messages, and the source ports of the same path state are divided into the same source port pool, and the weight is allocated according to the path state, and the transmission path is selected through the polling mechanism.

Benefits of technology

By dynamically adjusting the transmission path, using paths with good path status to forward more service messages, and paths with poor path status to forward less service messages, thereby shortening the message transmission delay.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119728606A_ABST
    Figure CN119728606A_ABST
Patent Text Reader

Abstract

The invention provides a message forwarding method and device, electronic equipment and a storage medium. The method is applied to source end equipment, and comprises the following steps: for each source port, sending a first message to destination end equipment; if the corresponding response message is received within the set duration, calculating an RTT value, and determining a path state of a path for transmitting the first message; dividing all source ports corresponding to the same path state into the same source port pool, and allocating a weight for each source port pool; sorting the source port pools meeting a preset condition according to a sequence of the weights from high to low; when a second service message needs to be sent to the destination end equipment at the current time, determining a source port needing to be polled at the current time according to a related polling mode and the polling information of the last time, and taking the source port as a source port of the second service message; and performing ECMP forwarding on the second service message based on the quintuple information of the second service message. According to the invention, the ECMP path can be fully utilized, and the message transmission delay is shortened.
Need to check novelty before this filing date? Find Prior Art

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 uses ECMP to forward service packets to the destination device, it can perform a hash operation based on the five-tuple information of the service packet (i.e., the source IP, source port, destination IP, destination port, and protocol type of the service packet), and use the path corresponding to the operation result to forward the service packet. It can also use the currently polled path to forward the service packet.

[0003] Regardless of which method is used to forward the service message, the actual transmission condition of the path is not considered. Even if the network status of a path is not good, the service message will still be transmitted, which results in a long message transmission delay of the service message. 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, send a first message whose source port is the source port to a 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, 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] Determine, according to the calculated RTT value, a path state of a path for transmitting the first message;

[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, wherein 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;

[0010] Sort the source port pools that meet the preset conditions in all source port pools in descending order of weight;

[0011] When the second service message needs to be sent to the destination device for the current time, the source port that needs to be polled for the current time is determined 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 the determined source port is used 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, configured to send, for each source port, a first message whose source port is 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 a path state of a path for transmitting the first message according to the calculated RTT value;

[0015] A multipath control module, used to divide all source ports corresponding to the same path state into the same source port pool, and assign weights to each source port pool, wherein 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; sort the source port pools that meet the preset conditions in all the source port pools in order from high to low weights; and when it is necessary to send a second service message to the destination device 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, determine the source port that needs to be polled for the current time, 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 a 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 a computer program is stored in the computer-readable storage medium, 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 solution 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 by 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 the specification and constitute a part of this application, illustrate embodiments consistent with the application and, together with the description, serve to explain the principles of the 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, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some 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. The singular forms of "a", "said" and "the" used in this application and the appended claims are also intended to include plural forms unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.

[0029] It should be understood that, although the terms first, second, third, etc. may be used in the present application to describe various information, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the words "if" or "if" as used herein may be interpreted as "at the time of" or "when...".

[0030] Next, the embodiments of the present application are described in detail.

[0031] The present application embodiment 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 state 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 is, the smaller the transmission delay of the path corresponding to the path state corresponding to the corresponding source port pool is.

[0039] S15. Sort the source port pools that meet the preset conditions among all the 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 previous 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 the above step S12, 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 state of the path for transmitting the first message in the following manner, 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, the path state of the path is determined to be a suboptimal path state;

[0049] If the calculated RTT value is greater than a first threshold value but not greater than a second threshold value, 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 one by one here.

[0052] It should be noted that the above-mentioned preset reference value, the first threshold value and the second threshold value can be set by an administrator based on experience and configured in advance 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 state of the above path is determined to be an unavailable path state.

[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] Among all source port pools, source port pools whose corresponding path states are not in the unavailable path state are determined as target source port pools that meet preset conditions.

[0057] In this way, the 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 the source port pools in order of weight from high to low, the source port pools whose corresponding path status is not an unavailable path status in all the source port pools can be sorted in order of weight from high to low.

[0059] In the above step S16, the source device can determine the source port that needs to be polled currently in the following manner:

[0060] If the current time is the first time, it is determined that the source port to be polled this time is the first source port in the first source port pool after sorting;

[0061] 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 determine that the source port that needs to be polled for 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 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 does not reach 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,

[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, 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 active port 1, source port 2, and source port 3; source port pool 2 includes active port 4 and source port 5; source port pool 3 includes active 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 polling included in the polling information is source port 4 (not the last source port in the source port pool of the last polling 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 polling (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 polled last time is source port 5 (the last source port in the source port pool polled last time (i.e., source port pool 2), and the polling number value (assumed to be 1) corresponding to the source port pool polled last time (i.e., source port pool 2) included in the polling information is different from the weight ratio value (i.e., 2) corresponding to the source port pool polled last time (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 source port pool polled last time (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 polled last time is source port 5 (the last source port in the source port pool polled last time (i.e., source port pool 2), and the polling number value (assumed to be 2) corresponding to the source port pool polled last time (i.e., source port pool 2) is the same as the weight ratio value (i.e., 2) corresponding to the source port pool polled last time (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 polled last time (i.e., source port 6), and uses source port 6 as the source port of message 14.

[0069] Assume that the source device currently needs to send service message 16 (abbreviated as message 16, Figure 2 ), and the current time is not the first time, and assuming that the source port polled last time is source port 7 (the last source port in the source port pool polled last time (i.e., source port pool 3), and the polling number value (assuming it is 1) corresponding to the source port pool polled last time (i.e., source port pool 3) is the same as the weight ratio value (i.e., 1) corresponding to the source port pool polled last time (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 polled last time, 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 a prior art and will not be described in detail here.

[0071] Furthermore, in the embodiment of the present application, the source device may also 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 having a 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 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 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, 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 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 is currently located, no operation is performed.

[0075] The second operation: when receiving a response message to the second service message, calculating the RTT value based on the fifth timestamp when the second service message is sent and the sixth timestamp when the response message to the second service message is received, and determining the path state of the path for transmitting the second service message according to 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 currently resides, 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 setting 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 by 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 a source device, and its structural diagram is as follows: Figure 3 As shown, specifically including:

[0082] A path detection module 31 is used to send, for each source port, a first message whose source port is the source port to a 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 a 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; and the path state of the path for transmitting the first message is determined according to the calculated RTT value;

[0083] The multipath control module 32 is used to divide all source ports corresponding to the same path state into the same source port pool, and assign weights to each source port pool, wherein 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; sort the source port pools that meet the preset conditions in all the source port pools in order from high to low weights; and when it is necessary to send a second service message to the destination device 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, determine the source port that needs to be polled for the current time, and use the determined source port as the source port of the second service message;

[0084] The ECMP module 33 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.

[0085] Preferably, the path detection module 31 is specifically used 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 an 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 value but not greater than the second threshold value, 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 state of the path is determined to be an unavailable path state.

[0092] Preferably, the path detection module 31 is further used for:

[0093] If the response message is not received within the set time period, it is determined that the path state of the path is an unavailable path state.

[0094] Preferably, the multipath control module 32 is specifically used for:

[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 in the following manner:

[0097] If the current time is the first time, it is determined that the source port to be polled this time is 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 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 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.

[0101] Preferably, the path detection module 31 is further used for:

[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, and the path state of the path for transmitting the second RTT detection message is determined according to the calculated RTT value, 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, 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.

[0105] Preferably, the path detection module 31 is further used for:

[0106] When a response message to the second service message is received, the RTT value is calculated based on the fifth timestamp when the second service message is sent and the sixth timestamp when the response message to the second service message is received, and the path state of the path for transmitting the second service message is determined according to the calculated RTT value;

[0107] The multipath control module 32 is further used for:

[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 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 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 by 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 a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk storage. Optionally, the machine-readable storage medium may also be at least one storage device located away 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, discrete hardware components.

[0114] In another embodiment provided in the present application, a computer-readable storage medium is provided, in which a computer program is stored. 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 substitutions, 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 the method comprises: 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, 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; Determine, according to the calculated RTT value, a path state of a path for transmitting the first message; 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, wherein 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; Sort the source port pools that meet the preset conditions in all source port pools in descending order of weight; When the second service message needs to be sent to the destination device for the current time, the source port that needs to be polled for the current time is determined 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 the determined source port is used 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 the RTT value based on a first timestamp when the first message is sent and a second timestamp when the response message is received, specifically includes: 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 state of a path for transmitting the first message, specifically includes: If the calculated RTT value is not greater than a preset reference value, determining that the path state of the path is an 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 value but not greater than the second threshold value, 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 state of the path is determined to be an unavailable path state.

4. The method according to claim 1, characterized in that: The method further comprises: If the response message is not received within the set time period, it is determined that the path state of the path is an unavailable path state.

5. The method according to claim 3, characterized in that: In descending order of weight, the source port pools that meet the preset conditions in all source port pools are sorted, 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 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, the source port to be polled currently is determined, specifically including: If the current time is the first time, it is determined that the source port to be polled this time is 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 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 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.

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 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 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; 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, and the path state of the path for transmitting the second RTT detection 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: When a response message to the second service message is received, the RTT value is calculated based on the fifth timestamp when the second service message is sent and the sixth timestamp when the response message to the second service message is received, and the path state of the path for transmitting the second service 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 currently resides, 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 end device, and the device comprises: A path detection module, configured to send, for each source port, a first message whose source port is 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 a path state of a path for transmitting the first message according to the calculated RTT value; A multipath control module, used to divide all source ports corresponding to the same path state into the same source port pool, and assign weights to each source port pool, wherein 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; sort the source port pools that meet the preset conditions in all the source port pools in order from high to low weights; and when it is necessary to send a second service message to the destination device 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, determine the source port that needs to be polled for the current time, 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 used 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 an 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 value but not greater than the second threshold value, 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 state of the path is determined to be an unavailable path state.

11. The device according to claim 9, characterized in that The path detection module is further used for: If the response message is not received within the set time period, it is determined that the path state of the path is an unavailable path state.

12. The device according to claim 9, characterized in that The multipath control module is specifically used to determine the source port that needs to be polled currently in the following manner: If the current time is the first time, it is determined that the source port to be polled this time is 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 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 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.

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 described in 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 of any one of claims 1 to 8 are implemented.

Citation Information

Patent Citations

  • Network management method and system supporting elephant flow, interchanger and network

    CN103716208A

  • Transmission control protocol link building method and device

    CN105681130A

  • Method and device for determining transmission path

    CN108243111A

  • Message forwarding method and device

    CN110752993A

  • Method, device and system for forwarding message

    CN114157600A