A method, device and electronic equipment for load balancing

By dynamically adjusting the packet type and sequence number length during data transmission, the problem of uneven load on the transmission path is solved, achieving load balancing of data transmission and improving network performance.

CN114244845BActive Publication Date: 2024-09-20RUIJIE NETWORKS CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111533821.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-15
Publication Date
2024-09-20
Estimated Expiration
2041-12-15

AI Technical Summary

Technical Problem

During the data transmission process, when the amount of data transmitted is large and the duration is long, the uneven load on the transmission path leads to increased network congestion. The existing message polling scheduling method cannot effectively solve this problem.

Method used

Determine the category of the message to be forwarded through preset classification rules, and decide whether to redistribute the sequence number based on the last message of the category and the length of the sent message with the current sequence number, thereby determining the egress of the message and ensuring the load of data transmission. balanced.

Benefits of technology

It effectively improves load balancing during data transmission, reduces network congestion, and enhances network forwarding performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114244845B
    Figure CN114244845B
Patent Text Reader

Abstract

The present application discloses a method, device and electronic device for load balancing, the method comprising determining the category of a message to be forwarded according to a preset classification rule, and determining whether the message to be forwarded is a selected message according to the last message of the category, if it is determined that the message to be forwarded is a selected message, then determining whether to reallocate a sequence number for the category according to the length of the sent message corresponding to the current sequence number of the category and the message length of the message to be forwarded, if it is determined that the sequence number is reallocated for the category, then determining the exit of the message to be forwarded based on the reallocated sequence number; if it is determined that the sequence number is not reallocated for the category, then determining the exit of the message to be forwarded based on the current sequence number, and then sending the message to be forwarded based on the determined exit. Based on the above method, load balancing of the data transmission process can be achieved, solving the problem of aggravated network congestion due to uneven load, effectively improving the balancing effect of forwarding on equal-cost paths, and improving the performance of network forwarding.
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 load balancing method, device and electronic device. Background Art

[0002] During data transmission, there are situations where the amount of data transmitted is large and the transmission duration is long. In this case, if all data is transmitted to one transmission port, this will cause uneven loads on different transmission paths, further aggravating network congestion.

[0003] Currently, a message polling scheduling method is generally used, specifically distributing messages one by one to different ports to achieve load balancing in the transmission process.

[0004] However, different messages have different message lengths. According to the above method, if most of the long messages are distributed to the same port for transmission, there is still a problem of aggravated network congestion of the port. Summary of the invention

[0005] The present application provides a load balancing method, device and electronic device for achieving load balancing in a data transmission process and solving the problem of aggravated network congestion caused by unbalanced load in the transmission process.

[0006] In a first aspect, the present application provides a load balancing method, the method comprising:

[0007] Determine the category of the message to be forwarded according to the preset classification rules;

[0008] Determining whether the message to be forwarded is a selected message according to the last message of the category;

[0009] If it is determined that the message to be forwarded is a selected message, determining whether to reallocate a sequence number for the category according to the length of the sent message corresponding to the current sequence number of the category and the message length of the message to be forwarded;

[0010] If it is determined that the sequence number is reallocated for the category, then the egress of the message to be forwarded is determined based on the reallocated sequence number; if it is determined that the sequence number is not reallocated for the category, then the egress of the message to be forwarded is determined based on the current sequence number;

[0011] The message to be forwarded is sent based on the determined egress.

[0012] Through the above method, load balancing of the data transmission process can be achieved, the problem of aggravated network congestion caused by load imbalance during the transmission process can be solved, the balancing effect of forwarding on equal-cost paths can be effectively improved, and the performance of network forwarding can be improved.

[0013] In one possible design, determining whether the message to be forwarded is a selected message based on the last message of the category includes: determining a first moment for obtaining the last message of the category and a second moment for obtaining the message to be forwarded; calculating the time difference between the first moment and the second moment; determining whether the time difference is greater than a preset time difference; if it is determined that the time difference is less than or equal to the preset time difference, determining that the message to be forwarded is a selected message; if it is determined that the time difference is greater than the preset time difference, determining that the message to be forwarded is not a selected message.

