A load balancing method, apparatus, device, medium and program product

By monitoring server load and network limits, and dynamically migrating computational data, the problem of low computational efficiency caused by unbalanced load in existing technologies is solved, achieving load balancing and efficient utilization of computing resources.

CN119697190BActive Publication Date: 2025-11-25INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411911163.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-24
Publication Date
2025-11-25
Estimated Expiration
2044-12-24

AI Technical Summary

Technical Problem

Existing technologies cannot detect server load imbalances in a timely manner, resulting in low computational efficiency. Furthermore, existing load balancing methods require recalculating the location of computational data, causing computational interruptions and additional time overhead.

Method used

By monitoring the server's CPU utilization, memory utilization, and access volume, the load pressure difference is calculated. Combined with network bandwidth and data size limits, the amount of data migration is determined, and computational data is migrated from the server with high load to the server with low load for processing.

Benefits of technology

It enables timely detection and handling of load imbalances, improves server computing efficiency, avoids computing interruptions and additional time overhead, and ensures full utilization of computing resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119697190B_ABST
    Figure CN119697190B_ABST
Patent Text Reader

Abstract

Embodiments of the present application disclose a load balancing method, device, equipment, medium and program product, and relate to the field of cloud computing, comprising: determining the load pressure of each server according to the CPU utilization, memory utilization and accessed number of each server, and calculating the load pressure difference between the servers; obtaining a data sending server and a data receiving server with a load pressure difference greater than or equal to a pressure difference threshold value, and determining the data flow resistance from the data sending server to the data receiving server according to a network bandwidth limit value and a data size limit value; determining the data migration amount from the data sending server to the data receiving server according to the load pressure difference and the data flow resistance corresponding to the data sending server and the data receiving server; and migrating the calculation data on the data sending server to the data receiving server for processing according to the data migration amount, thereby realizing load balancing of the server and improving the calculation efficiency of the server.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of cloud computing, and in particular to a load balancing method, device, equipment, medium and program product. BACKGROUND

[0002] Load balancing is a technology for distributing resources in a computer network, mainly used for distributing network traffic or requests to multiple servers for processing to ensure that the load between servers is relatively uniform, avoid single-point overload, and maximize the performance and stability of the overall system.

[0003] In the prior art, load balancing of servers is usually achieved by using a modulo hash algorithm, a consistent hash algorithm or a consistent hash algorithm with virtual nodes.

[0004] However, the load balancing of servers achieved by using a modulo hash algorithm, a consistent hash algorithm or a consistent hash algorithm with virtual nodes can only determine the calculation data distribution rule, and cannot timely discover the server load imbalance condition, resulting in the inability to timely process the server load imbalance condition, thereby reducing the calculation efficiency of the server. Secondly, the load balancing processing of each server in the prior art requires re-computing the location of each calculation data, causing calculation interruption and additional time overhead, thereby reducing the processing efficiency of the calculation data. SUMMARY

[0005] The present application provides a load balancing method, device, equipment, medium and program product, which can timely discover and process the server load imbalance, thereby improving the calculation efficiency of the server.

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

[0007] determining the load pressure of each server according to the CPU utilization, memory utilization and access quantity of each server, and calculating the load pressure difference between the servers;

[0008] obtaining a data sending server and a data receiving server with a load pressure difference greater than or equal to a set pressure difference threshold, and determining the data flow resistance from the data sending server to the data receiving server according to the network bandwidth limit value and the data size limit value between the data sending server and the data receiving server;

[0009] determining the data migration amount from the data sending server to the data receiving server according to the load pressure difference and the data flow resistance corresponding to the data sending server and the data receiving server;

[0010] migrating the calculation data on the data sending server to the data receiving server for processing according to the data migration amount.

[0011] Optionally, the load pressure of each server is determined according to the CPU utilization, the memory utilization and the accessed quantity of each server, including: performing weighted summation on the CPU utilization, the memory utilization and the accessed quantity of each server respectively to obtain the load pressure of each server; and the data flow resistance from the data sending server to the data receiving server is determined according to the network bandwidth limitation value and the data size limitation value between the data sending server and the data receiving server, including: performing weighted summation on the network bandwidth limitation value and the data size limitation value to obtain the data flow resistance from the data sending server to the data receiving server.

[0012] Optionally, the data migration quantity from the data sending server to the data receiving server is determined according to the load pressure difference corresponding to the data sending server and the data receiving server and the data flow resistance, including: determining the data migration quantity from the data sending server to the data receiving server according to the division result of the load pressure difference and the data flow resistance.

