Load balancing method, device, storage medium, and program product

By calculating the load and routing weight of the cloud server, and combining unsupervised sensors with UDP+TCP dual-protocol connections, the problem of load balancing algorithm jitter and resource waste in IoT scenarios is solved, thereby improving service performance and resource utilization efficiency.

CN118842800BActive Publication Date: 2025-12-09CHINA MOBILE M2M +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411032061.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-30
Publication Date
2025-12-09
Estimated Expiration
2044-07-30

AI Technical Summary

Technical Problem

Current load balancing algorithms cannot meet the demands of high concurrency and massive data transmission in IoT scenarios, resulting in excessive demand on cloud server resources. Furthermore, existing algorithms suffer from jitter issues when updating weights.

Method used

By acquiring performance metrics data from cloud servers, load weights and routing weights are calculated. Unsupervised sensors are used for adaptive optimization, and combined with UDP+TCP dual-protocol connections, the most suitable cloud server is selected to respond to requests from IoT devices.

Benefits of technology

It achieves smoothness of load balancing algorithm and improves overall service performance, saves server resources and improves the response efficiency of IoT devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118842800B_ABST
    Figure CN118842800B_ABST
Patent Text Reader

Abstract

The present disclosure relates to the technical field of Internet of Things, and in particular provides a load balancing method, device, storage medium and program product. The method comprises: acquiring performance index data of cloud servers in a cloud server cluster in a plurality of historical time ranges; calculating load weights of the cloud servers in each historical time range based on the performance index data; predicting routing weights of the cloud servers in a current time range based on the load weights in each historical time range; and determining a target cloud server from the cloud server cluster for responding to a current communication request of an Internet of Things device based on the routing weights, in a case where it is determined that the current communication request is detected. The introduction of the routing weights in the load balancing process can avoid the jitter problem existing when the existing load balancing algorithm updates the weights, ensure the smoothness of the algorithm, and improve the overall service performance.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present disclosure relates to the technical field of Internet of Things, and in particular to a load balancing method, device, storage medium and program product. BACKGROUND

[0002] In recent years, the Internet of Things (iot) technology has developed rapidly. Various iot devices deployed in hotels, hospitals, schools, shopping malls, roads and forests are connected to cloud servers through the Internet.

[0003] With the increasing number of deployed iot devices, the demand for cloud server resources is increasing. Due to the characteristics of high concurrency and large data volume transmission in the Internet of Things scenario, the current load balancing algorithm strategy cannot meet the iot device access scenario. SUMMARY

[0004] The present disclosure is proposed in view of the above problems. The present disclosure provides a load balancing method, device, storage medium and program product.

[0005] According to a first aspect of the present disclosure, a load balancing method is provided, comprising:

[0006] Obtaining performance index data of cloud servers in a cloud server cluster in a plurality of set historical time ranges;

[0007] Based on the performance index data, calculating the load weight of the cloud servers in each of the historical time ranges;

[0008] Based on the load weight in each of the historical time ranges, predicting the routing weight of the cloud servers in a current time range;

[0009] In a case where it is determined that a current communication request of an Internet of Things device to the cloud server cluster is detected, determining a target cloud server for responding to the current communication request from the cloud server cluster based on the routing weight.

[0010] In addition, according to the load balancing method of the first aspect of the present disclosure, based on the performance index data, the load weight of the cloud servers in each of the historical time ranges is calculated, comprising:

[0011] Obtaining the processor usage rate, memory usage rate, disk throughput rate, average response time and maximum response time from the performance index data;

[0012] calculating a processor idle rate based on the processor usage rate; calculating a memory idle rate based on the memory usage rate; calculating a disk idle rate based on the disk throughput rate; and calculating a response rate percentage based on the average response time and the maximum response time;

[0013] performing a weighted summation on the processor idle rate, the memory idle rate, the disk idle rate and the response rate percentage to obtain the load weight.

[0014] Further, according to the load balancing method of the first aspect of the present disclosure, calculating a routing weight of the cloud server based on the load weights in each of the historical time ranges comprises:

[0015] calculating a product of the load weight in each of the historical time ranges and a decay coefficient corresponding to each of the historical time ranges to obtain a product operation result;

[0016] summing up each of the product operation results;

[0017] summing up the summation result and a correction factor to obtain a single routing weight of the cloud server under the gateway;

[0018] normalizing the single routing weight to obtain the routing weight.

[0019] Further, according to the load balancing method of the first aspect of the present disclosure, determining a target cloud server for responding to the current communication request from the cloud server cluster based on the routing weight comprises:

[0020] in a case where the current communication request is a first communication request after the routing weight is determined, taking the cloud server with the largest routing weight as the target cloud server; in a case where the current communication request is not the first communication request, searching for a cloud server with the largest effective weight from the cloud server cluster as the target cloud server;

[0021] updating the effective weight of the target cloud server according to a first strategy and updating the effective weight of the remaining cloud servers according to a second strategy;

[0022] wherein the first strategy is used to represent that the effective weight of the updated target cloud server is a sum of a weight difference value and the routing weight of the target cloud server, and the weight difference value is a difference between the effective weight of the target cloud server after the last communication request and a total load weight of the cloud server cluster;

[0023] The second strategy is used to represent the effective weight of the updated remaining cloud server as the sum of the effective weight of the remaining cloud server after the last communication request and the routing weight of the remaining cloud server.