[0014] In one possible design, the determining whether to reallocate the sequence number for the category based on the sent message length corresponding to the current sequence number of the category and the message length of the message to be forwarded includes: determining the current sequence number of the category; obtaining the sent message length corresponding to the current sequence number; calculating the sum of the sent message length and the message length of the message to be forwarded to obtain the cumulative message length; determining whether the cumulative message length is greater than a preset threshold; if it is determined that the cumulative message length is greater than the preset threshold, determining to reallocate the sequence number for the category; if it is determined that the cumulative message length is less than or equal to the preset threshold, determining not to reallocate the sequence number for the category.

[0015] In one possible design, determining the category of the message to be forwarded according to a preset classification rule includes: matching each feature of the message to be forwarded with the preset classification rule; if the selected feature of the message to be forwarded matches the classification rule, then determining the category corresponding to the selected feature according to the correspondence between the feature and the category, as the category of the message to be forwarded.

[0016] In one possible design, the method of determining the exit of the message to be forwarded based on the reallocated sequence number includes: increasing the current sequence number by a set value to obtain the reallocated sequence number; performing a modulo calculation on the reallocated sequence number and the total number of exits; and using the exit corresponding to the result as the exit of the message to be forwarded.

[0017] In one possible design, determining the egress of the message to be forwarded based on the current sequence number includes: performing a modulo calculation on the current sequence number and the total number of egresses; and using the egress corresponding to the obtained result as the egress of the message to be forwarded.

[0018] In a second aspect, the present application provides a load balancing device, the device comprising:

[0019] A category determination module determines the category of the message to be forwarded according to a preset classification rule;

[0020] A selected message determination module is configured to determine whether the message to be forwarded is a selected message according to the last message of the category;

[0021] A sequence number determination module, if it is determined that the message to be forwarded is a selected message, determines whether to reallocate a sequence number for the category according to the length of the sent message corresponding to the current sequence number of the category and the message length of the message to be forwarded;

[0022] Determine an egress module, if it is determined to reallocate a sequence number for the category, determine an egress of the message to be forwarded based on the reallocated sequence number; if it is determined not to reallocate a sequence number for the category, determine an egress of the message to be forwarded based on the current sequence number;

[0023] The message sending module sends the message to be forwarded based on the determined egress.

[0024] In one possible design, the module for determining the selected message is specifically used to: determine a first moment for obtaining the last message of the category and a second moment for obtaining the message to be forwarded; calculate the time difference between the first moment and the second moment; determine whether the time difference is greater than a preset time difference; if it is determined that the time difference is less than or equal to the preset time difference, determine that the message to be forwarded is a selected message; if it is determined that the time difference is greater than the preset time difference, determine that the message to be forwarded is not a selected message.

[0025] In one possible design, the module for determining the serial number is specifically used to: determine the current serial number of the category; obtain the length of the sent message corresponding to the current serial number; calculate the sum of the sent message length and the message length of the message to be forwarded to obtain the cumulative message length; determine whether the cumulative message length is greater than a preset threshold; if it is determined that the cumulative message length is greater than the preset threshold, determine to reallocate the serial number for the category; if it is determined that the cumulative message length is less than or equal to the preset threshold, determine not to reallocate the serial number for the category.

[0026] In one possible design, the category determination module is specifically used to: match each feature of the message to be forwarded with a preset classification rule; if the selected feature of the message to be forwarded matches the classification rule, then determine the category corresponding to the selected feature according to the correspondence between the feature and the category, as the category of the message to be forwarded.

[0027] In one possible design, the export determination module is specifically used to: increase the current sequence number by a set value to obtain a reallocated sequence number; perform a modulo calculation on the reallocated sequence number and the total number of exports; and use the export corresponding to the obtained result as the export of the message to be forwarded.

[0028] In a possible design, the module for determining the egress is specifically used to: perform a modulo calculation on the current sequence number and the total number of egresses; and use the egress corresponding to the obtained result as the egress of the message to be forwarded.

[0029] In a third aspect, the present application provides an electronic device, the electronic device comprising:

[0030] Memory, used to store computer programs;

[0031] The processor is used to implement the above-mentioned load balancing method steps when executing the computer program stored in the memory.

[0032] In a fourth aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the above-mentioned load balancing method steps are implemented.

[0033] For each aspect from the second to the fourth aspect and the technical effects that may be achieved by each aspect, please refer to the above description of the technical effects that can be achieved by the first aspect or various possible schemes in the first aspect, and no further details will be given here. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] Figure 1 A flow chart of a load balancing method provided for this application;

[0035] Figure 2 A schematic diagram of determining the category of a message to be forwarded provided by the present application;

[0036] Figure 3 A schematic diagram of a first category of messages provided by the present application;