[0013] Optionally, the calculation data on the data sending server is migrated to the data receiving server for processing, including: determining whether the data migration quantity is greater than a set migration quantity threshold; if yes, obtaining an actual migration quantity by subtracting the migration quantity threshold from the data migration quantity, and migrating the calculation data on the data sending server to the data receiving server for processing according to the actual migration quantity; obtaining candidate servers other than the data sending server and the data receiving server, and server numbers of each candidate server; generating a random integer based on the server numbers by using a random number generator, and taking a candidate server with the same server number and random integer as a target server; after migrating the calculation data of the migration quantity threshold to the target server, returning to perform the operation of determining the load pressure of each server according to the CPU utilization, the memory utilization and the accessed quantity of each server until the load balancing condition is met; and if not, obtaining the calculation data of the data migration quantity on the data sending server, and migrating the calculation data of the data migration quantity to the data receiving server for processing.

[0014] Optionally, the calculation data on the data sending server is migrated to the data receiving server for processing according to the actual migration quantity, including: obtaining target calculation data of the actual migration quantity on the data sending server according to the data correlation, the data access frequency and the data update frequency of each calculation data on the data sending server; and migrating the target calculation data of the actual migration quantity to the data receiving server for processing.

[0015] Optionally, the method further comprises: collecting the load pressure, the load pressure difference and the data flow resistance corresponding to each server respectively at a set frequency, and generating a load pressure diagram corresponding to each server respectively according to the load pressure, the load pressure difference and the data flow resistance corresponding to each server respectively; and displaying the load pressure diagram corresponding to each server respectively, so that a user determines the data sending server, the data receiving server and the data migration amount from the data sending server to the data receiving server according to the load pressure, the load pressure difference and the data flow resistance on the load pressure diagram.

[0016] In a second aspect, an embodiment of the present application further provides a load balancing device, comprising:

[0017] a load pressure difference determination module configured to determine the load pressure of each server according to the CPU utilization, the memory utilization and the accessed number of each server, and calculate the load pressure difference between the servers;

[0018] a data flow resistance determination module configured to obtain the data sending server and the data receiving server with the load pressure difference greater than or equal to a set pressure difference threshold, and determine the data flow resistance from the data sending server to the data receiving server according to the network bandwidth limit value and the data size limit value between the data sending server and the data receiving server;

[0019] a data migration amount determination module configured to determine the data migration amount from the data sending server to the data receiving server according to the load pressure difference and the data flow resistance corresponding to the data sending server and the data receiving server;

[0020] a data migration module configured to migrate the calculation data on the data sending server to the data receiving server for processing according to the data migration amount.

[0021] In a third aspect, an embodiment of the present application further provides an electronic device, comprising:

[0022] at least one processor; and

[0023] a memory connected with the at least one processor in communication; wherein,

[0024] the memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to execute the load balancing method provided by any of the embodiments of the present application.

[0025] In a fourth aspect, an embodiment of the present application further provides a computer readable storage medium storing computer instructions, and the computer instructions are used to enable a processor to implement the load balancing method provided by any of the embodiments of the present application when executed.

[0026] In a fifth aspect, an embodiment of the present application further provides a computer program product, which comprises a computer program, and the computer program, when executed by a processor, implements the load balancing method provided by any of the embodiments of the present application.

[0027] According to the technical scheme of the embodiment of the present application, the data sending server and the data receiving server whose load pressure difference is greater than or equal to the set pressure difference threshold are obtained, the data migration amount from the data sending server to the data receiving server is determined according to the load pressure difference corresponding to the data sending server and the data receiving server and the data flow resistance, and the computing data on the data sending server is migrated to the data receiving server for processing according to the data migration amount, which avoids the prior art that can only determine the computing data distribution rule and cannot timely find the server with uneven load, thereby reducing the computing efficiency of the server, and can timely find and process the server with uneven load, thereby achieving full use of the computing resource and improving the processing efficiency of the computing data.

[0028] It should be understood that the content described in this part is not intended to identify the key or important features of the embodiments of the present application, nor is it used to limit the scope of the present application. Other features of the present application will become apparent from the following description. BRIEF DESCRIPTION OF DRAWINGS

[0029] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.

[0030] Figure 1 is a flow chart of a load balancing method according to an embodiment of the present application;

[0031] Figure 2 is a flow chart of another load balancing method according to an embodiment of the present application;

[0032] Figure 3 is a schematic diagram of re-distribution of computing data on a down server according to an embodiment of the present application;

[0033] Figure 4 is a structural schematic diagram of a load balancing device according to an embodiment of the present application;

[0034] Figure 5 is a structural schematic diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0035] In order to make the person skilled in the art better understand the present application, the technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative labor should fall within the protection scope of the present application.

[0036] It should be noted that the terms "first", "second" and the like in the specification and claims of the present application and the above-described drawings are used to distinguish similar objects, and do not necessarily indicate a specific order or a chronological sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device that includes a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to these processes, methods, products or devices.

[0037] Embodiment one