[0024] In addition, according to the load balancing method of the first aspect of the present disclosure, determining that a current communication request of the Internet of Things device to the cloud server cluster is detected, comprises:

[0025] In the case of detecting a startup networking request of the Internet of Things device, or detecting a control instruction of the user to the Internet of Things device, determining that a current communication request of the Internet of Things device to the cloud server cluster is detected;

[0026] The startup networking request is used to request to connect a cloud server in a user datagram protocol server cluster included in the cloud server cluster, and the control instruction is used to trigger to connect a cloud server in a transmission control protocol server cluster included in the cloud server cluster.

[0027] In addition, according to the load balancing method of the first aspect of the present disclosure, the product of the load weight in each of the historical time ranges and the decay coefficient corresponding to each of the historical time ranges is calculated, and before the product operation result is obtained, further comprising:

[0028] Based on the load weight of the cloud server in the current time range and the total load weight of the cloud server cluster in the current time range, the load weight proportion of the cloud server in the current time range is calculated;

[0029] Based on the pre-trained unsupervised sensor, the load weight proportion and the load weight of the cloud server in the current time range, the decay coefficient and the correction factor are calculated.

[0030] In addition, according to the load balancing method of the first aspect of the present disclosure, the training process of the unsupervised sensor comprises:

[0031] Based on the training load weight of the cloud server in each of the historical time ranges and the sum of the load weights of the cloud server cluster in each of the historical time ranges, the training load weight proportion of the cloud server in each of the historical time ranges is calculated;

[0032] Based on the training load weight proportion of the cloud server in each of the historical time ranges, the training load weight, and the decay coefficient and the correction factor corresponding to the training load weight proportion and the load weight in each of the historical time ranges, the unsupervised sensor to be trained is trained to obtain the unsupervised sensor.

[0033] According to a second aspect of the present disclosure, there is provided an electronic device comprising a memory, a processor and a computer program stored on the memory, the processor executing the computer program to implement the steps of the method of the first aspect.

[0034] According to a third aspect of the present disclosure, there is provided a computer readable storage medium having stored thereon a computer program / instructions which, when executed by a processor, implement the steps of the method of the first aspect.

[0035] According to a fourth aspect of the present disclosure, there is provided a computer program product comprising a computer program / instructions which, when executed by a processor, implement the steps of the method of the first aspect.

[0036] As will be described in detail below, the routing weight of the cloud server is calculated by the performance index data of the cloud server, and the target cloud server capable of responding to the current communication request of the Internet of Things device is determined from the cloud server cluster based on the routing weight. In the load balancing process, the routing weight is introduced to avoid the jitter problem existing when the existing load balancing algorithm updates the weight, ensure the smoothness of the algorithm, and improve the overall service performance.

[0037] It is to be understood that both the foregoing general description and the following detailed description are exemplary and intended to provide further explanation of the subject technology. BRIEF DESCRIPTION OF DRAWINGS

[0038] The foregoing and other objects, features and advantages of the present disclosure will become more apparent from the following detailed description, which proceeds with reference to the accompanying drawings. The drawings are provided to illustrate embodiments of the present disclosure and, together with the detailed description, serve to explain the present disclosure and do not constitute a limitation thereof. In the drawings, like reference numerals refer to like elements or steps throughout.

[0039] Figure 1 is a flow chart illustrating application of a load balancing method according to an embodiment of the present disclosure.

[0040] Figure 2 is a structural schematic diagram illustrating application of an unsupervised sensor according to an embodiment of the present disclosure.

[0041] Figure 3 is a system module diagram illustrating application of TCP / UDP dual protocol communication according to an embodiment of the present disclosure.

[0042] Figure 4 is a signaling diagram illustrating application of TCP / UDP dual protocol communication according to an embodiment of the present disclosure.

[0043] Figure 5is a structural schematic diagram illustrating a load balancing device according to an embodiment of the present disclosure.

[0044] Figure 6 is a hardware block diagram of an electronic device according to an embodiment of the present disclosure.

[0045] Figure 7 is a schematic diagram of a computer readable storage medium according to an embodiment of the present disclosure. DETAILED DESCRIPTION

[0046] For the purpose of making the objects, technical solutions and advantages of the embodiments of the present disclosure clearer, the technical solutions in the embodiments of the present disclosure will be described clearly and completely below with reference to the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only a part of the embodiments of the present disclosure, rather than all the embodiments. The components of the embodiments of the present disclosure generally described and shown in the drawings herein can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present disclosure provided in the drawings is not intended to limit the scope of the claimed present disclosure, but only represents selected embodiments of the present disclosure. Based on the embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without creative work fall within the scope of protection of the present disclosure.

[0047] It should be noted that: similar reference numerals and letters represent similar items in the following drawings, therefore, once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings.

[0048] The term "and / or" herein only describes an association relationship, which means that there can be three relationships, for example, A and / or B can mean that A exists alone, A and B exist together, and B exists alone. In addition, the term "at least one" herein means any one of multiple or any combination of at least two of multiple, for example, including at least one of A, B and C can mean including any one or more elements selected from the set consisting of A, B and C.

[0049] In recent years, the Internet of Things (iot) technology has developed rapidly, and various iot devices deployed in hotels / hospitals / schools / malls / streets / forests access cloud servers through the Internet.