[0037] Figure 4 A schematic diagram of a load balancing device provided in this application;

[0038] Figure 5 A schematic diagram of the structure of an electronic device provided in this application. DETAILED DESCRIPTION

[0039] The embodiments of the present application provide a load balancing method, device and electronic device to achieve load balancing during data transmission, thereby solving the problem in the prior art of aggravated network congestion caused by load imbalance during the transmission process.

[0040] The method provided in the embodiments of the present application is further described in detail below in conjunction with the accompanying drawings.

[0041] See also Figure 1As shown, the embodiment of the present application provides a method for load balancing, and the specific process is as follows:

[0042] Step 101: Determine the category of the message to be forwarded according to a preset classification rule;

[0043] In an embodiment of the present application, each feature of the message to be forwarded is matched with a preset classification rule: if the selected feature of the message to be forwarded matches the classification rule, the category corresponding to the selected feature is determined according to the correspondence between the feature and the category, and the category is used as the category of the message to be forwarded.

[0044] Specifically, the features of the message to be forwarded may include a quintuple, a destination board, a destination exit, etc. The preset classification rules may be classification based on the quintuple, classification based on the destination board, classification based on the destination port, etc. If the quintuple matching of the message is classified based on the quintuple, then the quintuple is the selected feature. Since there are many types of quintuples in the message, each quintuple can be called a category, so the correspondence between the quintuple, the selected feature, and the category can be set.

[0045] like Figure 2 As shown, the first message, the second message, the third message, and the fourth message are messages to be forwarded. Taking the quintuple as the selected feature of the message to be forwarded as an example, the quintuples of the above four messages are extracted respectively, and the first type of quintuple extracted from the first message, the second message, and the fourth message is used as the first selected feature of the first message, the second message, and the fourth message, and the second type of quintuple extracted from the third message is used as the second selected feature of the third message. According to the correspondence between the selected features and the categories, the categories of the first message, the second message, and the fourth message are determined to be the first category, and the category of the third message is determined to be the second category.

[0046] Furthermore, in a possible design, a category identifier representing a specific category may be added to the message to be forwarded. Figure 2 In the example, if the category identifier of the first category is "Flow ID1", the category identifier of "Flow ID1" can be added to the first message, the second message and the fourth message; if the category identifier of the second category is "Flow ID2", the category identifier of "Flow ID2" can be added to the third message.

[0047] Through the above method, the category of the message to be forwarded can be effectively and quickly determined.

[0048] Step 102: determining whether the message to be forwarded is a selected message according to the last message of the category;

[0049] In the embodiment of the present application, if it is determined that the message to be forwarded is a selected message, step 103 is executed; if it is determined that the message to be forwarded is not a selected message, step 107 is executed.

[0050] Specifically, first determine the first moment of obtaining the last message of the category and the second moment of obtaining the message to be forwarded, calculate the time difference between the first moment and the second moment, and then determine whether the calculated time difference is greater than the preset time difference: if it is determined that the time difference is less than or equal to the preset time difference, it is determined that the message to be forwarded is the selected message; if it is determined that the time difference is greater than the preset time difference, it is determined that the message to be forwarded is not the selected message.

[0051] It is worth noting that the specific value of the above preset time difference can be set according to actual application conditions.

[0052] For example, if Figure 3 As shown, if the message carrying the "Flow ID1" identifier is taken as the message of the first category, and the category of the message to be forwarded is determined to be the first category, then in the first category, the first moment of the last message obtained is determined, and the second moment of obtaining the message to be processed is determined, and the time difference between the first moment and the second moment is calculated, and the time difference is compared with the preset time difference to determine whether the message to be forwarded is the selected message.

[0053] Through the above method, the message to be forwarded whose time difference is less than the preset time difference is determined as the selected message. The selected message has the characteristic of large transmission volume in a short time. Then, the message to be forwarded as the selected message is processed in the following steps 103-106, which can achieve length balance of the transmitted message, and then achieve load balancing in the data transmission process, and solve the problem of aggravated network congestion caused by the selected messages being sent to the same port.

[0054] Step 103: determining whether to reallocate a sequence number for the category according to the length of the sent message corresponding to the current sequence number of the category and the message length of the message to be forwarded;