[0038] Figure 1 is a flowchart of a load balancing method according to the embodiment one of the present application. The embodiment can be applicable to the case of load balancing processing for each server. The method can be executed by a load balancing device, which can be realized in the form of hardware and / or software, and can be configured in an electronic device such as a computer.

[0039] As shown in Figure 1 , the load balancing method disclosed in the embodiment comprises:

[0040] S110, determining the load pressure of each server according to the CPU utilization, memory utilization and access number of each server, and calculating the load pressure difference between the servers.

[0041] In this step, specifically, the load pressure of each server can be determined according to the sum of the CPU utilization, memory utilization and access number of each server. Alternatively, the CPU utilization, memory utilization and access number of each server can be weighted and summed to obtain the load pressure of each server.

[0042] S120, acquire the data sending server and the data receiving server whose load pressure difference is greater than or equal to the set pressure difference threshold value, and determine the data flow resistance from the data sending server to the data receiving server according to the network bandwidth limitation value and the data size limitation value between the data sending server and the data receiving server.

[0043] In this embodiment, the data flow resistance can be used to reflect the resistance of the computing data transmission between the data sending server and the data receiving server.

[0044] In this step, specifically, it can be judged whether the load pressure difference between the servers is greater than or equal to the set pressure difference threshold value, and the server whose load pressure difference is greater than or equal to the set pressure difference threshold value is taken as the data sending server and the data receiving server. Wherein, the load pressure of the data sending server is greater than the load pressure of the data receiving server. The pressure difference threshold value can be determined according to user demand and / or historical experience.

[0045] Then, the network bandwidth limitation value and the data size limitation value when the data transmission between the data sending server and the data receiving server can be acquired, and the data flow resistance from the data sending server to the data receiving server is determined according to the network bandwidth limitation value and the data size limitation value. For example, the data flow resistance from the data sending server to the data receiving server can be determined according to the sum of the network bandwidth limitation value and the data size limitation value. Or, the data flow resistance from the data sending server to the data receiving server can be determined according to the weighted sum of the network bandwidth limitation value and the data size limitation value. Wherein, the network bandwidth limitation value can be determined according to user demand and / or historical experience. The data size limitation value can be determined according to the data size of each transmission between the sending server and the data receiving server, for example, the data size limitation value can be determined according to the average value of the data size of each transmission.

[0046] S130, determine the data migration amount from the data sending server to the data receiving server according to the load pressure difference and the data flow resistance corresponding to the data sending server and the data receiving server.

[0047] In this step, specifically, the data migration amount from the data sending server to the data receiving server can be determined according to the ratio of the load pressure difference and the data flow resistance.

[0048] S140, according to the data migration amount, migrate the computing data on the data sending server to the data receiving server for processing.

[0049] In this step, specifically, the computing data of the data migration amount can be acquired on the data sending server, and the computing data of the data migration amount is migrated to the data receiving server for processing.

[0050] The technical scheme of the embodiment determines the load pressure of each server according to the CPU utilization, the memory utilization and the accessed quantity of each server, and calculates the load pressure difference between the servers; obtains the data sending server and the data receiving server whose load pressure difference is greater than or equal to a set pressure difference threshold value, and determines the data flow resistance from the data sending server to the data receiving server according to the network bandwidth limit value and the data size limit value between the data sending server and the data receiving server; determines the data migration quantity from the data sending server to the data receiving server according to the load pressure difference and the data flow resistance corresponding to the data sending server and the data receiving server; and migrates the calculation data on the data sending server to the data receiving server for processing according to the data migration quantity. The technical scheme solves the problem that the prior art can only determine the calculation data distribution rule and cannot discover the server with unbalanced load in time, resulting in low calculation efficiency of the server, can discover and process the server with unbalanced load in time, and realizes full use of the calculation resource and improves the calculation efficiency of the server.

[0051] Embodiment Two

[0052] Figure 2 is a flowchart of another load balancing method according to Embodiment Two of the present application, which is a further optimization and extension based on the above-mentioned embodiments and can be combined with each optional technical scheme in the above-mentioned embodiments.

[0053] As shown in Figure 2 , the load balancing method disclosed in the embodiment comprises:

[0054] S210, weighted summation is performed on the CPU utilization, the memory utilization and the accessed quantity of each server respectively to obtain the load pressure of each server, and the load pressure difference between the servers is calculated.

[0055] In this step, specifically, the CPU utilization can be multiplied by a first weight coefficient to obtain a first multiplication result, the memory utilization can be multiplied by a second weight coefficient to obtain a second multiplication result, and the accessed quantity can be multiplied by a third weight coefficient to obtain a third multiplication result. The first weight coefficient, the second weight coefficient and the third weight coefficient can be determined according to the importance of the CPU utilization, the memory utilization and the accessed quantity to the user. Then, the sum of the first multiplication result, the second multiplication result and the third multiplication result can be calculated to obtain the load pressure of the server.