[0050] With more and more iot devices deployed, the resource demand of cloud servers is getting larger and larger. Due to the characteristics of high concurrency and super large data transmission in the Internet of Things scene, the current load balancing algorithm strategy cannot meet the iot device access scene.

[0051] To alleviate the technical problems existing in the related art, the embodiments of the present disclosure provide a load balancing method, device, storage medium and program product. The performance index data of the cloud server is used to calculate the routing weight of the cloud server, and the target cloud server capable of responding to the current communication request of the Internet of Things device is determined from the cloud server cluster based on the routing weight. The introduction of the routing weight in the load balancing process can avoid the jitter problem existing when the existing load balancing algorithm updates the weight, ensure the smoothness of the algorithm, and improve the overall service performance.

[0052] To facilitate the understanding of the present embodiment, first, a load balancing method disclosed by the present disclosure is described in detail. The execution subject of the load balancing method provided by the present disclosure is generally an electronic device with certain computing power, which includes, for example, a terminal device, a server or other processing devices. In some possible implementation manners, the load balancing method can be realized by calling the computer readable instructions stored in the memory by the processor.

[0053] Referring to Figure 1 The flowchart of the load balancing method provided by the present disclosure is shown. The method includes the following steps:

[0054] In step 101, the performance index data of the cloud server in the cloud server cluster in a set of multiple historical time ranges is obtained.

[0055] In the present embodiment, the performance index data is used to represent the server performance of the cloud server. In applications, the performance index data includes, but is not limited to, CPU usage (cpu_ratio), memory usage (memory_ratio), disk I / O (input / output) throughput (disk_ratio) and / or response time, etc.

[0056] In applications, a performance monitoring tool (including but not limited to Zabbix) can be installed and configured in each cloud server to collect the performance index data of the cloud server through the performance monitoring tool.

[0057] In the present embodiment, after the performance monitoring tool collects the performance index data, the performance monitoring tool can also upload the performance index data to the electronic device based on the FTP protocol.

[0058] In the present embodiment, to facilitate subsequent data synchronization and analysis, after the performance index data is obtained, the performance index data can also be processed and formatted through a python script.

[0059] In the present embodiment, the multiple historical time ranges can be pre-configured by humans, and the present embodiment does not make specific limitations on this. For example, the multiple historical time ranges can be set to the past n days.

[0060] Step 102, based on the performance indicator data, calculate the load weight of the cloud server in each historical time range.

[0061] Wherein, the load weight is negatively correlated with the performance indicator data, the lower the performance indicator data, the higher the degree of resource idle of the cloud server, and the higher load weight should be given to the cloud server.

[0062] In one or more optional embodiments, step 102 can include the following steps:

[0063] From the performance indicator data, obtain the processor usage rate, memory usage rate, disk throughput rate, average response time and maximum response time;

[0064] Based on the processor usage rate, calculate the processor idle rate; based on the memory usage rate, calculate the memory idle rate; based on the disk throughput rate, calculate the disk idle rate; and based on the average response time and maximum response time, calculate the response rate percentage;

[0065] Weighted sum of the processor idle rate, memory idle rate, disk idle rate and response rate percentage to obtain the load weight.

[0066] Wherein, the average response time is the average of all response times of the cloud server in a certain historical time range, and the maximum response time is the maximum value of the response time of the cloud server in the historical time range.

[0067] In this embodiment, the calculation formula of the load weight can be:

[0068]

[0069] Wherein, W score is the load weight, avg_rtt is the average response time, max{rtt} is the maximum response time, w1, w2, w3, w4 are the influence factors of each parameter. In application, w1, w2, w3, w4 can be set artificially in advance, such as w1, w2, w3, w4 can be set to 1.

[0070] Step 103, based on the load weight in each historical time range, predict the routing weight of the cloud server in the current time range.

[0071] In this embodiment, the routing weight is used to indicate the load weight of the cloud server in the current historical time range, that is, the load weight in the current historical time range predicted by the load weight in each historical time range. For example, taking today as the current historical time range and the past n days as each historical time range, it is equivalent to using the load weight of the past n days to predict the load weight of the cloud server today.

[0072] In an optional embodiment, step 103 can include the following steps:

[0073] The product of the load weight in each historical time range and the decay coefficient corresponding to each historical time range is calculated to obtain a product operation result;

[0074] The sum of each product operation result is calculated;

[0075] The sum of the result of the sum and the correction factor is calculated to obtain a single route weight of the cloud server under the gateway;

[0076] The single route weight is normalized to obtain a route weight.

[0077] Step 103 can be represented by the following formula:

[0078]

[0079] where w represents the route weight of the cloud server, n represents the past n days, w score_i represents the load weight score in the i-th time range, a i represents the decay coefficient of the i-th day, i=0 represents the current day, and b is the correction factor.

[0080] In some embodiments, the decay coefficient corresponding to each historical time range can be a fixed value determined by a person based on experience.

[0081] In some embodiments, an unsupervised machine learning algorithm can also be used to adaptively calculate the decay coefficient and the correction factor to enable efficient and stable scheduling of the cloud server cluster. In an optional embodiment, before calculating the product of the load weight in each historical time range and the decay coefficient corresponding to each historical time range to obtain a product operation result, the following steps can also be included:

[0082] Based on the load weight of the cloud server in the current time range and the total load weight of the cloud server cluster in the current time range, the load weight proportion of the cloud server in the current time range is calculated;