[0055] In an embodiment of the present application, the current sequence number of the category of the message to be forwarded is first determined, and the length of the sent message corresponding to the current sequence number is obtained. Then, the sum of the length of the sent message and the length of the message to be forwarded is calculated to obtain the cumulative message length, and it is determined whether the cumulative message length is greater than a preset threshold:

[0056] If it is determined that the accumulated message length is greater than the preset threshold, it is determined that the sequence number is reallocated for the category of the message to be forwarded, and then step 104 is executed.

[0057] If it is determined that the accumulated message length is less than or equal to the preset threshold, it is determined not to reallocate the sequence number for the category of the message to be forwarded, and then step 105 is executed.

[0058] Specifically, one category may correspond to one register, and the register may be used to generate and store the current sequence number and the length of the sent message corresponding to the current sequence number, that is, the corresponding register and the current sequence number and the length of the sent message stored in the register may be determined according to the category of the message to be forwarded.

[0059] For example, if the first category of the message to be forwarded is determined through step 102, then according to the correspondence between the category and the register, the first register corresponding to the first category, the current sequence number stored in the first register, and the sent message length corresponding to the current sequence number can be determined, and then the sum of the sent message length and the message length of the message to be forwarded is calculated to obtain the cumulative message length, and it is determined whether the cumulative message length is greater than the preset threshold: if not, continue to use the current sequence number, and change the sent message length corresponding to the current sequence number to the cumulative message length; if so, reallocate the sequence number, replace the current sequence number of the first register with the reallocated sequence number, and update the sent message length of the first register to the message length of the message to be sent.

[0060] It is worth noting that the reallocated serial number is a serial number that is different from the current serial number. The register is a possible device for generating and storing serial numbers, and any device that can generate and store serial numbers is also applicable here.

[0061] Through the above method, it can be ensured that the total length of the message corresponding to each sequence number does not exceed the preset threshold, that is, the balance of the message length is achieved.

[0062] Step 104: Determine the egress of the message to be forwarded based on the reallocated sequence number;

[0063] In an embodiment of the present application, the current sequence number is increased by a set value to obtain a reallocated sequence number, and then the reallocated sequence number is modulo the total number of exits to obtain a calculated result, and the exit corresponding to the result is used as the exit of the message to be forwarded.

[0064] Specifically, the set value can be determined according to the actual application situation. For example, when the set value is 1, if the current sequence number is 2, the reallocated sequence number is 3; if the current sequence number is 3, the reallocated sequence number is 4, and so on.

[0065] In one possible design, if a register is used to generate and store serial numbers, the sum of the current serial number and the set value can be calculated through the register to generate a reallocated serial number, and the reallocated serial number is used as the current serial number stored in the register.

[0066] Then, the reallocated sequence number is modulo calculated with the total number of exits, and the exit corresponding to the result is used as the exit of the message to be forwarded. For example, if the total number of exits is 3, and the modulo calculation result is 0, it corresponds to the first exit, the modulo calculation result is 1, it corresponds to the second exit, and the modulo calculation result is 2, it corresponds to the third exit. When the reallocated sequence number is 3, the result of the modulo calculation is 0, and the first exit corresponding to 0 can be used as the exit of the message to be forwarded; when the reallocated sequence number is 4, the result of the modulo calculation is 1, and the second exit corresponding to 1 can be used as the exit of the message to be forwarded, and so on.

[0067] Through the above method, the sequence number of the message to be forwarded can be determined to ensure that the total message length corresponding to each sequence number does not exceed the preset threshold, and the exit of the message to be forwarded can be further determined according to the sequence number, so as to achieve load balancing of the transmitted message and solve the problem of aggravated network congestion caused by uneven load of transmitted messages in the prior art.

[0068] Step 105: Determine the egress of the message to be forwarded based on the current sequence number;

[0069] In the embodiment of the present application, a modulo calculation is performed on the current sequence number and the total number of egresses to obtain a result of the calculation, and the egress corresponding to the result is used as the egress of the message to be forwarded.

[0070] For example, if the total number of exits is 3, and the modulus calculation result is 0, which corresponds to the first exit, the modulus calculation result is 1, which corresponds to the second exit, and the modulus calculation result is 2, which corresponds to the third exit. Then, when the reallocated sequence number is 3, the result of the modulus calculation is 0, and the first exit corresponding to 0 can be used as the exit for the message to be forwarded; when the reallocated sequence number is 4, the result of the modulus calculation is 1, and the second exit corresponding to 1 can be used as the exit for the message to be forwarded, and so on.