[0056] Exemplarily, the load pressure of each server can be determined by the following specific calculation formula:

[0057] Pi = w1 x CPUi + w2 x Memoryi + w3 x Requesti

[0058] wherein Pi is the load pressure, w1 is the first weight coefficient, w2 is the second weight coefficient, w3 is the third weight coefficient, CPUi is the CPU utilization rate, Memoryi is the memory utilization rate, and Requesti is the number of accesses.

[0059] The advantage of such an arrangement is that the load pressure of the server is obtained by weighted summation of the CPU utilization rate, the memory utilization rate and the number of accesses, the importance of the CPU utilization rate, the memory utilization rate and the number of accesses to the calculation of the load pressure is fully considered, and the accuracy of the calculated load pressure is improved.

[0060] S220, obtain the data sending server and the data receiving server whose load pressure difference is greater than or equal to the set pressure difference threshold value, and weighted sum the network bandwidth limitation value and the data size limitation value to obtain the data flow resistance from the data sending server to the data receiving server.

[0061] In this step, specifically, the network bandwidth limitation value can be multiplied by a fourth weight coefficient to obtain a fourth multiplication result, and the data size limitation value can be multiplied by a fifth weight coefficient to obtain a fifth multiplication result. The fourth weight coefficient and the fifth weight coefficient can be determined according to the importance of the network bandwidth limitation value and the data size limitation value to the user. Then, the sum of the fourth multiplication result and the fifth multiplication result can be calculated to obtain the data flow resistance from the data sending server to the data receiving server.

[0062] For example, the data flow resistance from the data sending server to the data receiving server can be determined by the following specific calculation formula:

[0063] Rij = k1 x Netwidthij + k2 x Dataij

[0064] wherein Rij is the data flow resistance, k1 is the fourth weight coefficient, k2 is the fifth weight coefficient, Netwidthij is the network bandwidth limitation value, and Dataij is the data size limitation value.

[0065] The advantage of such an arrangement is that the data flow resistance from the data sending server to the data receiving server is obtained by weighted summation of the network bandwidth limitation value and the data size limitation value, the importance of the network bandwidth limitation value and the data size limitation value to the data flow resistance is considered, and the accuracy of the calculated data flow resistance is improved.

[0066] S230, determining the data migration amount from the data sending server to the data receiving server according to the result of dividing the load pressure difference by the data flow resistance.

[0067] In this step, specifically, the data migration amount from the data sending server to the data receiving server can be obtained by dividing the load pressure difference by the data flow resistance.

[0068] Specifically, the data migration amount from the data sending server to the data receiving server can be determined by the following specific calculation formula:

[0069]

[0070] Wherein, Qij is the data migration amount, Pij is the load pressure difference, and Rij is the data flow resistance. Specifically, the load pressure difference can be determined according to the formula Pij = Pi - Pj, wherein Pi is the load pressure of the data sending server, and Pj is the load pressure of the data receiving server.

[0071] The advantage of such setting is that the data migration amount from the data sending server to the data receiving server is determined by the load pressure difference and the data flow resistance, which considers the influence of the load pressure difference on the data migration amount and the influence of the data flow resistance on the data migration amount, thereby improving the accuracy of the calculated data migration amount.

[0072] S240, determining whether the data migration amount is greater than the set migration amount threshold, if yes, executing S250, if no, executing S290.

[0073] In this step, specifically, the migration amount threshold can be obtained by dividing the total number of calculation data distributed to each server for processing by the total number of servers. Then, when the data migration amount is greater than the set migration amount threshold, the calculation data of the data migration amount can be migrated to the data receiving server and other servers for processing. When the data migration amount is less than or equal to the set migration amount threshold, the calculation data of the data migration amount can be migrated to the data receiving server for processing.

[0074] S250, calculating the actual migration amount by subtracting the migration amount threshold from the data migration amount, and migrating the calculation data of the actual migration amount from the data sending server to the data receiving server for processing.

[0075] In this step, specifically, after obtaining the actual migration amount by subtracting the migration amount threshold from the data migration amount, the calculation data of the actual migration amount can be obtained from the data sending server and migrated to the data receiving server for processing.

[0076] Optionally, the computing data on the data sending server is migrated to the data receiving server according to the actual migration amount, including: obtaining target computing data of the actual migration amount on the data sending server according to data correlation, data access frequency and data update frequency of each computing data on the data sending server; migrating the target computing data of the actual migration amount to the data receiving server for processing.