[0083] Based on the pre-trained unsupervised perceptron, the load weight proportion, and the load weight of the cloud server in the current time range, the decay coefficient and the correction factor are calculated.

[0084] It should be understood that the load weight of the cloud server in the current time range is calculated based on the performance indicator data in the current time range, and the specific calculation process can be referred to the calculation of the load weight in the historical time range in the foregoing embodiments to avoid redundancy, which will not be described here.

[0085] It should be understood that the proportion of the load weight of the cloud server in the current time range is the ratio of the load weight of the cloud server in the current time range to the total load weight of the cloud server cluster in the current time range.

[0086] The decay coefficient and the correction factor calculated based on the unsupervised perceptron are used to represent the value of the other part of the input, i.e., the value of the decay coefficient and the correction factor, when a part of the input of the unsupervised perceptron is the load weight of the cloud server in the current time range and the output is the proportion of the load weight.

[0087] In this embodiment, the activation function of the unsupervised perceptron includes but is not limited to the Tanh function (hyperbolic tangent function).

[0088] In one or more embodiments, the training process of the unsupervised perceptron can include the following steps:

[0089] Based on the training load weight of the cloud server in each historical time range and the total load weight of the cloud server cluster in each historical time range, the proportion of the training load weight of the cloud server in each historical time range is calculated.

[0090] Based on the proportion of the training load weight of the cloud server in each historical time range, the training load weight, and the decay coefficient and the correction factor corresponding to the proportion of the training load weight and the load weight in each historical time range, the unsupervised perceptron to be trained is trained to obtain the unsupervised perceptron.

[0091] Taking each historical time range as one day as an example, the calculation process of the correction factor and the decay coefficient is as follows:

[0092] The load weight w score_i of the cloud server in each of the previous n days is obtained. score_i According to the proportion of w total to the total weight w i of the cloud server cluster on the day, the weight w i of the cloud server on the i-th day is calculated. score_i (i∈[1,n]) as the training set.

[0093] The input of the unsupervised perceptron includes n input items w score_i (i∈[1,n]) (representing the load weight of the previous n days), and the corresponding decay coefficient a i (i∈[1,n]) (representing the decay factor of the previous n days) and the correction factor b.

[0094] The unsupervised perceptron can flexibly select an activation function. The activation function introduces a non-linear factor to the neuron, enabling the neural network to arbitrarily approximate any non-linear function. In this embodiment, a Tanh function (hyperbolic tangent function) is used.

[0095] As an example, a structural diagram of an unsupervised perceptron is shown in FIG. 1. Figure 2 On this basis, the unsupervised perceptron is expressed by a formula as follows:

[0096]

[0097] Step 104, in a case where it is determined that the current communication request of the Internet of Things device to the cloud server cluster is detected, determining a target cloud server for responding to the current communication request from the cloud server cluster based on a routing weight.

[0098] In the related art, the IoT device needs to maintain a TCP (Transmission Control Protocol) long connection with the cloud server. This long connection will occupy the CPU and memory resources of the server. For a large-scale Internet of Things device, this will bring high cost overhead to the server resources. In order to alleviate the problems in the related art, in this embodiment, the Internet of Things device and the cloud server use UDP (User Datagram Protocol) + TCP dual protocol connection. Please refer to Figure 3 , Figure 3 The system module diagram based on TCP / UDP dual protocol communication shown in this embodiment.

[0099] The UDP protocol is unreliable but lightweight, and the server resource occupation is less; the TCP protocol is reliable but heavy, and the TCP channel needs to occupy server resources (CPU & memory) during the existence period. Based on the characteristics of the above connection protocols, this embodiment combines the advantages of both to realize the dual protocol connection of the device and the platform TCP+UDP, and to achieve the reliable transmission of business data and the saving of server resources through the optimization of the connection process.

[0100] When the IoT device and the platform server have no business data interaction, only the UDP is used to maintain the heartbeat, saving the server resources. When there is a need for business data interaction, the TCP business server initiates an RPC request to the UDP heartbeat server, and the UDP heartbeat server notifies the IOT device to actively establish a TCP long connection with the TCP business server, ensuring reliable transmission of business data. For specific connection process, please refer to Figure 4 :

[0101] 1. After the IOT device is powered on, it is connected to the Internet and sends a boot instruction (UDP package) to the UDP heartbeat server (the server IP port is preset when the IOT device is manufactured). The first step in the timing diagram carries the MAC address and SN information of the IOT device.

[0102] 2. After the UDP heartbeat server receives the boot instruction of the IOT device, the MAC and SN carried in the UDP data package are checked. The MAC and SN of the IOT device are determined when the device is manufactured, and the corresponding relationship is imported into the UDP heartbeat server in advance by the manufacturer. If the MAC and SN reported by the IOT device match the data cached by the server, the UDP heartbeat server determines that the IOT device is legal and replies with a bootResp instruction (UDP package). The bootResp instruction contains a heart Interval parameter, which indicates the time interval for the IOT device to initiate a heartbeat.

[0103] 3. After the IOT device receives the bootResp instruction returned by the UDP heartbeat server, it starts to periodically send a ping heartbeat (UDP package) to the UDP heartbeat server.

[0104] 4. After the UDP heartbeat server receives the ping package of the IOT device, it records the corresponding relationship between the MAC and IP address of the IOT device in the form of K-V in the memory through the UDP protocol stack.

