Data stream processing method, electronic device, medium, and program product
By determining the actual proportion of load-sharing links and selecting appropriate links to handle data flows on faulty links, the problem of bandwidth overrun caused by unbalanced load sharing is solved, and the success rate and reliability of data flow forwarding are improved.
Patent Information
- Application Number
- PCT/CN2025/093794
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-05-14
- Filing Date
- 2025-05-09
- Publication Date
- 2025-11-20
AI Technical Summary
In scenarios involving load-sharing link failures or rapid fluctuations, undamaged load-sharing links may be repeatedly replaced by faulty links, leading to load imbalances and potentially causing bandwidth overruns and data stream forwarding failures.
By determining the actual load sharing ratio of each normal load-sharing link, the link with the actual ratio being less than the theoretical ratio is selected as the target link to handle the data flow on the faulty link, thus avoiding unbalanced load sharing. The link with the actual load sharing ratio being less than the theoretical ratio is used for data flow forwarding.
It achieves load balancing across links, avoids bandwidth overruns, improves data flow forwarding success rate, and enhances the reliability and efficiency of data flow forwarding.
Smart Images

Figure CN2025093794_20112025_PF_FP_ABST
Abstract
Description
Data flow processing method, electronic device, medium and program product
[0001] Cross-reference to Related Applications
[0002] This application claims priority to Chinese Patent Application No. 202410615293.8, filed May 14, 2024, the contents of which are incorporated herein by reference in their entirety. TECHNICAL FIELD
[0003] The present disclosure relates to the technical field of data flow processing, and particularly relates to a data flow processing method, an electronic device, a computer readable storage medium and a computer program product. BACKGROUND
[0004] In the technical field of data flow processing, technologies such as Equal-Cost Multi-path Routing (ECMP) and link aggregation (trunk) can be used to realize load sharing (also referred to as load balancing (LB)) by forwarding data flows through multiple load sharing links.
[0005] In some related technologies, data flows of a load sharing link that has failed are directly processed by using load sharing links that have not failed. In the case of rapid oscillation scenarios such as continuous failure of load sharing links, or failure-recovery…recovery-failure of load sharing links, one or more load sharing links that have not failed are used multiple times to replace load sharing links that have failed, resulting in a large load on one or more load sharing links that have not failed, which may further cause the bandwidth of one or more load sharing links that have not failed to exceed the limit, resulting in congestion and failure of data flow forwarding. SUMMARY
[0006] The present disclosure provides a data flow processing method, an electronic device, a computer readable storage medium and a computer program product.
[0007] In a first aspect, the present disclosure provides a data flow processing method, comprising: in response to a first load sharing link in a load sharing link group failing, determining an actual load sharing proportion of each second load sharing link in at least one second load sharing link, the second load sharing link being a link in a normal state in the load sharing link group, the actual load sharing proportion representing an actual proportion of the second load sharing link in a forwarding table of the load sharing link group; determining at least one target load sharing link in the at least one second load sharing link according to the actual load sharing proportion of each second load sharing link; and processing data flows on the first load sharing link through the at least one target load sharing link.
[0008] In a second aspect, the present disclosure provides an electronic device, comprising a memory and a processor; the memory stores a computer program executable by the processor; the computer program is executed by the processor, so that the processor implements the data flow processing method of the first aspect and any possible implementation manner of the data flow processing method of the first aspect.
[0009] In a third aspect, the present disclosure provides a computer readable storage medium, which stores a computer program, the computer program is executed by a processor, so that the processor implements the data flow processing method of the first aspect and any possible implementation manner of the data flow processing method of the first aspect.
[0010] In a fourth aspect, the present disclosure provides a computer program product, comprising a computer program, the computer program is executed by a processor, so that the processor implements the data flow processing method of the first aspect and any possible implementation manner of the data flow processing method of the first aspect. BRIEF DESCRIPTION OF DRAWINGS
[0011] In the drawings of the present disclosure:
[0012] Fig. 1 is a communication system architecture diagram provided by the present disclosure;
[0013] Fig. 2 is a link replacement schematic diagram provided by the present disclosure;
[0014] Fig. 3 is a data flow processing method flow chart provided by the present disclosure;
[0015] Fig. 4 is a forwarding representation intention provided by the present disclosure;
[0016] Fig. 5 is a protection representation intention provided by the present disclosure;
[0017] Fig. 6 is a flow chart of a way to determine a target load sharing link provided by the present disclosure;
[0018] Fig. 7 is a flow chart of a way to determine a theoretical load sharing ratio provided by the present disclosure;
[0019] Fig. 8 is a data flow processing method flow chart provided by the present disclosure;
[0020] Fig. 9 is a data flow processing method flow chart provided by the present disclosure;
[0021] Fig. 10 is a link replacement schematic diagram provided by the present disclosure;
[0022] Fig. 11 is a data flow forwarding manner flow chart provided by the present disclosure;
[0023] Fig. 12 is an identification replacement schematic diagram provided by the present disclosure;
[0024] FIG. 13 is a constituent block diagram of an electronic device according to an embodiment of the disclosure;
[0025] FIG. 14 is a constituent block diagram of a computer-readable storage medium according to an embodiment of the disclosure;
[0026] FIG. 15 is a constituent block diagram of a computer program product according to an embodiment of the disclosure. DETAILED DESCRIPTION
[0027] In order for those skilled in the art to better understand the technical solutions of the disclosure, the data flow processing method, the electronic device, the computer-readable storage medium and the computer program product provided by the disclosure are described in detail below with reference to the drawings.
[0028] The embodiments shown will be described in more detail in connection with the attached drawings, but the embodiments shown can be embodied in different forms and the disclosure should not be construed as being limited to the embodiments set forth below. The purpose of providing these embodiments is to make the disclosure more thorough and complete and to enable those skilled in the art to fully understand the scope of the disclosure.
[0029] The accompanying drawings of the disclosure are used to provide a further understanding of the embodiments of the disclosure and constitute a part of the specification, which, together with the detailed description, serves to explain the disclosure and does not constitute a limitation on the disclosure. The above and other features and advantages will become more apparent to those skilled in the art by describing the detailed embodiments with reference to the accompanying drawings.
[0030] In the case of no conflict, each embodiment of the disclosure and each feature in the embodiments can be combined with each other.
[0031] The terms used in the disclosure are only used to describe specific embodiments and are not intended to limit the disclosure. As used in the disclosure, the term "and / or" includes any and all combinations of one or more of the associated listed items. As used in the disclosure, the singular forms "a" and "the" are also intended to include the plural forms unless the context clearly indicates otherwise. As used in the disclosure, the terms "comprise", "consist of", designate the presence of a specific feature, whole, step, operation, element and / or component, but do not exclude the presence or addition of one or more other features, whole, step, operation, element, component and / or group thereof.
[0032] Unless otherwise defined, all terms used in the disclosure, including technical terms and scientific terms, have the same meaning as commonly understood by a person of ordinary skill in the art. It will also be understood that terms such as those defined in a commonly used dictionary should be interpreted as having a meaning consistent with their meaning in the context of the relevant art and the disclosure, and should not be interpreted in an idealized or overly formal sense, unless the disclosure expressly so defines.
[0033] Referring to FIG. 1, a communication system architecture diagram provided by the present disclosure is shown, and a scenario to which the present disclosure is applicable is described in conjunction with FIG. 1. The communication system in FIG. 1 includes a communication device A and a communication device B, and the communication device A and the communication device B can forward a data flow through a load sharing link. The communication device A and the communication device B in FIG. 1 can be data exchange devices, for example, can be switches or routers, and the present disclosure is not limited in this regard. The number of communication devices and the number of load sharing links in the communication system shown in FIG. 1 are merely illustrative, and the communication system can include other network devices and can include more or fewer load sharing links, and the present disclosure is not limited in this regard. FIG. 1 is merely a schematic diagram and does not constitute a limitation on the applicable scenarios of the technical solutions provided by the present disclosure.
[0034] Taking FIG. 1 as an example, the communication device A and the communication device B can use ECMP or trunk technology to forward a data flow through four load sharing links 1-4 to perform load sharing. When the load sharing link 2 and the load sharing link 4 fail, the failed links need to be replaced to avoid data flow transmission errors.
[0035] In some related technologies, the failed load sharing link 2 and the failed load sharing link 4 are directly replaced by the non-failed load sharing link 1 and the non-failed load sharing link 3. In a scenario where the load sharing link 2 and the load sharing link 4 fail continuously, or the load sharing link 2 (or 4) fails-recovery… recovery-failure, and so on, the load sharing link 1 can be used to replace the failed load sharing link 2 and the failed load sharing link 4 multiple times, resulting in a large load of the load sharing link 1, which can further cause the bandwidth of the load sharing link 1 to exceed the limit, causing congestion, and further causing the data flow to fail to be forwarded, affecting user experience.
[0036] Referring to FIG. 2, a schematic diagram of link replacement provided by the present disclosure is shown, and the number of entries in the forwarding table is 16. The link replacement is described in the scenario that load sharing link 2 and load sharing link 4 in FIG. 1 are continuously failed. It is assumed that load sharing link 4 fails at T1, and then load sharing link 1-3 are used to replace load sharing link 4 in the forwarding table in turn. Then, load sharing link 2 also fails at T2, and then load sharing link 1 and 3 are used to replace load sharing link 2 in the forwarding table in turn. As shown in FIG. 2, the number of load sharing link 1 in the forwarding table after completing the link replacement is 9, and the number of load sharing link 3 is 7. In this scenario, load sharing link 1 is used to replace the failed load sharing link multiple times, resulting in unbalanced load sharing of load sharing link 1 and load sharing link 3, so that the load of load sharing link 1 is larger, and then the bandwidth of load sharing link 1 may be exceeded, increasing the probability of data flow packet loss. It should be noted that the example of FIG. 2 is only used to more clearly describe the problems in the related art, and is not used for the purpose of limitation. In actual application, the number of entries in the forwarding table can be set to hundreds or even thousands according to the capability of the hardware device, and the number of load sharing links can also be designed to be more according to actual needs. Therefore, in actual application, the scenario of continuous failure of load sharing links, or the scenario of failure-recovery…recovery-failure of load sharing links is more complex. In the link replacement, the unbalanced load sharing of one or several non-failed load sharing links is continuously superimposed, and then the bandwidth of one or more non-failed load sharing links may be exceeded, resulting in data flow congestion and data flow forwarding failure.
[0037] Therefore, the data flow processing method, the electronic device, the computer readable storage medium and the computer program product provided by the present disclosure can be applied to the above-mentioned scenarios and the system architecture of FIG. 1, but are not limited thereto.
[0038] In a first aspect, referring to FIG. 3, a flowchart of a data flow processing method provided by the present disclosure is shown, which can be applied to the communication device A or the communication device B shown in FIG. 1. The method comprises steps S301-S303.
[0039] S301: In response to the failure of a first load sharing link in a load sharing link group, determining the actual load sharing ratio of each second load sharing link in at least one second load sharing link. The second load sharing link is a link in a normal state in the load sharing link group.
[0040] In the present disclosure, the actual load sharing ratio is used to represent the actual proportion of the second load sharing link in the forwarding table of the load sharing link group. As an example, assuming that the number of entries of the forwarding table is N, and the current number of second load sharing links in the forwarding table is M, the actual load sharing ratio of the second load sharing link is
[0041] In the present disclosure, the value of the number of entries of the forwarding table can be determined according to the hardware capability of the communication device and the actual application requirement.
[0042] In some embodiments, the load sharing link group can be a link group in ECMP or trunk.
[0043] In some embodiments, before performing the determination of the actual load sharing ratio of each second load sharing link in the at least one second load sharing link included in S301, the data flow processing method can further include: in response to the failure of the first load sharing link, obtaining a protection table corresponding to the first load sharing link, the protection table including link information corresponding to other load sharing links in the load sharing link group except the first load sharing link, and determining the at least one second load sharing link according to the link information. In this embodiment, the link information corresponding to the load sharing link can be the position index information corresponding to the link. As an example, assuming that the load sharing link group includes five load sharing links 1-5, the identifiers corresponding to the load sharing links 1-5 are 1-5 respectively, and the number of entries of the forwarding table is 5. For this example, referring to FIG. 4, a forwarding table provided by the present disclosure is intended to represent, as shown in FIG. 4, the forwarding table when each load sharing link in the load sharing link group is in a normal state, from which it can be seen that each load sharing link in the forwarding table is in a normal state (i.e., the state is up). Referring to FIG. 5, a protection table provided by the present disclosure is intended to represent, as shown in FIG. 5, the protection table when the load sharing link 1 fails and the load sharing links 2-5 are in a normal state, from which it can be seen that the load sharing link 1 in the protection table is in a failure state (i.e., the state is down), and the load sharing links 2-5 are in a normal state (i.e., the state is up).
[0044] It should be noted that the order of the steps in each embodiment of the present disclosure is not limited, and the execution order of the steps is only one possible example.
[0045] S302: determining at least one target load sharing link from the at least one second load sharing link according to the actual load sharing ratio of each second load sharing link.
[0046] In the embodiments of the present disclosure, the implementation of S302 is not limited.
[0047] In some implementations, S302 can be implemented in the following manner, referring to Figure 6, which is a flowchart of a method for determining a target load-sharing link provided by this disclosure, the method including: steps S3021 to S3023.
[0048] S3021: Determine the theoretical load-sharing ratio for each second load-sharing link.
[0049] The theoretical load-sharing ratio is used to characterize the maximum proportion of the second load-sharing link in the forwarding table. The maximum proportion refers to the proportion of each second load-sharing link in the forwarding table when each second load-sharing link is in a load-balanced state.
[0050] S3022: Compare the actual load sharing ratio of each second load sharing link with the theoretical load sharing ratio.
[0051] S3023: Determine at least one second load-sharing link whose actual load-sharing ratio is less than the theoretical load-sharing ratio as the target load-sharing link.
[0052] In this implementation, the actual load sharing ratio of the target load sharing link determined by S3023 is less than the theoretical load sharing ratio. Thus, only the second load sharing link that satisfies the condition that the actual load sharing ratio is less than the theoretical load sharing ratio is used for load sharing. The second load sharing link whose actual load sharing ratio is greater than or equal to the theoretical load sharing ratio is no longer used for load sharing. This can avoid the bandwidth of the load sharing link exceeding the limit, balance the load sharing ratio, avoid data flow forwarding errors, and thus improve the data flow forwarding success rate.
[0053] In some implementations, S3021 can be implemented in the following manner, referring to Figure 7, which is a flowchart of a method for determining the theoretical load sharing ratio provided by this disclosure, the method including: steps S30211 to S30213.
[0054] S30211: Get the number of entries in the forwarding table.
[0055] S30212: Determine the total number of all second load-sharing links in the load-sharing link group.
[0056] S30213: The theoretical load-sharing ratio is determined by the ratio of the target quotient to the number of entries in the forwarding table. The target quotient is the quotient obtained by dividing the number of entries in the forwarding table by the total number of second load-sharing links in the load-sharing link group.
[0057] In one example, assuming the number of entries in the forwarding table is N, and the total number of second load-sharing links in the load-sharing link group is P, then the target quotient is N / P, and the theoretical load-sharing ratio is...
[0058] S303: processing the data flow on the first load sharing link through the at least one target load sharing link.
[0059] In the present disclosure, after determining the at least one target load sharing link in the at least one second load sharing link according to the actual load sharing ratio of each second load sharing link, the data flow on the first load sharing link is processed through the at least one target load sharing link. The processing of the data flow in the present disclosure includes but is not limited to forwarding.
[0060] According to the actual load sharing ratio of the load sharing link in the normal state, the method provided by the present disclosure determines the target load sharing link to process the data flow on the faulty load sharing link, which considers the load sharing of each load sharing link and balances the load sharing ratio of each load sharing link, avoids the bandwidth of the load sharing link exceeding the limit, avoids the error of data flow forwarding, and further improves the success rate of data flow forwarding.
[0061] In some embodiments, S303 can be implemented by referring to FIG. 8, which is a flowchart of a data flow processing method provided by the present disclosure. The method includes steps S3031 and S3032.
[0062] S3031: determining the target number of each target load sharing link according to the actual load sharing ratio and the theoretical load sharing ratio of each target load sharing link. The target number refers to the number of the corresponding target load sharing link in the forwarding table for replacing the first load sharing link.
[0063] S3032: processing the data flow through the target load sharing link according to the target number of each target load sharing link.
[0064] In some embodiments, before performing S3031, the data flow processing method further includes: obtaining a preset rule for determining the target number, and the preset rule includes: the current load sharing ratio of each target load sharing link in the target forwarding table is less than or equal to the theoretical load sharing ratio, and the target forwarding table is a forwarding table obtained by replacing the first load sharing link in the forwarding table with the at least one target load sharing link according to the corresponding target number.
[0065] In this embodiment, if the target number of each target load sharing link is determined based on the preset rule according to the actual load sharing ratio and the theoretical load sharing ratio of each target load sharing link in S3031, various ways can be used to achieve this, which is not limited in the present disclosure. One possible implementation is given below.
[0066] In a possible implementation, the target quantity of each target load sharing link is calculated according to the following formula in sequence, and after the target quantity is calculated, the first load sharing link in the forwarding table is replaced by the target load sharing link with the corresponding target quantity, until there is no first load sharing link in the forwarding table, and then the calculation of the target quantity of the target load sharing link not used to replace the first load sharing link is stopped. In this implementation, the actual load sharing ratio of each target load sharing link can also be sorted in ascending order or the target quantity of each target load sharing link can be sorted in descending order, and the first load sharing link in the forwarding table can be replaced by the target load sharing link with the corresponding target quantity in sequence according to the sorting, until there is no first load sharing link in the forwarding table.
[0067] The target quantity of each target load sharing link i (1≤i≤k-1, k is the total quantity of target load sharing links) except the last target load sharing link is calculated according to the following formula:
[0068] The target quantity n i = (theoretical load sharing ratio-actual load sharing ratio) * the quantity of entries of the forwarding table.
[0069] It should be noted that the above formula can calculate the target quantity of any target load sharing link, and when the target quantity of a specific target load sharing link is calculated, the parameters involved in the formula are the parameters corresponding to the specific target load sharing link.
[0070] The target quantity of the last target load sharing link is calculated according to the following formula:
[0071] The target quantity n is the quantity corresponding to the first load sharing link in the forwarding table, and k is the total quantity of target load sharing links.
[0072] In some embodiments, S3032 can be implemented by the following method. Referring to FIG. 9, a data flow processing method flowchart provided by the present disclosure includes steps S30321 to S30322.
[0073] S30321: the identifier corresponding to each target load sharing link with the target quantity is used to replace the identifier corresponding to the first load sharing link in the forwarding table, to obtain a new forwarding table.
[0074] In one implementation, the target load sharing links can be sorted in ascending order of the actual load sharing ratios of the target load sharing links or in descending order of the target numbers of the target load sharing links, and the identifier corresponding to the first load sharing link in the forwarding table can be replaced by the identifier corresponding to the target load sharing link in turn until there is no identifier corresponding to the first load sharing link in the forwarding table. In this implementation, for the target load sharing links with the same actual load sharing ratio or the same target number, the identifiers corresponding to the target load sharing links can be sorted according to the size of the identifier sequence number or randomly.
[0075] In this embodiment, if the load sharing link group is a link group in ECMP, the identifier corresponding to the target load sharing link is the next hop routing identifier corresponding to the target load sharing link; if the load sharing link group is a link group in trunk, the identifier corresponding to the target load sharing link is the output port identifier corresponding to the target load sharing link.
[0076] S30322: processing the data flow by using the new forwarding table.
[0077] In some embodiments, after S30322, the data flow processing method further includes: generating a theoretical forwarding table according to the load sharing ratios of all the second load sharing links in the load sharing link group in the new forwarding table and the theoretical load sharing ratios of the second load sharing links, and the load sharing ratio of each second load sharing link in the theoretical forwarding table is balanced; replacing the new forwarding table with the theoretical forwarding table, and processing the data flow by using the theoretical forwarding table. By this method, the service of the first load sharing link can be carried by multiple load sharing links, and the load sharing ratio of each load sharing link is less than the theoretical load sharing ratio, so a more accurate forwarding table can be used to forward the data flow more accurately, and the forwarding efficiency is further improved.
[0078] The method of FIG. 9 is illustrated by an example as follows. In this example, the data flow processing can be performed by the following steps S1 to S5.
[0079] S1: determining the number of identifiers corresponding to the first load sharing link in the forwarding table, denoted as n.
[0080] S2: calculating the target number of the target load sharing links except the last target load sharing link according to the following formula, denoted as ni.
[0081] The target number ni=(theoretical load sharing ratio-actual load sharing ratio)*number of entries in the forwarding table;
[0082] S3: Calculate the target number nl of the last target load sharing link according to the following formula.
[0083] k is the total number of target load sharing links.
[0084] S4: Replace the identifier corresponding to the first load sharing link in the forwarding table with the identifier corresponding to each target load sharing link with the target number, to obtain a new forwarding table.
[0085] S5: Process the data flow using the new forwarding table.
[0086] In order for those skilled in the art to more clearly understand the technical solutions provided by the present disclosure, the method provided by the present disclosure will be described in detail below with reference to the architecture shown in FIG. 1. Referring to FIG. 10, a link replacement schematic diagram provided by the present disclosure includes:
[0087] In this example, it is assumed that the number of entries in the forwarding table is 16, and it is assumed that load sharing links 1-4 in the load sharing link group perform equivalent load sharing. It is assumed that load sharing link 4 fails at T1, and load sharing link 2 fails at T2. The above data flow processing method provided by the present disclosure will be described below with the example of replacing load sharing link 2 in the forwarding table.
[0088] S1: In response to the failure of load sharing link 2 in the load sharing link group, determine the theoretical load sharing ratio and the actual load sharing ratio of load sharing links 1 and 3 that are currently in a normal state.
[0089] In this example, the formula: theoretical load sharing ratio and the formula: actual load sharing ratio can be used to calculate the values of Rt and Ra of each load sharing link in a normal state. N is the number of entries in the forwarding table, M is the current number of each load sharing link in a normal state in the forwarding table, and P is the number of all load sharing links in a normal state in the load sharing link group.
[0090] The theoretical load sharing ratio of load sharing link 1 is
[0091] The actual load sharing ratio of load sharing link 1 is
[0092] The theoretical load sharing ratio of load sharing link 3 is
[0093] The actual load sharing ratio of load sharing link 3 is
[0094] S2: the actual load sharing ratios of the load sharing link 1 and the load sharing link 3 are both less than the theoretical load sharing ratio, and therefore the load sharing link 1 and the load sharing link 3 are determined as the target load sharing links.
[0095] S3: the target number n1 corresponding to the load sharing link 1 and the target number n3 corresponding to the load sharing link 3 are determined.
[0096] n1 = (Rt1 - Ra1) * N = (8 / 16 - 6 / 16) * 16 = 2;
[0097] S4: according to the order of n1 and n3 from large to small, or the order of Ra1 and Ra3 from small to large, the identifier 3 and the identifier 1 corresponding to the load sharing link 3 and the load sharing link 1 are sorted, the sorting is identifier 3 - identifier 1, and the identifier 2 corresponding to the load sharing link 2 in the forwarding table is replaced in turn according to the sorting and the corresponding target number, that is, all the identifier 2 in the forwarding table can be replaced by identifier 3 - identifier 1 - identifier 3 - identifier 1 - identifier 3.
[0098] In this example, as shown in FIG. 10, the forwarding table after the identifier replacement includes 8 identifier 1 and 8 identifier 3, and after the partial load sharing link failure, the load sharing balance is achieved.
[0099] In order for those skilled in the art to more clearly understand the technical solutions provided by the present disclosure, the technical solutions provided by the present disclosure are further described below through specific examples:
[0100] Referring to FIG. 11, a data flow forwarding method flowchart provided by the present disclosure includes the following steps S1101 to S1107. In this example, it is assumed that the number of all load sharing links in the load sharing link group is 5, denoted as load sharing links 1-5, and the identifiers corresponding to the load sharing links 1-5 are denoted as 1-5. Taking the identifier as an example of the output port identifier corresponding to the load sharing link, the identifiers 1-5 refer to the identifiers of the output ports 1-5 corresponding to the load sharing links 1-5. It is also assumed that the load sharing is equivalent load sharing, and the number of table entries of the forwarding table is 256. In the initial state, the identifiers 1-5 are evenly arranged in the forwarding table. Taking the load sharing link 3 failure as an example, the data flow forwarding method provided by the present disclosure is described in detail. Referring to FIG. 12, an identifier replacement schematic diagram provided by the present disclosure, FIG. 12 is an identifier replacement schematic diagram achieved by the method provided by FIG. 11 of the present disclosure.
[0101] S1101: in response to the load sharing link 3 in the load sharing link group failing, the actual load sharing ratios of the load sharing links 1 / 2 / 4 / 5 in the normal state are determined respectively.
[0102] S1102: Determine the theoretical load sharing ratio of the load sharing link 1 / 2 / 4 / 5 respectively.
[0103] S1103: Compare the actual load sharing ratio of the load sharing link 1 / 2 / 4 / 5 with the theoretical load sharing ratio.
[0104] In this example, the formula is used: Theoretical load sharing ratio And, the actual load sharing ratio The theoretical load sharing ratio and the actual load sharing ratio of the load sharing link 1 / 2 / 4 / 5 are calculated, N is the number of entries in the forwarding table, M is the current number of load sharing links in the forwarding table in normal state, and P is the number of load sharing links in the load sharing link group in normal state.
[0105] The theoretical load sharing ratio of the load sharing link 1 is recorded as
[0106] The actual load sharing ratio of the load sharing link 1 is recorded as
[0107] The theoretical load sharing ratio of the load sharing link 2 is recorded as
[0108] The actual load sharing ratio of the load sharing link 2 is recorded as
[0109] The theoretical load sharing ratio of the load sharing link 4 is recorded as
[0110] The actual load sharing ratio of the load sharing link 4 is recorded as
[0111] The theoretical load sharing ratio of the load sharing link 5 is recorded as
[0112] The actual load sharing ratio of the load sharing link 5 is recorded as
[0113] Through comparison, it can be seen that the actual load sharing ratio of the load sharing link 1 / 2 / 4 / 5 is less than the theoretical load sharing ratio.
[0114] S1104: Determine the load sharing link 1 / 2 / 4 / 5 with the actual load sharing ratio less than the theoretical load sharing ratio as the target load sharing link.
[0115] S1105: According to the actual load sharing ratio and the theoretical load sharing ratio of the load sharing link 1 / 2 / 4 / 5, the target number of the load sharing link 1 / 2 / 4 / 5 is determined.
[0116] In this example, the target number n2 / n4 / n5 of the load sharing link 2 / 4 / 5 can be determined according to the formula n i = (R t - R a) * N, and the target number n1 of the load sharing link 1 can be determined according to the formula n 1 = (R t - R a) * N / k, k is the total number of target load sharing links, and n is the number of identifiers corresponding to the load sharing link 3 in the forwarding table.
[0117] S1106: Replace the identifier corresponding to the load sharing link 3 in the forwarding table with the identifier corresponding to the target number of the load sharing link 1 / 2 / 4 / 5 to obtain a new forwarding table.
[0118] S1107: Forward the data flow using the new forwarding table.
[0119] For example, the identifiers corresponding to the load sharing link 1 / 2 / 4 / 5 can be sorted according to the order of n1, n2, n4, and n5 from large to small, or the order of Ra1, Ra2, Ra4, and Ra5 from small to large, the identifier 3 corresponding to the load sharing link 3 in the forwarding table is replaced with the corresponding target number according to the sorting to obtain a new forwarding table, and the data flow is forwarded according to the new forwarding table.
[0120] As shown in FIG. 12, after S1106 is performed, the load sharing ratios of the load sharing links 1 / 2 / 4 / 5 are all By the method of the present disclosure, the load sharing ratios of each non-faulty load sharing link can be balanced, and the problem that the load of some load sharing links is large, which leads to link congestion and further leads to data flow transmission failure, can be avoided.
[0121] In a second aspect, referring to FIG. 13, an electronic device is provided, which includes: at least one processor 1301; a memory 1302, which stores at least one computer program; when the at least one computer program is executed by the at least one processor 1301, the at least one processor 1301 implements the data flow processing method of the first aspect and any one of the possible implementation manners of the data flow processing method of the first aspect; and at least one I / O interface 1303, which is located between the processor 1301 and the memory 1302 and is configured to realize information interaction between the processor 1301 and the memory 1302.
[0122] The processor 1301 is a device with data processing capability, including but not limited to a central processing unit (CPU) and the like; the memory 1302 is a device with data storage capability, including but not limited to a random access memory (RAM, more specifically SDRAM, DDR, etc.), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a flash memory (FLASH); the I / O interface (read-write interface) 1303 is located between the processor 1301 and the memory 1302, and can realize information interaction between the processor 1301 and the memory 1302, including but not limited to a data bus (Bus) and the like.
[0123] In some embodiments, the processor 1301, the memory 1302 and the I / O interface 1303 are connected to each other through the bus 1304, and further connected to other components of the computing device.
[0124] In the third aspect, with reference to FIG. 14, the present disclosure provides a computer-readable storage medium, which stores a computer program, and the computer program is executed by a processor, so that the processor implements the data stream processing method of the first aspect and any one of the possible implementation manners of the data stream processing method of the first aspect.
[0125] In the fourth aspect, with reference to FIG. 15, the present disclosure provides a computer program product, which includes a computer program, and the computer program is executed by a processor, so that the processor implements the data stream processing method of the first aspect and any one of the possible implementation manners of the data stream processing method of the first aspect.
[0126] Those skilled in the art can understand that all or some of the functions of the modules / units in the above disclosed steps, systems and devices can be implemented as software, firmware, hardware and appropriate combinations thereof.
[0127] In the hardware implementation, the division between the functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, one physical component can have multiple functions, or one function or step can be executed by several physical components in cooperation.
[0128] Some or all of the physical components can be implemented as software executed by a processor, such as a central processing unit (CPU), a digital signal processor, or a microprocessor, or hardware, or a combination of software and / or hardware. Such software can be distributed on computer readable media, which can comprise computer storage media (or non-transitory media), and communication media (or transitory media). Computer storage media, as used herein, includes volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data. Computer storage media includes, but is not limited to, random access memory (RAM), such as SDRAM, DDR, or other RAM; read only memory (ROM); electrically erasable programmable read only memory (EEPROM); flash memory or other memory technology; compact disc read only memory (CD-ROM), digital versatile disks (DVDs), or other optical disk storage; magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices; or any other medium that can be used to store the desired information and that can be accessed by a computer. Further, it should be appreciated by those skilled in the art that computer storage media generally includes any media that can be used for storage of data and / or computer code longer than a transitory signal, and that can be accessed by a computer. Also, as used herein, "non-transitory computer-readable medium" includes all computer-readable media, except for a transitory signal.
[0129] The present disclosure has disclosed example implementations, and while specific terminology has been employed, such should not be taken in a limiting sense, but rather should be understood to be in a generic sense unless otherwise indicated. In some instances, it will be apparent to those skilled in the art from the descriptions of the particular implementations that elements, features or components described with reference to one particular implementation can be used alone or in combination with elements, features or components described with reference to other implementations, unless otherwise indicated. Thus, it will be understood by those skilled in the art that various changes can be made without departing from the scope of the present disclosure as set forth in the appended claims.
Claims
1. A method for processing data flow, comprising: determining an actual load sharing ratio of each of at least one second load sharing link in response to a failure of a first load sharing link in a load sharing link group, wherein the second load sharing link is a link in the load sharing link group in a normal state, and the actual load sharing ratio is used to represent an actual proportion of the second load sharing link in a forwarding table of the load sharing link group; determining at least one target load sharing link from the at least one second load sharing link according to the actual load sharing ratio of each of the second load sharing link; and processing data flow on the first load sharing link through the at least one target load sharing link.
2. The method of claim 1, wherein, The determining at least one target load sharing link from the at least one second load sharing link according to the actual load sharing ratio of each of the second load sharing link comprises: determining a theoretical load sharing ratio of each of the second load sharing link, wherein the theoretical load sharing ratio is used to represent a maximum proportion of the second load sharing link in the forwarding table; comparing the actual load sharing ratio and the theoretical load sharing ratio of each of the second load sharing link; and determining the second load sharing link with the actual load sharing ratio less than the theoretical load sharing ratio in the at least one second load sharing link as the target load sharing link.
3. The method of claim 2, wherein, The determining a theoretical load sharing ratio of each of the second load sharing link comprises: obtaining a number of entries of the forwarding table; determining a number of all the second load sharing links in the load sharing link group; and determining a ratio of a target quotient value to the number of entries of the forwarding table as the theoretical load sharing ratio, wherein the target quotient value is a quotient value obtained by dividing the number of entries of the forwarding table by the number of all the second load sharing links in the load sharing link group.
4. The method of claim 2, wherein, The processing data flow on the first load sharing link through the at least one target load sharing link comprises: determining a target number of each of the target load sharing link according to the actual load sharing ratio and the theoretical load sharing ratio of each of the target load sharing link, wherein the target number is a number of the corresponding target load sharing link used to replace the first load sharing link in the forwarding table; and processing the data flow through the target load sharing link according to the target number of each of the target load sharing link. 5.The method of claim 4, further comprising: Before the determining the target number of each of the target load sharing links according to the actual load sharing ratio and the theoretical load sharing ratio of each of the target load sharing links, a preset rule for determining the target number is acquired, wherein the preset rule comprises: a current load sharing ratio of each of the target load sharing links in a target forwarding table is less than or equal to the theoretical load sharing ratio, the target forwarding table is a forwarding table obtained by replacing the first load sharing link in the forwarding table with the at least one target load sharing link according to the corresponding target number.
6. The method of claim 4, wherein, The processing the data flow through the target load sharing link according to the target number of each of the target load sharing links comprises: replacing an identifier corresponding to the first load sharing link in the forwarding table with an identifier corresponding to each of the target load sharing link according to the target number, to obtain a new forwarding table; processing the data flow by using the new forwarding table.
7. The method of claim 6, further comprising: after the processing the data flow by using the new forwarding table, generating a theoretical forwarding table according to a load sharing ratio of each of the second load sharing links in the new forwarding table and the theoretical load sharing ratio corresponding to each of the second load sharing links, wherein the load sharing ratio of each of the second load sharing links in the theoretical forwarding table is balanced; replacing the new forwarding table with the theoretical forwarding table, and processing the data flow by using the theoretical forwarding table.
8. The method of claim 1, further comprising: before the determining the actual load sharing ratio of each of the at least one second load sharing link, in response to a failure of the first load sharing link, acquiring a protection table corresponding to the first load sharing link, wherein the protection table comprises link information corresponding to the load sharing links in the load sharing link group except the first load sharing link; determining the at least one second load sharing link according to the link information.
9. An electronic device, comprising a memory and a processor, wherein the memory stores a computer program executable by the processor, and the computer program is executed by the processor to enable the processor to implement the method of any one of claims 1 to 8.
10. A computer readable storage medium, having a computer program stored thereon, wherein the computer program is executed by a processor to enable the processor to implement the method of any one of claims 1 to 8.
11. A computer program product, comprising a computer program, wherein the computer program is executed by a processor to enable the processor to implement the method of any one of claims 1 to 8.
Citation Information
Patent Citations
Method and device for load sharing
CN103236986A
Flow load sharing method and flow load sharing device
CN106332141A
Fault processing method and device, equipment and medium
CN116319533A
Method of simple and efficient failure resilient load balancing
US20110141877A1
Cited By
Communication link intelligent sharing method of edge communication gateway
CN121509354A