[0077] Specifically, each computing data can be sorted in ascending order according to data correlation to obtain a first sorting result. Then, when it is detected that there is computing data with the same data correlation in the first sorting result, the computing data with the same data correlation can be sorted in ascending order according to data access frequency to obtain a second sorting result. After that, when it is detected that there is computing data with the same data access frequency in the second sorting result, the computing data with the same data access frequency can be sorted in ascending order according to data update frequency to obtain an actual sorting result of each computing data on the data sending server. Finally, target computing data of the actual migration amount can be obtained on the data sending server according to the actual sorting result, and the target computing data of the actual migration amount can be migrated to the data receiving server for processing.

[0078] Exemplarily, target computing data with low data correlation, data access frequency and data update frequency can be obtained on the data sending server according to the actual migration amount, and the target computing data of the actual migration amount can be migrated to the data receiving server for processing.

[0079] The advantage of such arrangement is that target computing data with low data correlation, data access frequency and data update frequency can be migrated to the data receiving server for processing by obtaining target computing data of the actual migration amount on the data sending server according to data correlation, data access frequency and data update frequency of each computing data, thereby effectively improving the computing efficiency of the data sending server.

[0080] S260, obtaining candidate servers other than the data sending server and the data receiving server, and a server number of each candidate server.

[0081] S270, using a random number generator to generate a random integer based on each server number, and taking a candidate server with the same server number and random integer as a target server.

[0082] In this embodiment, the random integer can be the same as the server number of any candidate server.

[0083] Exemplarily, assuming that the server numbers of the candidate servers are 0, 1 and 3 respectively, a random integer 0, 1 or 3 can be generated. If the random integer is 1, the candidate server with the server number 1 can be taken as the target server.

[0084] S280, after the calculation data of the migration amount threshold is migrated to the target server, return to execute S210 until the load balancing condition is met.

[0085] In this step, specifically, the calculation data of the migration amount threshold can be obtained in the data sending server, and the calculation data of the migration amount threshold is migrated to the target server. Then, the operation of weighted summation of CPU utilization, memory utilization and accessed number of each server can be returned to execute until any one of the load balancing conditions is met. Among them, the load balancing conditions can be multiple, for example, the load pressure difference between the servers is less than the set pressure difference threshold, or the data migration amount migrated from the data sending server to the data receiving server is less than or equal to the set migration amount threshold.

[0086] S290, obtaining the calculation data of the data migration amount on the data sending server, and migrating the calculation data of the data migration amount to the data receiving server for processing.

[0087] In this step, specifically, the calculation data of the data migration amount can be obtained on the data sending server according to the data correlation, data access frequency and data update frequency of each calculation data on the data sending server, and the calculation data of the data migration amount is migrated to the data receiving server for processing.

[0088] The advantage of such setting is that by migrating the calculation data of the data migration amount to the data receiving server and other servers for processing when the data migration amount is greater than the set migration amount threshold, the situation that the calculation data distributed to the data receiving server is too much to cause new load balancing problems can be avoided, the relative uniformity of the load between the servers is ensured, and the processing efficiency of the calculation data is improved.

[0089] Optionally, the method further comprises: collecting the load pressure, load pressure difference and data flow resistance corresponding to each server respectively according to the set frequency, and generating the load pressure diagram corresponding to each server respectively according to the load pressure, load pressure difference and data flow resistance corresponding to each server respectively; displaying the load pressure diagram corresponding to each server respectively, so that the user determines the data sending server, data receiving server and data migration amount migrated from the data sending server to the data receiving server according to the load pressure, load pressure difference and data flow resistance on the load pressure diagram. Among them, the load pressure diagram can be a line chart or a histogram with time as the horizontal axis.

[0090] The advantage of this setup is that by generating and displaying load pressure maps corresponding to each server, users can intuitively obtain the load pressure difference and data flow resistance between servers, which improves the efficiency of determining data sending servers, data receiving servers, and data migration volume, thereby improving the efficiency of load balancing scheduling among servers.

[0091] Optionally, when a server failure is detected, the system can obtain the remaining servers to be selected, along with their server IDs, and use a random number generator to generate a first random integer based on these server IDs. Then, a server with the same server ID as the first random integer can be selected as a data receiving server, and any computational data that is currently unavailable on the failed server can be migrated to that server for processing. Subsequently, if computational data still exists on the failed server, a second random integer, different from the first random integer, can be generated based on the server IDs of the servers to be selected. Finally, the second random integer can be used as the first random integer, and the system can return to executing the operation of selecting a server with the same server ID as the first random integer as the data receiving server, until no more computational data is detected on any failed server.

[0092] For example, such as Figure 3 As shown, there are neural network models numbered 1, 2, 3, 4, 5, and 6. The computational data for models 3 and 6 has been assigned to server 0 using a modulo hash algorithm, the computational data for models 1 and 4 to server 1, and the computational data for models 2 and 5 to server 2. When server 2 is detected to be down, a random number generator can generate a first random integer (0 or 1). If the first random integer is 0, the computational data from one of the downed servers can be assigned to server 0 for processing. Since there is still computational data on the downed server, a second random integer (different from the first random integer, which can only be 1) can be generated. In this case, the last computational data from the last downed server can be assigned to server 1 for processing.