[0105] 5. After the UDP heartbeat server receives the ping heartbeat instruction of the IOT device, it replies with a pong heartbeat confirmation instruction (UDP package).

[0106] 6. The user issues a control instruction to the IOT device, such as controlling the IOT device to restart.

[0107] 7. The TCP service server sends an RPC (Remote Procedure Call) request to the UDP heartbeat server, notifying the UDP heartbeat server to perform reverse connection on the IOT device with a certain MAC address.

[0108] 8. The UDP heartbeat server finds the Internet UDP address corresponding to the MAC of the IOT device in the memory according to the cached information, and sends a revConnect reverse connection instruction (UDP package) to the IOT device. The reverse connection package contains the IP address and service listening port of the TCP service server, which is used for the IOT device to initiate a connection establishment to the TCP service server.

[0109] 9. After the IOT device receives the revConnect reverse connection instruction of the UDP heartbeat server, it initiates a TCP connection establishment request to the TCP service server according to the IP address and port in the package.

[0110] 10. After the TCP service server receives the TCP connection request initiated by the IoT device, a TCP channel is established. Through the channel, the service instruction in step 6 is issued (such as IoT device restart), and subsequent reliable interaction of each instruction is performed.

[0111] 11. When the instructions of the TCP service server are all issued, and there is no data flow in the channel within 10s, the TCP service server closes the TCP channel, and releases the CPU and memory resources of the server.

[0112] If the IoT device fails to establish a TCP connection with the TCP server within 10 seconds after the UDP server sends the reverse link revConnect instruction to the IoT device in step 8, the UDP server considers that the network is unstable, the reverse link revConnect instruction UDP packet is lost, and needs to resend the reverse link revConnect instruction to the IoT device. If the TCP connection cannot be established for 3 times, it is determined that the IoT device has been offline, and the process is ended.

[0113] On this basis, the embodiment gives the following two implementation manners of determining whether the current communication request of the IoT device to the cloud server cluster is detected:

[0114] In the case of detecting the power-on networking request of the IoT device, or detecting the control instruction of the user to the IoT device, it is determined that the current communication request of the IoT device to the cloud server cluster is detected;

[0115] The power-on networking request is used to request to connect to the cloud server in the user datagram protocol server cluster included in the cloud server cluster, and the control instruction is used to trigger to connect to the cloud server in the transmission control protocol server cluster included in the cloud server cluster.

[0116] In the embodiment, the target cloud server can be determined from the cloud server cluster based on the traditional weighted round robin algorithm. In order to improve the overall smoothness of the algorithm, the following algorithm for determining the target cloud server is also given in the embodiment:

[0117] In the case that the current communication request is the first communication request after determining the routing weight, the cloud server with the maximum routing weight is taken as the target cloud server; in the case that the current communication request is not the first communication request, the cloud server with the maximum effective weight is searched from the cloud server cluster as the target cloud server;

[0118] The effective weight of the target cloud server is updated according to the first strategy, and the effective weight of the remaining cloud servers is updated according to the second strategy;

[0119] The first strategy is used to characterize the effective weight of the updated target cloud server as the sum of the weight difference and the routing weight of the target cloud server. The weight difference is the difference between the effective weight of the target cloud server after the last communication request and the sum of the load weights of the cloud server cluster.

[0120] The second strategy is used to characterize the effective weight of the remaining cloud servers after the updated process as the sum of the effective weight of the remaining cloud servers after the last communication request and the routing weight of the remaining cloud servers.

[0121] The following explanation uses a cloud server cluster as an example to illustrate the concept of a Transmission Control Protocol (TCP) server cluster:

[0122] Suppose there are N TCP servers H = {H1, H2...H...} n The routing weights are set to the configured weights W = {W1, W2, ..., W}. n} and effective weights VW = {VW1, VW2, ..., VW} n Effective weights VW i Initialize to W i VW i =W i Let the indicator variable indexPos = -1, indicating that the server number of the current route is -1; let the sum of the server configuration weights be...

[0123] The routing policy scheduling is as follows:

[0124] 1. Select the instance VW with the largest current effective weight. x VW x =MAX{VW}, where x represents the server number, and the maximum weight instance VW is... x Subtract the sum of server configuration weights (sumWight) to get VW x =VW x -sumWight sets indexPos to the server number indexPos=x.

[0125] 2. Set the current effective weight VW of each server. i Add configuration weight W i VW i =VW i +W i .

[0126] 3. The request is routed to the server with server number indexPos.

[0127] 4. Determine whether the effective weight VW is {0,0,…,0} and whether it has been forwarded (2N-1) times (N is the number of connected servers).

[0128] 5. If the condition (4) is met and the dynamic load balancing prediction module has the weight update (effective weight is updated every morning, according to the formula in (three)), then update the weight and the effective weight configuration.

[0129] 6. Repeat (1) to (5) every time the routing schedule is repeated.

[0130] It should be understood that each server in step 2 includes the VW x .

[0131] The following illustrates the above routing strategy scheduling with specific examples:

[0132] Assume that the cloud server cluster includes cloud server a and cloud server b, the routing weight of cloud server a is 8, and the routing weight of cloud server b is 2, therefore, sumWeight = 2 + 8 = 10.

[0133] When detecting the first routing request of the Internet of Things device, since the routing weight of cloud server a is the largest, the first routing request is routed to cloud server a, at the same time, the effective weight of cloud server a is updated to 8 - 10 + 8 = 6, and the effective weight of cloud server b is updated to 2 + 2 = 4.