[0071] Through the above method, the sequence number of the message to be forwarded can be determined to ensure that the total message length corresponding to each sequence number does not exceed the preset threshold, and the exit of the message to be forwarded can be further determined according to the sequence number, so as to achieve load balancing of the transmitted message and solve the problem of aggravated network congestion caused by uneven load of transmitted messages in the prior art.

[0072] Step 106: Send the message to be forwarded based on the determined egress;

[0073] In the embodiment of the present application, the message to be forwarded may be sent in chronological order based on the egress determined in step 105 .

[0074] For example, if it is determined that the egress of the message to be forwarded is the first egress, the message to be forwarded is sent through the first egress; if it is determined that the egress of the message to be forwarded is the second egress, the message to be forwarded is sent through the second egress.

[0075] Based on the above method, load balancing of the data transmission process is achieved, which effectively solves the problem of aggravated network congestion in the existing technology in scenarios with large transmission volume and long transmission duration.

[0076] Step 107: Use a hash algorithm to determine an egress of the message to be forwarded, and send the message to be forwarded based on the egress determined by the hash algorithm.

[0077] In an embodiment of the present application, if it is determined that the message to be forwarded is not a selected message, a hash algorithm is used to calculate the serial number of the message to be forwarded, and then the exit of the message to be forwarded is determined based on the calculated serial number, and finally the message to be forwarded is sent based on the determined exit.

[0078] It is worth noting that the above hash algorithm is a possible method for determining the serial number of the message to be forwarded. The specific method for determining the exit of the message to be forwarded according to the serial number can be referred to step 104 or step 105, which will not be described in detail here.

[0079] Based on the solution provided in the embodiment of the present application, by adding a sequence number to the to-be-forwarded message of the selected message, and then sending the to-be-forwarded message based on the exit corresponding to the sequence number, it can be achieved that the total length of the message sent by a single exit each time will not exceed a preset threshold, that is, based on the balance of the message length, load balancing of the data transmission process is achieved, which can effectively alleviate the problem of aggravated network congestion due to load imbalance in scenarios with large amounts of transmitted data and long transmission durations, effectively improve the balancing effect of forwarding on equal-cost paths, and improve the performance of network forwarding.

[0080] Based on the same inventive concept, the present application also provides a load balancing device to achieve load balancing in the data transmission process, solve the problem of aggravated network congestion caused by load imbalance in the transmission process, effectively improve the balancing effect of forwarding on equal-cost paths, and improve the performance of network forwarding. Figure 4 , the device comprises:

[0081] The category determination module 401 determines the category of the message to be forwarded according to a preset classification rule;

[0082] A selected message determination module 402, which determines whether the message to be forwarded is a selected message according to the last message of the category;

[0083] The sequence number determination module 403 determines whether to reallocate a sequence number for the category according to the length of the sent message corresponding to the current sequence number of the category and the message length of the message to be forwarded if it is determined that the message to be forwarded is a selected message;

[0084] The egress determination module 404 determines the egress of the message to be forwarded based on the reallocated sequence number if it is determined that the sequence number is reallocated for the category; and determines the egress of the message to be forwarded based on the current sequence number if it is determined that the sequence number is not reallocated for the category;

[0085] The message sending module 405 sends the message to be forwarded based on the determined egress.

[0086] In one possible design, the module 402 for determining the selected message is specifically used to: determine a first moment for obtaining the last message of the category and a second moment for obtaining the message to be forwarded; calculate the time difference between the first moment and the second moment; determine whether the time difference is greater than a preset time difference; if it is determined that the time difference is less than or equal to the preset time difference, determine that the message to be forwarded is a selected message; if it is determined that the time difference is greater than the preset time difference, determine that the message to be forwarded is not a selected message.

[0087] In one possible design, the module 403 for determining the serial number is specifically used to: determine the current serial number of the category; obtain the length of the sent message corresponding to the current serial number; calculate the sum of the length of the sent message and the length of the message to be forwarded to obtain the cumulative message length; determine whether the cumulative message length is greater than a preset threshold; if it is determined that the cumulative message length is greater than the preset threshold, determine to reallocate the serial number for the category; if it is determined that the cumulative message length is less than or equal to the preset threshold, determine not to reallocate the serial number for the category.

[0088] In one possible design, the category determination module 401 is specifically used to: match each feature of the message to be forwarded with a preset classification rule; if the selected feature of the message to be forwarded matches the classification rule, then determine the category corresponding to the selected feature according to the correspondence between the feature and the category, as the category of the message to be forwarded.