[0093] Optionally, when the new server is detected, the alternative servers and the server numbers of the alternative servers can be obtained, and the random number generator can generate a third random integer based on the server numbers of the alternative servers. Then, the alternative server with the same server number as the third random integer can be selected as the data sending server, and one of the computing data is selected to migrate to the new server for processing. After that, when the load of the new server is detected to be too low, the random number generator can generate a fourth random integer different from the third random integer based on the server numbers of the alternative servers. Finally, the fourth random integer can be used as the third random integer, and the operation of selecting the alternative server with the same server number as the third random integer as the data sending server can be returned until the load balancing among the servers is achieved.

[0094] The advantage of such a setting is that, compared with the prior art of achieving server load balancing through modulo hashing algorithm, consistent hashing algorithm or consistent hashing algorithm with virtual nodes, the technical solution of the embodiment determines the data sending server and the data receiving server by generating random integers, avoiding the need to recalculate the location of each computing data when the number of servers changes, thereby causing the interruption of calculation and additional time consumption. At the same time of achieving load balancing of each server, the processing efficiency of computing data is improved. Secondly, by generating a second random integer different from the first random integer and a fourth random integer different from the third random integer, the situation of distributing too much computing data to the same server and migrating too much computing data from the same server is avoided, and the load balancing of the server is achieved.

[0095] The technical solution of the embodiment calculates the load pressure of the server by weighting and summing the CPU utilization, memory utilization and access number, fully considers the influence of the importance of CPU utilization, memory utilization and access number on load pressure calculation, and improves the accuracy of the calculated load pressure. Secondly, by weighting and summing the network bandwidth limit value and the data size limit value, the data flow resistance from the data sending server to the data receiving server is obtained, which considers the influence of the importance of the network bandwidth limit value and the data size limit value on the data flow resistance, and improves the accuracy of the calculated data flow resistance. Finally, by migrating the computing data of the data migration amount to the data receiving server and other servers for processing when the data migration amount is greater than the set migration threshold, the situation of too much computing data being distributed to the data receiving server and causing new load balancing problems can be avoided, the load among the servers is relatively uniform, and the processing efficiency of the computing data is improved.

[0096] Embodiment Three

[0097] Figure 4 is a structural schematic diagram of a load balancing device provided according to Embodiment Three of the present application. The present embodiment can be applied to the case of load balancing of each server. The load balancing device can be realized in the form of hardware and / or software and can be configured in an electronic device such as a computer.

[0098] As shown in Figure 4 , the load balancing device disclosed in the present embodiment comprises a load pressure difference determination module 41, a data flow resistance determination module 42, a data migration amount determination module 43 and a data migration module 44, wherein:

[0099] The load pressure difference determination module 41 is configured to determine the load pressure of each server according to the CPU utilization rate, the memory utilization rate and the number of accesses of each server, and to calculate the load pressure difference between the servers.

[0100] The data flow resistance determination module 42 is configured to obtain a data sending server and a data receiving server whose load pressure difference is greater than or equal to a set pressure difference threshold value, and to determine the data flow resistance from the data sending server to the data receiving server according to the network bandwidth limit value and the data size limit value between the data sending server and the data receiving server.

[0101] The data migration amount determination module 43 is configured to determine the data migration amount from the data sending server to the data receiving server according to the load pressure difference and the data flow resistance corresponding to the data sending server and the data receiving server.

[0102] The data migration module 44 is configured to migrate the calculation data on the data sending server to the data receiving server for processing according to the data migration amount.

[0103] The technical solution in the present embodiment solves the problem in the prior art that only the calculation data distribution rule can be determined and the server with uneven load cannot be found in time, resulting in low calculation efficiency of the server, by the mutual cooperation of the load pressure difference determination module, the data flow resistance determination module, the data migration amount determination module and the data migration module, can find and process the server with uneven load in time, realizes full utilization of the calculation resource and improves the calculation efficiency of the server.

[0104] Optionally, the load pressure difference determination module 41 is specifically configured to perform weighted summation on the CPU utilization rate, the memory utilization rate and the number of accesses of each server to obtain the load pressure of each server.

[0105] Optionally, the data flow resistance determination module 42 is specifically configured to perform weighted summation on the network bandwidth limit value and the data size limit value to obtain the data flow resistance from the data sending server to the data receiving server.

[0106] Optionally, the data migration amount determining module 43 is specifically configured to determine the data migration amount from the data sending server to the data receiving server according to the division result of the load pressure difference and the data flow resistance.