[0134] When detecting the second routing request of the Internet of Things device, since the routing weight of cloud server a is still the largest, the second routing request is routed to cloud server a, at the same time, the effective weight of cloud server a is updated to 6 - 10 + 8 = 4, and the effective weight of cloud server b is updated to 4 + 2 = 6.

[0135] When detecting the third routing request of the Internet of Things device, since the routing weight of cloud server b is the largest, the third routing request is routed to cloud server b, at the same time, the effective weight of cloud server b is updated to 6 - 10 + 2 = -2, and the effective weight of cloud server a is updated to 4 + 8 = 12.

[0136] When detecting the fourth routing request of the Internet of Things device, since the routing weight of cloud server a is the largest, the fourth routing request is routed to cloud server a, at the same time, the effective weight of cloud server a is updated to 12 - 10 + 8 = 10, and the effective weight of cloud server b is updated to -2 + 2 = 0.

[0137] When detecting the fifth routing request of the Internet of Things device, since the routing weight of cloud server a is still the largest, the fifth routing request is routed to cloud server a, at the same time, the effective weight of cloud server a is updated to 10 - 10 + 8 = 8, and the effective weight of cloud server b is updated to 0 + 2 = 2.

[0138] By analogy, until the valid weight VW is {0, 0, …, 0} and (2N-1) times of valid forwarding have been performed.

[0139] In the scheme provided by the embodiment, the routing weight of the cloud server is calculated through the performance index data of the cloud server, and a target cloud server capable of responding to a current communication request of an Internet of Things device is determined from the cloud server cluster based on the routing weight. In the load balancing process, the routing weight is introduced, which can avoid the jitter problem existing when the existing load balancing algorithm updates the weight, ensure the smoothness of the algorithm, and improve the overall service performance.

[0140] In addition, the scheme saves server resources and optimizes the use of resources through the mode of udp+tcp dual protocol channels, and is more suitable for the Internet of Things with massive device access.

[0141] Finally, the scheme introduces an unsupervised machine learning algorithm to adaptively optimize the gateway routing weight, realize efficient and stable scheduling, and maximize the performance of the cluster.

[0142] The embodiment of the disclosure also provides a load balancing device for executing the load balancing method provided by any of the above embodiments. As shown in the figure, the device comprises: Figure 5

[0143] The acquisition module 51 is configured to acquire performance index data of cloud servers in a cloud server cluster within a plurality of historical time ranges;

[0144] The calculation module 52 is configured to calculate load weights of the cloud servers in each of the historical time ranges based on the performance index data;

[0145] The prediction module 53 is configured to predict routing weights of the cloud servers in a current time range based on the load weights in each of the historical time ranges;

[0146] The determination module 54 is configured to determine a target cloud server for responding to a current communication request of an Internet of Things device from the cloud server cluster based on the routing weights in a case where it is determined that the current communication request is detected.

[0147] In one or more embodiments, the calculation module 52 is configured to:

[0148] acquire processor usage, memory usage, disk throughput, average response time, and maximum response time from the performance index data;

[0149] ​calculating a processor idle rate based on the processor usage rate; calculating a memory idle rate based on the memory usage rate; calculating a disk idle rate based on the disk throughput rate; and calculating a response rate percentage based on the average response time and the maximum response time;

[0150] performing a weighted summation on the processor idle rate, the memory idle rate, the disk idle rate and the response rate percentage to obtain the load weight.

[0151] In one or more embodiments, the prediction module 53 is configured to:

[0152] calculating a product of the load weight and a decay coefficient corresponding to each of the historical time ranges to obtain a product operation result;

[0153] summing up each of the product operation results;

[0154] summing up the summation result and a correction factor to obtain a single-path weight of the cloud server under the gateway;

[0155] normalizing the single-path weight to obtain the routing weight.

[0156] In one or more embodiments, the determination module 54 is configured to:

[0157] in a case where the current communication request is a first communication request after the routing weight is determined, taking the cloud server with the largest routing weight as the target cloud server; in a case where the current communication request is not the first communication request, finding a cloud server with the largest effective weight from the cloud server cluster as the target cloud server;

[0158] updating the effective weight of the target cloud server according to a first strategy and updating the effective weight of the remaining cloud servers according to a second strategy;

[0159] wherein the first strategy is configured to represent that the effective weight of the updated target cloud server is a sum of a weight difference value and the routing weight of the target cloud server, and the weight difference value is a difference between the effective weight of the target cloud server after a last communication request and a total load weight of the cloud server cluster;

[0160] the second strategy is configured to represent that the effective weight of the updated remaining cloud server is a sum of the effective weight of the remaining cloud server after a last communication request and the routing weight of the remaining cloud server.

[0161] In one or more embodiments, the determination module 54 is configured to:

[0162] In a case where a power-on networking request of the IoT device is detected, or a control instruction of the IoT device is detected, it is determined that a current communication request of the IoT device for the cloud server cluster is detected.

[0163] The power-on networking request is used to request to connect a cloud server in a user datagram protocol server cluster included in the cloud server cluster, and the control instruction is used to trigger to connect a cloud server in a transmission control protocol server cluster included in the cloud server cluster.

[0164] In one or more embodiments, the apparatus can also be configured to:

[0165] The product of the load weight in each of the historical time ranges and the decay coefficient corresponding to each of the historical time ranges is calculated, and before the product operation result is obtained, the proportion of the load weight of the cloud server in the current time range based on the load weight of the cloud server in the current time range and the total load weight of the cloud server cluster in the current time range is calculated.

[0166] The decay coefficient and the correction factor are calculated based on the pre-trained unsupervised perceiver, the proportion of the load weight, and the load weight of the cloud server in the current time range.

[0167] In one or more embodiments, the apparatus is configured to:

[0168] The proportion of the training load weight of the cloud server in each of the historical time ranges based on the training load weight of the cloud server in each of the historical time ranges and the sum of the load weights of the cloud server cluster in each of the historical time ranges is calculated.

[0169] The training of the unsupervised perceiver is performed based on the proportion of the training load weight of the cloud server in each of the historical time ranges, the training load weight, and the decay coefficient and the correction factor corresponding to the proportion of the training load weight and the load weight in each of the historical time ranges, to obtain the unsupervised perceiver.

[0170] The load balancing apparatus provided by the embodiments of the present disclosure and the load balancing method provided by the embodiments of the present disclosure have the same beneficial effects as the method they adopt, run or implement.

[0171] The embodiments of the present disclosure also provide an electronic device to perform the above load balancing method. Please refer to Figure 6 which shows a schematic diagram of an electronic device provided by some embodiments of the present disclosure. As shown in the figure, Figure 6As shown, the electronic device 8 comprises a processor 800, a memory 801, a bus 802 and a communication interface 803, the processor 800, the communication interface 803 and the memory 801 are connected through the bus 802; the memory 801 stores a computer program capable of running on the processor 800, and the processor 800 executes the computer program to perform the load balancing method provided by any one of the foregoing embodiments of the present disclosure.

[0172] The memory 801 can include a high-speed random access memory (RAM) and can also include a non-volatile memory such as at least one disk memory. The communication connection between the device network element and at least one other network element is realized through at least one communication interface 803 (which can be wired or wireless), and the Internet, a wide area network, a local area network, a metropolitan area network, etc. can be used.

[0173] The bus 802 can be an ISA bus, a PCI bus, an EISA bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. The memory 801 is used to store programs, and the processor 800 executes the programs after receiving execution instructions. The load balancing method disclosed in any one of the foregoing embodiments of the present disclosure can be applied to the processor 800 or implemented by the processor 800.

[0174] The processor 800 can be an integrated circuit chip with a processing capability of signals. In the implementation process, each step of the above method can be completed by the integrated logic circuit of hardware in the processor 800 or the instruction in the form of software. The processor 800 described above can be a general processor, including a central processing unit (CPU), a network processor (NP), etc.; can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a ready programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. Each method, step and logic block diagram disclosed in the embodiments of the present disclosure can be implemented or executed. The general processor can be a microprocessor or the processor can also be any conventional processor. The steps of the method disclosed in combination with the embodiments of the present disclosure can be directly embodied as a hardware code processor for execution, or a combination of hardware and software modules in the code processor for execution. The software module can be located in a random access memory, a flash memory, a read only memory, a programmable read only memory or an electrically erasable programmable memory, a register or other mature storage medium in the art. The storage medium is located in the memory 801, and the processor 800 reads the information in the memory 801, and combines the hardware to complete the steps of the above method.

[0175] The electronic device provided by the embodiments of the present disclosure and the load balancing method provided by the embodiments of the present disclosure have the same beneficial effects as the method they adopt, run or implement.

[0176] The present disclosure also provides a computer readable storage medium corresponding to the load balancing method provided by the preceding embodiments. Please refer to Figure 7 The computer readable storage medium shown is an optical disc 30, and a computer program (i.e. program product) is stored on the optical disc 30. When the computer program is run by a processor, the load balancing method provided by any of the preceding embodiments is executed.

[0177] It should be noted that examples of the computer readable storage medium can also include, but are not limited to, a phase change memory (PRAM), a static random access memory (SRAM), a dynamic random access memory (DRAM), other types of random access memory (RAM), a read only memory (ROM), an electrically erasable programmable read only memory (EEPROM), a flash memory or other optical, magnetic storage medium, which will not be described one by one here.

[0178] The computer readable storage medium provided by the above embodiments of the present disclosure and the load balancing method provided by the embodiments of the present disclosure have the same beneficial effects as the method adopted, run or implemented by the application program stored therein.

[0179] It is noted that:

[0180] In the description provided herein, numerous specific details are set forth. However, it is understood that embodiments of the disclosure can be practiced without these specific details. In some instances, well-known structures and techniques have not been shown in detail in order not to obscure the understanding of this description.

[0181] Similarly, it is to be understood that the mechanical features of the disclosure are sometimes illustrated in description of the exemplary embodiments of the disclosure along with the accompanying figures in order to facilitate the understanding of one or more of the individual aspects of the disclosure. It is not intended that the disclosure be limited in scope to the specific em bodiments described in the description unless the disclosure specifically recites otherwise. Indeed, a wide variety of embodiments have been built using the principles described in the present disclosure and the scope of the disclosure is not limited to the embodiments described in the description unless the disclosure specifically recites otherwise. Moreover, it is to be understood that the features of the disclosure are sometimes grouped together in the description and the figures for the purpose of clarity and brevity, and it is not intended that the disclosure require more features than are explicitly recited in each claim. Rather, it will be apparent that, in general, impliedly disclosed are alternative claim scopes to those features recited in the claims.