[0089] In one possible design, the export determination module 404 is specifically used to: increase the current sequence number by a set value to obtain a reallocated sequence number; perform a modulus calculation on the reallocated sequence number and the total number of exports; and use the export corresponding to the obtained result as the export of the message to be forwarded.

[0090] In a possible design, the egress determination module 404 is specifically used to: perform modulus calculation on the current sequence number and the total number of egresses; and use the egress corresponding to the obtained result as the egress of the message to be forwarded.

[0091] Based on the above device, by realizing load balancing in the data transmission process, the problem of aggravated network congestion caused by load imbalance in the transmission process is solved, the balancing effect of forwarding on equal-cost paths is effectively improved, and the performance of network forwarding is improved.

[0092] Based on the same inventive concept, an electronic device is also provided in an embodiment of the present application, and the electronic device can realize the functions of the aforementioned load balancing device, referring to Figure 5 , the electronic device comprises:

[0093] At least one processor 501, and a memory 502 connected to the at least one processor 501. The specific connection medium between the processor 501 and the memory 502 is not limited in the embodiment of the present application. Figure 5 In the example, the processor 501 and the memory 502 are connected via a bus 500. The bus 500 is Figure 5 The connections between other components are shown in bold lines, and are not intended to be limiting. The bus 500 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 5 Only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus. Alternatively, the processor 501 can also be called a controller, and there is no limitation on the name.

[0094] In the embodiment of the present application, the memory 502 stores instructions that can be executed by at least one processor 501. The at least one processor 501 can execute the load balancing method discussed above by executing the instructions stored in the memory 502. The processor 501 can implement Figure 4 The functions of each module in the device shown.

[0095] Among them, the processor 501 is the control center of the device, and can use various interfaces and lines to connect the various parts of the entire control device. By running or executing instructions stored in the memory 502 and calling data stored in the memory 502, the various functions of the device and processing data, the device can be monitored as a whole.

[0096] In one possible design, the processor 501 may include one or more processing units, and the processor 501 may integrate an application processor and a modem processor, wherein the application processor mainly processes an operating system, a user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the modem processor may not be integrated into the processor 501. In some embodiments, the processor 501 and the memory 502 may be implemented on the same chip, and in some embodiments, they may also be implemented separately on separate chips.

[0097] The processor 501 may be a general-purpose processor, such as a central processing unit (CPU), a digital signal processor, an application-specific integrated circuit, a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component, and may implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of the present application. A general-purpose processor may be a microprocessor or any conventional processor, etc. The steps of the load balancing method disclosed in the embodiments of the present application may be directly embodied as being executed by a hardware processor, or may be executed by a combination of hardware and software modules in the processor.

[0098] The memory 502 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs, non-volatile computer executable programs and modules. The memory 502 may include at least one type of storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory, a random access memory (Random Access Memory, RAM), a static random access memory (Static Random Access Memory, SRAM), a programmable read-only memory (Programmable Read Only Memory, PROM), a read-only memory (Read Only Memory, ROM), an electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), a magnetic memory, a disk, an optical disk, etc. The memory 502 is any other medium that can be used to carry or store a desired program code in the form of an instruction or data structure and can be accessed by a computer, but is not limited thereto. The memory 502 in the embodiment of the present application can also be a circuit or any other device that can realize a storage function, for storing program instructions and / or data.

[0099] By programming the processor 501, the code corresponding to the load balancing method described in the above embodiment can be fixed into the chip, so that the chip can execute the load balancing method when running. Figure 1 The steps of the load balancing method in the illustrated embodiment. How to design and program the processor 501 is a technique known to those skilled in the art and will not be described in detail here.

[0100] Based on the same inventive concept, an embodiment of the present application further provides a storage medium, which stores computer instructions. When the computer instructions are executed on a computer, the computer executes the load balancing method discussed above.

[0101] In some possible implementations, various aspects of the load balancing method provided in the present application may also be implemented in the form of a program product, which includes a program code. When the program product is run on an apparatus, the program code is used to enable the control device to execute the steps of the load balancing method according to various exemplary implementations of the present application described above in this specification.

[0102] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, devices, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.

[0103] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0104] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0105] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0106] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims

1. A load balancing method, It is characterized in that The method comprises: Determine the category of the message to be forwarded according to the preset classification rules; Determine whether the message to be forwarded is a selected message based on a time difference between a first moment and a second moment, wherein the first moment is a moment of obtaining the last message of the category, and the second moment is a moment of obtaining the message to be forwarded; If it is determined that the message to be forwarded is a selected message, determining whether to reallocate a sequence number for the category according to the length of the sent message corresponding to the current sequence number of the category and the message length of the message to be forwarded; If it is determined that the sequence number is reallocated for the category, then the egress of the message to be forwarded is determined based on the reallocated sequence number; if it is determined that the sequence number is not reallocated for the category, then the egress of the message to be forwarded is determined based on the current sequence number; The message to be forwarded is sent based on the determined egress.

2. The method according to claim 1, It is characterized in that The determining, based on the time difference between the first moment and the second moment, whether the message to be forwarded is a selected message includes: determining the first time and the second time; Calculating a time difference between the first moment and the second moment; Determining whether the time difference is greater than a preset time difference; If it is determined that the time difference is less than or equal to the preset time difference, determining that the message to be forwarded is a selected message; If it is determined that the time difference is greater than the preset time difference, it is determined that the message to be forwarded is not a selected message.

3. The method according to claim 1, It is characterized in that The determining whether to reallocate a sequence number for the category according to the length of the sent message corresponding to the current sequence number of the category and the message length of the message to be forwarded includes: determining a current sequence number for said category; Obtain the length of the sent message corresponding to the current sequence number; Calculate the sum of the length of the sent message and the length of the message to be forwarded to obtain a cumulative message length; Determine whether the accumulated message length is greater than a preset threshold; If it is determined that the accumulated message length is greater than the preset threshold, determining to reallocate a sequence number for the category; If it is determined that the accumulated message length is less than or equal to the preset threshold, it is determined not to reallocate the sequence number for the category.

4. The method according to claim 1, It is characterized in that Determining the category of the message to be forwarded according to a preset classification rule includes: Match each feature of the message to be forwarded with the preset classification rules; If the selected feature of the message to be forwarded matches the classification rule, the category corresponding to the selected feature is determined according to the correspondence between the feature and the category as the category of the message to be forwarded.

5. The method according to any one of claims 1 to 4, It is characterized in that The determining the egress of the message to be forwarded based on the reallocated sequence number includes: Increasing the current sequence number by a set value to obtain a reallocated sequence number; Calculate the remainder of the reallocated sequence number and the total number of exports; The egress corresponding to the obtained result is used as the egress of the message to be forwarded.

6. The method according to any one of claims 1 to 4, It is characterized in that The step of determining the egress of the message to be forwarded based on the current sequence number includes: Calculate the remainder of the current sequence number and the total number of exports; The egress corresponding to the obtained result is used as the egress of the message to be forwarded.

7. A load balancing device, It is characterized in that The device comprises: A category determination module determines the category of the message to be forwarded according to a preset classification rule; Determine a selected message module, determine whether the message to be forwarded is a selected message based on a time difference between a first moment and a second moment, wherein the first moment is a moment of obtaining the last message of the category, and the second moment is a moment of obtaining the message to be forwarded; A sequence number determination module, if it is determined that the message to be forwarded is a selected message, determines whether to reallocate a sequence number for the category according to the length of the sent message corresponding to the current sequence number of the category and the message length of the message to be forwarded; Determine an egress module, if it is determined to reallocate a sequence number for the category, determine an egress of the message to be forwarded based on the reallocated sequence number; if it is determined not to reallocate a sequence number for the category, determine an egress of the message to be forwarded based on the current sequence number; The message sending module sends the message to be forwarded based on the determined egress.

8. The device according to claim 7, It is characterized in that The module for determining the sequence number is specifically used to determine the current sequence number of the category; obtain the length of the sent message corresponding to the current sequence number; calculate the sum of the length of the sent message and the length of the message to be forwarded to obtain the cumulative message length; Determine whether the accumulated message length is greater than a preset threshold; If it is determined that the accumulated message length is greater than the preset threshold, determining to reallocate a sequence number for the category; If it is determined that the accumulated message length is less than or equal to the preset threshold, it is determined not to reallocate the sequence number for the category.

9. An electronic device, It is characterized in that include: Memory, used to store computer programs; A processor, configured to implement the method steps of any one of claims 1 to 6 when executing the computer program stored in the memory.

10. A computer-readable storage medium, It is 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 described in any one of claims 1 to 6 are implemented.