[0107] Optionally, the data migration module 44 is specifically configured to determine whether the data migration amount is greater than the migration amount threshold value, and if yes, calculate an actual migration amount by subtracting the migration amount threshold value from the data migration amount, and migrate the calculation data on the data sending server to the data receiving server according to the actual migration amount; obtain candidate servers other than the data sending server and the data receiving server, and server numbers of each candidate server; generate a random integer based on the server numbers using a random number generator, and take the candidate server with the same server number and random integer as a target server; after migrating the calculation data of the migration amount threshold value to the target server, return to perform the operation of determining the load pressure of each server according to the CPU utilization rate, the memory utilization rate and the access amount of each server until the load balancing condition is met; and if not, obtain the calculation data of the data migration amount on the data sending server, and migrate the calculation data of the data migration amount to the data receiving server for processing.

[0108] Optionally, when migrating the calculation data on the data sending server to the data receiving server according to the actual migration amount, the data migration module 44 is specifically configured to obtain target calculation data of the actual migration amount on the data sending server according to the data correlation, the data access frequency and the data update frequency of each calculation data on the data sending server; and migrate the target calculation data of the actual migration amount to the data receiving server for processing.

[0109] Optionally, the device further comprises a load pressure diagram generating module, which is configured to collect the load pressure, the load pressure difference and the data flow resistance corresponding to each server at a set frequency, and generate a load pressure diagram corresponding to each server according to the load pressure, the load pressure difference and the data flow resistance corresponding to each server; and display the load pressure diagram corresponding to each server, so that a user can determine the data sending server, the data receiving server and the data migration amount from the data sending server to the data receiving server according to the load pressure, the load pressure difference and the data flow resistance on the load pressure diagram.

[0110] The load balancing device provided by the embodiments of the present application can perform the load balancing method provided by any of the embodiments of the present application, and has the corresponding function modules and beneficial effects of the execution method. The contents not described in detail in the present embodiment can be referred to the description in any of the method embodiments of the present application.

[0111] Embodiment Four

[0112] Figure 5 A structural diagram of an electronic device 10 that can be used to implement embodiments of the present application is shown. As shown, the electronic device 10 includes at least one processor 11, and memory, such as read-only memory (ROM) 12, random access memory (RAM) 13, etc., communicatively connected to the at least one processor 11, where the memory stores computer programs that can be executed by the at least one processor. The processor 11 can perform various appropriate actions and processes according to the computer programs stored in the read-only memory (ROM) 12 or loaded into the random access memory (RAM) 13 from the storage unit 18. Various programs and data required for the operation of the electronic device 10 can also be stored in the RAM 13. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14. Figure 5

[0113] Various components in the electronic device 10 are connected to the I / O interface 15, including an input unit 16, such as a keyboard, a mouse, etc., an output unit 17, such as various types of displays, a speaker, etc., a storage unit 18, such as a magnetic disk, an optical disk, etc., and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network, such as the Internet, and / or various telecommunication networks.

[0114] The processor 11 can be various general and / or special purpose processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 performs various methods and processes described above, such as the load balancing method.

[0115] In some embodiments, the load balancing method can be implemented as a computer program tangibly embodied in a computer readable storage medium, such as the storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed onto the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the load balancing method described above can be performed. Alternatively, in other embodiments, the processor 11 can be configured to perform the load balancing method by any other appropriate means, such as by means of firmware.

[0116] ​The various embodiments of the systems and techniques described above can be implemented in digital electronic circuitry, integrated circuitry, a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on a chip (SOC), a complex programmable logic device (CPLD), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include implementation in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be special or general purpose, coupled to receive data and instructions from, and to transmit data and instructions to, a storage system, at least one input device, and at least one output device.

[0117] Computer programs used to implement the processes of the application can be written in any combination of one or more programming languages. These computer programs can be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the computer program

[0118] In the context of the present application, a computer-readable storage medium can be a tangible medium that can contain or store computer programs for use by or in connection with an instruction execution system, apparatus, or device. Computer-readable storage media can include, but are not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium can be a machine-readable signal medium. More specific examples of the machine-readable storage medium will include one or more lines of a program of instructions in a transitory signal, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0119] To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the electronic device. Other kinds of devices can be used to provide for interaction with a user as well; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form, including acoustic, speech, or tactile input.

[0120] The systems and techniques described here can be implemented in a computing system that includes a back end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front end component (e.g., a user computer having a graphical user interface or a Web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back end, middleware, or front end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0121] The computing system can include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. A server can be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system, to solve the defects of large management difficulty and weak business scalability in traditional physical host and VPS service.

[0122] It should be understood that the various forms of flow shown above can be re-ordered, added to, or deleted from without departing from the scope of the present disclosure. For example, the steps recited in the present disclosure can be executed in parallel, executed in sequence, or executed in a different order, as long as the desired results of the present disclosure are achieved, and the present disclosure is not limited herein.