[0182] Furthermore, those of ordinary skill in the art will recognize that, although some embodiments described herein include certain features that are not included in other embodiments, combinations of the features of the different embodiments are not only possible, but are also within the scope of this disclosure, and form different embodiments, e.g., within the scope of various claims. For example, in the claims, any of the claimed embodiments can be used in any combination.

[0183] The above descriptions are only preferred specific embodiments of the present disclosure, but the protection scope of the present disclosure is not limited thereto, and any changes or substitutions easily conceived by those skilled in the art within the technical scope of the present disclosure should be covered within the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be subject to the protection scope of the claims.

Claims

1. A load balancing method, characterized in that, include: Obtain performance metrics data of cloud servers in a cloud server cluster over multiple defined historical time ranges; Based on the performance metric data, calculate the load weight of the cloud server within each of the historical time ranges; Based on the load weights within each of the historical time ranges, predict the routing weights of the cloud servers within the current time range; If it is determined that a current communication request from an IoT device is detected for the cloud server cluster, a target cloud server for responding to the current communication request is determined from the cloud server cluster based on the routing weight. Based on the load weights within each of the aforementioned historical time ranges, the routing weights of the cloud servers are calculated, including: Calculate the product of the load weight in each of the historical time ranges and the attenuation coefficient corresponding to each of the historical time ranges to obtain the product operation result; Sum the results of each of the product operations; Summing the summation result and the correction factor, the single-route weight of the cloud server under the gateway is obtained; The single route weight is normalized to obtain the route weight; Before calculating the product of the load weight for each of the historical time ranges and the attenuation coefficient corresponding to each of the historical time ranges, and obtaining the product result, the method further includes: Based on the load weight of the cloud server in the current time range and the total load weight of the cloud server cluster in the current time range, calculate the load weight ratio of the cloud server in the current time range; The attenuation coefficient and the correction factor are calculated based on the pre-trained unsupervised perceptron, the load weight ratio, and the load weight of the cloud server within the current time range.

2. The method according to claim 1, characterized in that, Based on the performance metric data, the load weight of the cloud server within each of the historical time ranges is calculated, including: The processor utilization, memory utilization, disk throughput, average response time, and maximum response time are obtained from the performance metrics data. Based on the processor utilization, calculate the processor idle rate; based on the memory utilization, calculate the memory idle rate; based on the disk throughput, calculate the disk idle rate; and based on the average response time and the maximum response time, calculate the response rate percentage. The load weight is obtained by weighting and summing the processor idle rate, the memory idle rate, the disk idle rate, and the response rate percentage.

3. The method according to claim 1, characterized in that, Based on the routing weights, the target cloud server for responding to the current communication request is determined from the cloud server cluster, including: If the current communication request is the first communication request after the routing weight is determined, the cloud server with the largest routing weight is selected as the target cloud server; if the current communication request is not the first communication request, the cloud server with the largest effective weight is selected from the cloud server cluster as the target cloud server. Update the effective weight of the target cloud server according to the first strategy, and update the effective weight of the remaining cloud servers according to the second strategy. The first strategy is used to characterize the effective weight of the updated target cloud server as the sum of the weight difference and the routing weight of the target cloud server. The weight difference is the difference between the effective weight of the target cloud server after the last communication request and the sum of the load weights of the cloud server cluster. The second strategy is used to characterize the updated effective weight of the remaining cloud server as the sum of the effective weight of the remaining cloud server after the last communication request and the routing weight of the remaining cloud server.

4. The method according to claim 1, characterized in that, Determining that a current communication request from an IoT device to the cloud server cluster has been detected includes: If a power-on network request from the IoT device is detected, or if a user's control command to the IoT device is detected, it is determined that a current communication request from the IoT device to the cloud server cluster has been detected. The power-on network request is used to request a connection to a cloud server in the User Datagram Protocol (UDP) server cluster included in the cloud server cluster, and the control command is used to trigger a connection to a cloud server in the Transmission Control Protocol (TCP) server cluster included in the cloud server cluster.

5. The method according to claim 1, characterized in that, The training process of the unsupervised perceptron includes: Based on the training load weight of the cloud server in each of the historical time ranges and the sum of the load weights of the cloud server cluster in each of the historical time ranges, the proportion of the training load weight of the cloud server in each of the historical time ranges is calculated. Based on the training load weight ratio and training load weight of the cloud server in each of the historical time ranges, as well as the decay coefficient and correction factor corresponding to the training load weight ratio and load weight in each of the historical time ranges, the unsupervised perceptron to be trained is trained to obtain the unsupervised perceptron.

6. An electronic device comprising a memory, a processor, and a computer program stored in the memory, characterized in that, The processor executes the computer program to implement the steps of the method according to any one of claims 1-5.

7. A computer-readable storage medium having a computer program / instructions stored thereon, characterized in that, When the computer program / instructions are executed by the processor, they implement the steps of the method according to any one of claims 1-5.

8. A computer program product comprising a computer program / instructions, characterized in that, When the computer program / instructions are executed by the processor, they implement the steps of the method according to any one of claims 1-5.

Citation Information

Patent Citations

  • Method and system for realizing NAT (Network Address Translation) load balancing, electronic equipment and storage medium

    CN114866480A

  • Load balancing method and device, electronic equipment and computer readable storage medium

    CN116708450A