[0123] The specific embodiments described above are not intended to be limiting, and persons skilled in the art will appreciate that various modifications, combinations, sub-combinations and alternatives can be made to the specific embodiments without departing from the spirit and principles of the disclosure. Accordingly, the disclosure is not limited to the specific embodiments described above, but only by the scope of the appended claims.

Claims

1. A load balancing method, characterized by, The method comprises: determining the load pressure of each server according to the CPU utilization, memory utilization and accessed number of each server, and calculating the load pressure difference between the servers; obtaining the data sending server and the data receiving server whose load pressure difference is greater than or equal to a set pressure difference threshold value, and determining the data flow resistance from the data sending server to the data receiving server according to the network bandwidth limit value and the data size limit value between the data sending server and the data receiving server; determining the data migration amount from the data sending server to the data receiving server according to the load pressure difference and the data flow resistance corresponding to the data sending server and the data receiving server; migrating the calculation data on the data sending server to the data receiving server for processing according to the data migration amount.

2. The method of claim 1, wherein, The method comprises: performing weighted summation on the CPU utilization, memory utilization and accessed number of each server respectively to obtain the load pressure of each server; determining the data flow resistance from the data sending server to the data receiving server according to the network bandwidth limit value and the data size limit value between the data sending server and the data receiving server, comprising: performing weighted summation on the network bandwidth limit value and the data size limit value to obtain the data flow resistance from the data sending server to the data receiving server.

3. The method of claim 1, wherein, determining the data migration amount from the data sending server to the data receiving server according to the load pressure difference and the data flow resistance corresponding to the data sending server and the data receiving server, comprising: determining the data migration amount from the data sending server to the data receiving server according to the division result of the load pressure difference and the data flow resistance.

4. The method of claim 1, wherein, migrating the calculation data on the data sending server to the data receiving server for processing according to the data migration amount, comprising: determining whether the data migration amount is greater than a set migration amount threshold value; if yes, obtaining the actual migration amount by subtracting the migration amount threshold value from the data migration amount, and migrating the calculation data on the data sending server to the data receiving server for processing according to the actual migration amount; obtaining candidate servers other than the data sending server and the data receiving server, and the server number of each candidate server; generating a random integer based on the server numbers using a random number generator, and taking the candidate server with the same server number as the random integer as the target server; after migrating the calculation data of the migration amount threshold value to the target server, returning to perform the operation of determining the load pressure of each server according to the CPU utilization, memory utilization and accessed number of each server until the load balancing condition is met; if no, obtaining the calculation data of the data migration amount on the data sending server, and migrating the calculation data of the data migration amount to the data receiving server for processing.

5. The method of claim 4, wherein, migrating the calculation data on the data sending server to the data receiving server for processing according to the actual migration amount, comprising: According to the data correlation, data access frequency and data update frequency of each calculation data on the data sending server, target calculation data of an actual migration amount is obtained on the data sending server; The target calculation data of the actual migration amount is migrated to the data receiving server for processing.

6. The method of claim 1, wherein, The method further comprises: According to the load pressure, load pressure difference and data flow resistance corresponding to each server respectively, a load pressure diagram corresponding to each server respectively is generated; The load pressure diagram corresponding to each server respectively is displayed, so that a user determines the data sending server, the data receiving server and the data migration amount from the data sending server to the data receiving server according to the load pressure, the load pressure difference and the data flow resistance on the load pressure diagram.

7. A load balancing apparatus, characterized by, The apparatus comprises: A load pressure difference determination module is configured to determine the load pressure of each server according to the CPU utilization, memory utilization and accessed number of each server, and calculate the load pressure difference between servers; A data flow resistance determination module is configured to obtain the data sending server and the data receiving server whose load pressure difference is greater than or equal to a set pressure difference threshold value, and determine the data flow resistance from the data sending server to the data receiving server according to the network bandwidth limit value and the data size limit value between the data sending server and the data receiving server; A data migration amount determination module is configured to determine the data migration amount from the data sending server to the data receiving server according to the load pressure difference and the data flow resistance corresponding to the data sending server and the data receiving server; A data migration module is configured to migrate the calculation data on the data sending server to the data receiving server for processing according to the data migration amount.

8. An electronic device, comprising: The electronic device comprises: at least one processor; and a memory connected to the at least one processor in communication; wherein The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to execute the load balancing method of any one of claims 1-6.

9. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer instructions for enabling the processor to execute the load balancing method of any one of claims 1-6 when executed.

10. A computer program product, characterised in that, The computer program product comprises a computer program which, when executed by the processor, implements the load balancing method according to any one of claims 1-6. The computer program product comprises a computer program which, when executed by the processor, implements the load balancing method according to any one of claims 1-6.

Citation Information

Patent Citations

  • Load balancing method and device of server, electronic equipment and storage medium

    CN115604269A

  • Migration of virtual machines

    US20170315838A1