A gateway load balancing control method, device and equipment and readable storage medium
By setting the initial weight value and alarm threshold of the server, hardware resource information is dynamically obtained, dynamic weight values are calculated and sorted, solving the problem in existing technologies that cannot dynamically allocate requests based on server hardware resources in real time, and realizing full utilization of server resources and load balancing.
Patent Information
- Application Number
- CN202211482522.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-24
- Publication Date
- 2026-02-27
- Estimated Expiration
- 2042-11-24
AI Technical Summary
Existing technology cannot dynamically allocate requests based on the remaining hardware resources of the server in real time. This results in some servers with sufficient hardware resources not being fully utilized, while servers with scarce hardware resources are overloaded, which may lead to server crashes.
By setting the initial weight value and alarm threshold of the server, the remaining hardware resource information is dynamically obtained, the dynamic weight value is calculated, and the server is sorted in combination with the initial weight value to select the most suitable server to handle the request.
It enables dynamic selection of servers to handle requests based on server hardware resources under current load conditions, making full use of resources and ensuring normal server operation and gateway load balancing.
Smart Images

Figure CN115842828B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of Internet, and particularly relates to a gateway load balancing control method and device, equipment and a readable storage medium. BACKGROUND
[0002] With the development and perfection of Internet application technology, people's daily work, communication, travel, shopping, etc. can be completed by accessing websites. However, with the increasing number of access requests of a large number of users, the pressure on the server when processing user access requests is also increasing.
[0003] In order to ensure that the server can withstand the massive access requests of users without causing downtime, the traditional load balancing method is usually used between the gateway and the business layer, that is, the received access requests are distributed to each server in the micro-service gateway cluster for processing. However, in real production, the machine hardware resource configurations of each server in the cluster are difficult to be consistent in most cases, and the remaining hardware resources are difficult to predict during project operation. The existing load balancing method cannot dynamically select according to the remaining hardware resources of each server in real time, and some servers with sufficient hardware resources are not fully utilized, while some servers with insufficient hardware resources are overloaded to process requests, resulting in server downtime. SUMMARY
[0004] The present application aims to at least solve one of the above technical defects, and in view of this, the present application provides a gateway load balancing method, device, equipment and readable storage medium, which solves the technical defect that the existing technology cannot dynamically allocate requests according to the remaining hardware resources of the server in real time.
[0005] In order to achieve the above purpose, the present scheme is as follows:
[0006] A gateway load balancing control method, comprising:
[0007] According to the hardware resource information of each server, set the initial weight value and the alarm threshold value of each server;
[0008] According to the preset time interval, dynamically obtain the remaining hardware resource information of each server;
[0009] According to the remaining hardware resource information of each server, determine the server whose remaining hardware resource exceeds the alarm threshold value as the first target server;
[0010] Calculate the dynamic weight value of each first target server;
[0011] Combine the initial weight value and the dynamic weight value of each first target server to obtain a current weight value of each first target server;
[0012] Sort the current weight values of the first target servers to obtain a weight sequence;
[0013] Determine a third target server according to the weight sequence and a preset manner.
[0014] Preferably, the initial weight value and the alarm threshold of each server are set according to hardware resource information of each server, including:
[0015] Obtain and calculate the contribution degree of each hardware of each server according to the information of each hardware in each server;
[0016] Determine the initial weight value of each server according to the contribution degree of each hardware of each server;
[0017] Determine the alarm factor corresponding to each hardware of each server according to the initial weight value of each server and the contribution degree of each hardware;
[0018] Determine the alarm threshold of each server according to the alarm factor corresponding to each hardware of each server.
[0019] Preferably, the residual hardware resource information of each server is dynamically obtained at a preset time interval, including:
[0020] Register all the servers for service;
[0021] Determine a second target server that completes service registration;
[0022] Determine the residual hardware resource information of the second target server at the preset time interval.
[0023] Preferably, the server whose hardware resource remaining amount exceeds the alarm threshold is determined as a first target server according to the residual hardware resource information of each server, including:
[0024] Determine whether there is a second target server whose residual hardware resource information exceeds the alarm threshold of the second target server corresponding thereto;
[0025] If there is the second target server whose remaining hardware resource information exceeds the alarm threshold of the second target server corresponding thereto, the second target server whose remaining hardware resource information exceeds the alarm threshold of the second target server corresponding thereto is determined as the first target server.
[0026] If there is the second target server whose remaining hardware resource information is lower than the alarm threshold of the second target server corresponding thereto, the second target server whose remaining hardware resource information does not exceed the alarm threshold of the second target server corresponding thereto is determined to no longer process the current access request.
[0027] Preferably, the combining of the initial weight value and the dynamic weight value of each first target server to obtain the current weight value of each first target server comprises:
[0028] determining the initial weight value and the dynamic weight value corresponding to each first target server;
[0029] determining the current weight value of each first target server according to the initial weight value and the dynamic weight value corresponding to each first target server.
[0030] Preferably, the sorting of the current weight value of each first target server to obtain a weight sequence comprises:
[0031] obtaining the current weight value of all first target servers to obtain a weight set;
[0032] sorting the current weight value of all first target servers in the weight set to obtain the weight sequence.
[0033] Preferably, the determining of a third target server according to the weight sequence and a preset manner comprises:
[0034] selecting the first target server with the highest current weight value in the weight sequence according to the weight sequence;
[0035] selecting the first target server with the highest current weight value in the weight sequence and determining it as the third target server.
[0036] A gateway load balancing device comprises:
[0037] a server setting module configured to set an initial weight value and an alarm threshold of each server according to hardware resource information of each server;
[0038] An information obtaining module is configured to dynamically obtain the remaining hardware resource information of each server according to a preset time interval;
[0039] A first target server determining module is configured to determine, according to the remaining hardware resource information of each server, the server whose hardware resource remaining amount exceeds the alarm threshold as a first target server;
[0040] A dynamic weight value calculating module is configured to calculate a dynamic weight value of each first target server;
[0041] A current weight value calculating module is configured to obtain a current weight value of each first target server by combining the initial weight value and the dynamic weight value of each first target server;
[0042] A weight sequence obtaining module is configured to sort the current weight values of each first target server to obtain a weight sequence;
[0043] A third target server determining module is configured to determine a third target server according to the weight sequence and a preset mode.
[0044] A gateway load balancing device, comprising one or more processors and a memory;
[0045] The memory stores computer readable instructions, and the computer readable instructions are executed by the one or more processors to implement the steps of the gateway load balancing control method described in any of the preceding embodiments.
[0046] A readable storage medium, the readable storage medium stores computer readable instructions, and the computer readable instructions are executed by one or more processors to make the one or more processors implement the steps of the gateway load balancing control method described in any of the preceding embodiments.
[0047] From the above technical solution can be seen, the embodiment of the application sets the initial weight value and the alarm threshold of each server according to the hardware resource information of each server, and dynamically obtains the residual hardware resource information of each server according to the preset time interval, which helps to screen out the first target server according to the residual hardware resource information and the alarm threshold of each server. After screening each first target server, the dynamic weight value of each target server can be calculated, and the initial weight value corresponding thereto can be combined to obtain the current weight value of each first target server, which helps to sort according to the current weight value of each first target server. After sorting the current weight value of each target server, the weight sequence is obtained, and the corresponding first target server can be further selected and determined as the third target server according to the weight sequence, realizing the load balancing of the gateway and the normal operation of the server under the current load condition. The application can dynamically select the server for processing the request according to the residual hardware resource of each server when receiving the request, which can fully utilize the server resources under the current load condition, and ensure the normal operation of the server and the load balancing of the gateway. BRIEF DESCRIPTION OF DRAWINGS
[0048] In order to more clearly illustrate the technical solutions in the embodiments of the application or the prior art, the drawings needed to be used in the embodiments or the prior art description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the application, and other drawings can be obtained by those skilled in the art without creative labor.
[0049] Figure 1 A schematic diagram of a network architecture of a distributed micro-service cluster architecture mode provided by an embodiment of the application;
[0050] Figure 2 A flowchart of a method for implementing gateway load balancing control provided by an embodiment of the application;
[0051] Figure 3 A schematic diagram of a gateway load balancing control device structure provided by an embodiment of the application;
[0052] Figure 4 A hardware structure block diagram of a gateway load balancing control device disclosed by an embodiment of the application. DETAILED DESCRIPTION
[0053] With reference to the accompanying drawings, the technical solutions in the embodiments of the present application will be described clearly and completely. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative efforts belong to the scope of the present application.
[0054] With the development and improvement of Internet application technology, people can complete most of the daily office work, communication, travel and shopping by accessing websites. This facilitates people's activities, but also brings a problem to the website server: as the request volume of a large number of users increases, the pressure on the website server when processing requests is also increasing.
[0055] Because the hardware resource configuration of the machines in the cluster in real production is difficult to be consistent in most cases, and the real-time remaining hardware resources are more difficult to predict during the project running process.
[0056] At present, a large number of projects adopt a distributed micro-service cluster architecture mode. The network architecture of the distributed micro-service cluster architecture mode is as shown in Figure 1
[0057] Figure 1 In the network architecture shown, Nginx can only play a load balancing role to the Gateway gateway layer, and cannot extend to specific business services. Therefore, the load balancing from the gateway to the business layer generally adopts software load balancing.
[0058] In view of the fact that most of the current gateway load balancing control schemes are difficult to dynamically allocate access requests to servers according to the remaining hardware resources of the servers, the present applicant has researched a gateway load balancing control scheme. The gateway load balancing control method can dynamically allocate servers according to the remaining hardware resources of the servers when allocating corresponding processing servers for access requests. Thus, the problem that some servers with sufficient hardware resources are not fully utilized, while some servers with insufficient hardware resources are overloaded to process requests, resulting in server downtime, is avoided.
[0059] The method provided by the embodiments of the present application can be used in many general or special computing device environments or configurations. For example: personal computers, server computers, handheld devices or portable devices, tablet devices, multi-processor devices, distributed computing environments including any of the above devices or devices, and the like.
[0060] The embodiment of the present application provides a gateway load balancing control method, which can be applied to various Internet systems, and can also be applied to various computer terminals or intelligent terminals, and the execution subject can be a processor or a server of a computer terminal or an intelligent terminal.
[0061] The gateway load balancing control method provided by the embodiment of the present application will be described below in combination with Figure 2 , a flowchart of the gateway load balancing control method provided by the embodiment of the present application is shown in Figure 2 , and the flowchart can include the following steps: Figure 2
[0062] Step S100, setting initial weight values and alarm threshold values of each server according to hardware resource information of each server.
[0063] Specifically, the existing gateway-to-service layer load balancing generally adopts software load balancing, and currently, a polling algorithm is usually used, which mainly distributes the received access requests to each server in turn, and the algorithm is relatively simple, and is more suitable for the case that the performance of each server is close, but in the actual production environment, the configurations of each server in the cluster are difficult to be the same, so when the access requests are distributed, some servers with abundant hardware resources cannot fully play their performance, and some servers with insufficient hardware resources may be overloaded due to bearing a certain amount of access requests, thereby causing server downtime.
[0064] The reason is mainly that all servers are treated equally, and the round-robin distribution strategy is adopted without considering the hardware resources of each server.
[0065] In a distributed system, in order to realize load balancing, load scheduling algorithms such as Nginx, RPC service discovery, gateway request forwarding and the like are necessarily involved. Traditional load balancing algorithms can be divided into two categories: static algorithm and dynamic algorithm. Common static load balancing algorithms include weighted random algorithm, consistent hashing algorithm, polling algorithm and weighted polling algorithm. Common dynamic load balancing algorithms include fastest response algorithm and minimum active number algorithm. Different load balancing algorithm schemes have different influences on server clusters. The following is a brief introduction to several algorithms.
[0066] The algorithm idea of the common polling algorithm is to distribute the received requests to each server in turn, and the algorithm is simple and suitable for the case that the performance of each server is close. However, in the actual production environment, the configurations of each server in the cluster are not all the same.
[0067] The weighted round robin algorithm is an improved algorithm of the common round robin algorithm. Before the service is deployed on the server, the developer will pre-assign different weights to the servers according to the different configurations of the servers, so that the server with better performance is assigned a larger weight, and the server with poor performance is assigned a smaller weight. By adjusting the number of requests processed by each server through the weight, the total number of requests processed by each server is ultimately approximately equal to the pre-assigned weight ratio, thereby achieving the effect of load balancing.
[0068] The weighted random algorithm is based on the classical probability distribution. The weighted random algorithm provides each server with a corresponding weight before the service is started, so that the number of requests processed by each server in operation is approximately proportional to the weight. The weighted random algorithm is simple and efficient, but when the number of requests is small, most of the requests will be assigned to the server with a larger weight, and the request may be skewed.
[0069] The consistent hashing algorithm is to generate a hash value based on the IP address or other information of the server and project it onto a hash ring of a certain length. Whenever there is a new request, a hash value is generated according to the algorithm, and then the first server node greater than or equal to the hash value is found on the hash ring, and the request will be projected on the server of this node for processing. In this way, the requests of the servers are dispersed, and the effect of load balancing is achieved.
[0070] The common indicators for measuring load balancing algorithms are response time and throughput.
[0071] The response time refers to the time consumed for accepting and processing a certain number of requests, which is by default the unit of time in seconds in the embodiments of the present application.
[0072] The throughput is the number of requests processed per unit of time.
[0073] To compare the performance of the above-mentioned static algorithms, Postjson is used to simulate the weighted random, weighted round robin, and consistent hashing algorithms for user requests with 500, 1000, 1500, 2000, and 2500 concurrent numbers, and the average value is taken after removing the maximum and minimum values for data statistics, as shown in Table 1.
[0074] Table 1 Comparison table of performance test effects of several common load scheduling algorithms
[0075]
[0076] From Table 1, it can be seen that:
[0077] With the increase of concurrency, the response time of the three algorithms also gradually increases, and the throughput tends to be stable. The response time of the consistent hashing algorithm is higher than that of the other two algorithms, which may be because a large amount of time is consumed in the hash calculation during the request processing, which also leads to a lower throughput than the other two algorithms. The weighted random algorithm and the weighted round robin algorithm are very similar in response time and throughput. Due to the characteristics of the weighted round robin algorithm, there is no data skew problem with less request amount, and the heterogeneity of the server hardware is more suitable for the weighted round robin algorithm. Improving the original static algorithm to a dynamic algorithm will have greater improvement space, and the present application is based on the smooth weighted round robin algorithm improvement of hardware resources.
[0078] The embodiments of the present application are based on the dynamic allocation of access requests by the hardware resources of each of the servers. First, the hardware resource information of each of the servers needs to be obtained, and the initial weight value and the alarm threshold value corresponding to each of the servers are calculated according to the hardware resource information corresponding to each of the servers. When there is an access request, the initial weight value and the alarm threshold value of each of the servers can be used as part of the conditions for judging whether the server can process the access request.
[0079] For example, the entropy weight method can be used to calculate the initial weight value of each of the servers in the server cluster.
[0080] Step S110, the remaining hardware resource information of each of the servers is dynamically obtained according to a preset time interval.
[0081] Specifically, as known from the above description, in order to ensure better load balancing effect and utilization of server performance, the allocation of access requests needs to be based on the hardware resource conditions of each of the servers. Since the access requests are changing all the time, the remaining hardware resources of each of the servers are also changing constantly.
[0082] Suppose that at the current time, there are server A1 and server B1, server A1 is processing access request a1, using 80% of the hardware resources, and the remaining hardware resources are only 20%, which cannot process access request b1, and the access request b1 is allocated to server B1 which is idle at the current time and has 100% remaining hardware resources. But at the next time, the server A1 has finished processing the access request a1, and the remaining hardware resources of the server A1 have recovered to 100%, which can meet the hardware resources required for processing the access request c1, so the server A1 can process the access request c1.
[0083] Therefore, the remaining hardware resource information of each server at the current time is obtained at preset time intervals, and the remaining hardware resource information of each server at the current time is used to understand the remaining hardware resource situation of each server at the current time, which is helpful for distributing access requests according to the remaining hardware resource situation of each server at the current time.
[0084] In step S120, the server whose remaining hardware resource amount exceeds the alarm threshold is determined as the first target server according to the remaining hardware resource information of each server.
[0085] Specifically, as known from the above description, to enable the server to process access requests, it is necessary to ensure that the server has sufficient remaining hardware resources. In order to ensure that the server will not be overloaded due to depletion of hardware resources by access requests, thereby causing the server to be down, as known from the above description, the application embodiment can preset the alarm threshold of each server, and can set that when the remaining amount of hardware resources of the server exceeds the alarm threshold corresponding to the server, the server can continue to process access requests.
[0086] Since the remaining hardware resource information of each server has been obtained in step S110, the latest remaining hardware resource information of each server can be further obtained, and it is determined whether the latest remaining hardware resource information of each server exceeds the alarm threshold corresponding to each server. If the latest remaining hardware resource information of the server is lower than the alarm threshold corresponding to the server, it indicates that the remaining hardware resources of the server are insufficient, and the server cannot continue to process access requests. If the server continues to process access requests, it may cause overload and cause the server to be down. If the latest remaining hardware resource information of the server exceeds the alarm threshold corresponding to the server, it indicates that the server can process access requests and can be used as the first target server.
[0087] In step S130, the dynamic weight value of each first target server is calculated.
[0088] Specifically, as known from the above description, the first target server capable of processing access requests can be selected according to the remaining hardware resource situation of each server. Since there can be multiple first target servers, how to find the target server most suitable for processing the access request accepted at the current time needs to be further determined.
[0089] First, the dynamic score of each hardware corresponding to each first target server is calculated according to the residual hardware resource information of each first target server obtained at the current time. The dynamic weight value of each first target server is calculated by using a preset method based on the dynamic score of each hardware corresponding to each first target server. This helps each first target server to further participate in the screening of the server suitable for processing the access request received at the current time according to the dynamic weight value of each first target server.
[0090] In step S140, the initial weight value and the dynamic weight value of each first target server are combined to obtain the current weight value of each first target server.
[0091] Specifically, as described above, the dynamic weight value of each first target server can be obtained, but the first target server selected to process the access request is determined not only by the corresponding dynamic weight value but also by the initial weight value of each first target server.
[0092] As described above, the initial weight value of each server has been obtained, but since each first target server is selected from all servers, the initial weight value of each first target server has been obtained in step S100. The initial weight value and the dynamic weight value of each first target server can be processed according to a preset processing method to obtain the current weight value of each first target server, which helps to select a second target server to process the access request received at the current time according to the current weight value of each first target server.
[0093] In step S150, the current weight value of each first target server is sorted to obtain a weight sequence.
[0094] Specifically, as described above, the initial weight value and the dynamic weight value of each first target server can be calculated by a preset processing method in step S140 to obtain the current weight value of each first target server. The first target server for processing the access request received at the current time can be determined according to the current weight value of each first target server.
[0095] The final processing server for receiving the access request at the current time is determined according to the current weight value corresponding to each first target server. The current weight value of each first target server is sorted to obtain a weight sequence, so that the first target server most suitable for processing the access request received at the current time is selected according to the weight sequence.
[0096] In step S160, the third target server is determined according to the weight sequence and a preset mode.
[0097] Specifically, as described above, the weight sequence obtained by sorting the current weight value corresponding to each first target server can be obtained through step S150. The current weight value corresponding to the first target server most suitable for processing the access request received at the current time is selected from the weight sequence according to a preset mode, and the first target server corresponding to the current weight value selected from the weight sequence and most suitable for processing the access request received at the current time is determined as the third target server.
[0098] As can be seen from the above technical solutions, the method provided by the embodiments of the present application can set the initial weight value and the alarm threshold of each server according to the hardware resource information of each server, and dynamically obtain the residual hardware resource information of each server according to a preset time interval, which helps to screen the first target server according to the residual hardware resource information and the alarm threshold of each server. After screening each first target server, the current weight value of each first target server can be obtained by calculating the dynamic weight value of each target server and combining the initial weight value corresponding thereto, and the weight sequence can be obtained after sorting the current weight value of each target server. After obtaining the weight sequence, the corresponding first target server can be selected according to the weight sequence and determined as the third target server, which realizes the selection of the server most suitable for processing the current access request according to the hardware resource condition of each server under the current load condition. The present application can dynamically select the server for processing the request according to the residual hardware resource of each server when receiving the request, which helps to fully utilize the server resources under the current load condition and ensure the normal operation of the server and the load balancing of the gateway.
[0099] In another embodiment of the present application, the process of setting the initial weight value and the alarm threshold of each server according to the hardware resource information of each server in step S100 is introduced, which can include the following steps:
[0100] Step S201, obtaining and calculating the contribution degree of each hardware of each server according to the information of each hardware in each server.
[0101] Specifically, when receiving an access request, the hardware resource situation of each server needs to be considered to determine the selected server, so as to realize load balancing.
[0102] In actual application process, the server may be abnormal due to various reasons, and the abnormality of the server may affect the contribution degree of each hardware of each server.
[0103] Therefore, in order to better calculate the contribution degree of each hardware of each server, the present inventors find that the contribution degree of each hardware of each server can be calculated by using the smooth weighted round robin algorithm.
[0104] Among them,
[0105] The calculation process of calculating the contribution degree of each hardware of each server can include the following:
[0106] (1) Calculate the current weight of each server, and the current weight of each server is equal to the current weight plus the effective weight of the server node;
[0107] (2) Sort the current weight of each server, and find out the server with the maximum current weight as the target server for processing access request.
[0108] (3) Subtract the current weight corresponding to the selected server from the total weight;
[0109] When it is necessary to find out the server most suitable for processing access request, the above calculation process of calculating the contribution degree of the hardware of the server can be repeated to determine the target server for processing access request.
[0110] For example,
[0111] Suppose a server cluster T1 exists servers a, b, c, and in the case where the server does not occur abnormality, the effective weight corresponding to each server is respectively:
[0112] E i ={4, 2, 1}
[0113] Among them, E iThe effective weight of the server a, b, c can be represented;
[0114] E i The effective weight of the server a can be represented as {4};
[0115] E i The effective weight of the server c can be represented as {1};
[0116] E i The effective weight of the server b can be represented as {2};
[0117] According to the effective weight of each server, the total weight of the server cluster T1 is equal to the sum of the effective weight of the server a, b, c, that is,
[0118]
[0119]
[0120] Wherein,
[0121] E t The total weight of the server cluster T can be represented as {4+2+1};
[0122] The initial value of the current weight of the server a, b, c is set as 0;
[0123] According to the sorting of the current weight of each server in the server cluster T1, the corresponding server can be selected to process the access request, and the selection result and the corresponding current weight as shown in Table 2 can be obtained:
[0124] Table 2 Comparison of the current weight of each server in the server cluster T1 before and after being selected as the target server that can process the access request
[0125]
[0126]
[0127] From the above Table 2, it can be seen that the sequence of the final selected target server is {a, b, a, c, a, b, a}, and the sequence of the target server can meet the weight distribution principle.
[0128] It is found through experiments that, although the above-mentioned smooth polling algorithm can achieve the effect of processing access requests according to the uniform distribution of the weights of servers in a static manner, it only considers the uniform distribution of access requests according to the statically assigned weights and cannot dynamically determine whether the hardware resources of the current server can still meet the efficient processing of requests. In order to dynamically determine whether the hardware resources of the current server can still meet the efficient processing of requests, the present inventors introduce the hardware resource weight of the server as an influencing factor for server selection to consider assigning more suitable servers to process batch access requests according to the hardware resources of the server.
[0129] As can be known from the above description, the initial weight value and the alarm threshold of each server can be determined by the hardware resource condition of each server itself.
[0130] Therefore, to obtain the initial weight value and the alarm threshold of each server, the information of each hardware in each server can be obtained first.
[0131] In actual application, the common hardware affecting the performance of a server includes CPU, memory, and bandwidth.
[0132] Since the configurations of the hardware in each server are different, some servers have larger memory but smaller bandwidth, while some servers have more CPU cores but smaller memory.
[0133] It can be understood that the configurations of each hardware corresponding to each server can be different, and each hardware of each server directly affects the performance of the server.
[0134] In order to better calculate the initial weight value and the alarm threshold of each server according to the configuration of each hardware of the server, the contribution of each hardware of each server to the performance of the server can be calculated according to the configuration of each hardware of each server, so that the initial weight value of each server can be further determined according to the contribution of each hardware of each server to the performance of the server.
[0135] In step S202, the initial weight value of each server is determined according to the contribution of each hardware of each server.
[0136] Specifically, as can be known from the above description, the contribution of each hardware of each server can be calculated by obtaining the configuration information of each hardware in each server.
[0137] But the contribution of each of the hardware of each of the servers cannot directly reflect the ability of each of the servers to process access requests, and further according to the contribution of each of the hardware of each of the servers, the initial weight value of each of the servers can be calculated using the entropy weight method.
[0138] The initial weight value can include a factor calculated according to the contribution of each of the hardware corresponding to each of the servers to reflect the priority of each of the servers in processing access requests, and can also be used as a comprehensive data to quantify the hardware resources of each of the servers by comprehending the different hardware configurations of each of the servers.
[0139] Suppose that a server cluster T2 includes a server A2 and a server B2.
[0140] The CPU, memory, and bandwidth of the server A2 are completely different from those of the server B2, and it is difficult to determine the performance of the server A2 and the server B2 by comparing the contribution of each hardware to the performance. The contribution of each hardware of the server A2 and the server B2 needs to be comprehensively converted by a preset conversion method, so that an initial performance of the server can be obtained, which facilitates the determination of the performance indicators of each of the servers to determine the indicators of the servers processing access requests, i.e. the initial weight value. The server with a higher initial weight value has a better initial performance and a higher weight. When receiving an access request, the access request can be preferentially assigned to the server with a higher initial weight value for processing.
[0141] Step S203, determining the alarm factor corresponding to each of the hardware of each of the servers according to the initial weight value of each of the servers and the contribution of each of the hardware.
[0142] Specifically, as known from the above description, the initial weight value of the server can be determined according to the contribution of each of the hardware corresponding to each of the servers. Since the performance of the server is limited, if the server is overloaded, the server will be down. In order to ensure the normal operation of the server, the alarm factor corresponding to each of the hardware of each of the servers needs to be further confirmed according to the contribution of each of the hardware of each of the servers and the initial weight value of the server, which is beneficial to further confirming the alarm threshold corresponding to each of the hardware of each of the servers according to the alarm factor corresponding to each of the hardware of each of the servers.
[0143] Step S204, determining the alarm threshold of each of the servers according to the alarm factor corresponding to each of the hardware of each of the servers.
[0144] Specifically, as described above, after step S203, the alarm factor corresponding to each piece of hardware of each server can be obtained.
[0145] Furthermore, it is necessary to determine the alarm threshold for each server based on the alarm factor corresponding to each piece of hardware in each server.
[0146] The alarm threshold for each server refers to the minimum hardware resource value that affects server performance. If the remaining hardware resources of the server are lower than the alarm threshold, it means that the server can no longer process access requests at the current moment. Otherwise, it will exceed the server's load and may cause the server to crash.
[0147] For example,
[0148] Assuming a server cluster T3 has 4 servers, using a single-core server with 1GB of memory and 1Mbps of bandwidth as a benchmark, each additional CPU core doubles the computing power, and each doubling of memory or bandwidth doubles the load capacity. It can be assumed that improvements in disk space have a relatively small impact on computer load.
[0149] The specifications of each server in server cluster T3 are shown in Table 3 below:
[0150] Table 3: Hardware Specifications of Each Server in Server Cluster T3
[0151]
[0152] Based on the impact of each piece of hardware on the computing power of each server in server cluster T3, the score results of each piece of hardware in server cluster T3 can be quantified. The score results of the hardware of each server in server cluster T3 are shown in Table 4 below:
[0153] Table 4: Scoring Results of Each Hardware Component of Each Server in Server Cluster T3
[0154]
[0155] Furthermore, based on Table 4 above, the rating matrix for each hardware component of each server in server cluster T3 can be derived as follows:
[0156]
[0157] After obtaining the score matrix of each hardware of each server in the server cluster T3, the contribution degree of each hardware of each server in the server cluster T3 can be calculated according to the score matrix of each hardware of each server in the server cluster T3, wherein the contribution degree of each hardware of each server in the server cluster T3 can be calculated by the following formula:
[0158]
[0159] wherein,
[0160] P ij may represent the contribution degree of each hardware of each server in the cluster;
[0161] X j may represent the score of each hardware of each server in the cluster;
[0162] i may represent the server number in the cluster;
[0163] m may represent the number of servers in the cluster.
[0164] Through the above calculation, the contribution degree of each hardware of each server in the server cluster T3 can be obtained, wherein the contribution degree of each hardware of each server in the server cluster T3 can be shown in Table 5 as follows:
[0165] Table 5: Contribution degree result table of each hardware of each server in the server cluster T3
[0166]
[0167] According to Table 5, it can be seen that the contribution degree of each hardware of each server in the server cluster T3 has a corresponding proportional relationship with the corresponding value.
[0168] After determining the contribution degree of each hardware of each server in the server cluster T3, the initial weight value corresponding to each server in the server cluster T3 can be further calculated, which is specifically as follows:
[0169] As can be known from the above introduction, the contribution degree of each hardware of each server in the server cluster T3 can be determined, which is shown in Table 5 above.
[0170] Further, according to the contribution degree of each hardware of each server in the server cluster T3, the total contribution amount of all hardware resources to the service performance can be calculated, which can specifically include the following:
[0171]
[0172]
[0173] wherein,
[0174] D j =1-E j may represent the total contribution of all hardware resources in each server in the server cluster T3 to the service performance;
[0175] m' represents the number of hardware;
[0176] i' may represent each different hardware;
[0177] K may be a constant;
[0178] P ij represents the contribution degree of each hardware in each server.
[0179] In the actual calculation process, in order to ensure the accuracy of the calculation result, it can be ensured that 0 = < E j < = 1, that is, E j The maximum value of E j When the value of E j tends to 1, especially when the value of E j is exactly equal to 1, the role of the target hardware in decision-making can be ignored, and the weight of the hardware can be set to 0.
[0180] In actual application process, the constant K can be set according to actual calculation requirement.
[0181] According to the scheme tested by the embodiment of the application, K = 0.722 can be obtained, and the contribution degree of each hardware in each server in the server cluster T3 and the product of the natural logarithm thereof can be obtained by calculation, as shown in the following Table 6:
[0182] Table 6: Comparison table of the contribution degree of each hardware in each server in the server cluster T3 and the product of the natural logarithm thereof
[0183]
[0184] Further, according to the value of K in this test, combined with the product of each column sum of the hardware score matrix of each server in the server cluster T3 introduced above, the contribution degree of each hardware of each server in the server cluster T3 in all schemes in this test can be obtained, and thus the total contribution of each hardware of each server in the server cluster T3 in all schemes can be calculated, as shown in the following Table 7:
[0185] Table 7: Comparison table of the total contribution of each hardware of each server in the server cluster T3 to the service performance
[0186] Hardware CPU Memory Disk Bandwidth E j ]]> 0.87 0.9 4 0.919
[0187] Based on Table 7, the consistency of the contribution of each hardware component in each server of server cluster T3 can be further calculated. The consistency of the contribution of each hardware component across all servers can be calculated using the following formula:
[0188] D j =1-E j
[0189] in,
[0190] D j It can represent the degree of consistency in the contribution of each piece of hardware on each server in server cluster T3.
[0191] E j This can represent the total contribution of each hardware component of each server in server cluster T3 for all schemes in this experiment;
[0192] Based on the above calculation results, the degree of consistency of contribution of each hardware component of each server in server cluster T3 can be obtained, as shown in Table 8 below:
[0193] Table 8: Comparison of the consistency of contribution of each hardware component on each server in server cluster T3
[0194] Contribution consistency degree CPU Memory Disk Bandwidth
[00021] j ]] 0.23 0.1 -3 0.1
[0195] Based on Table 8, we can further determine the consistency of contribution D of each hardware component on each server in server cluster T3. j Calculate the weight W of each hardware component of each server in server cluster T3. j In this context, the weight W of each hardware component in each server within server cluster T3 is... j It can be calculated using the following formula:
[0196]
[0197] in,
[0198] D j It can represent the degree of consistency in the contribution of each piece of hardware on each server in server cluster T3.
[0199] W j It can represent the weight of each hardware component of each server in server cluster T3.
[0200] As explained above, the disk can be excluded from computer performance metrics calculations. However, the weight of each hardware component on each server in server cluster T3 can be obtained through calculation, as shown in Table 9 below:
[0201] Table 9 Weighting table of each hardware of each server in server cluster T3
[0202] Hardware CPU Memory Bandwidth Weight 0.53 0.23 0.23
[0203] According to Table 9, the weight score of each hardware of each server in server cluster T3 can be further calculated, as shown in the following Table 10:
[0204] Table 10 Weighting score table of each hardware of each server in server cluster T3
[0205]
[0206] According to Table 10, the initial weight value of each server in server cluster T3 can be further calculated, which can be calculated by the following formula:
[0207]
[0208] Wherein,
[0209] S i The total score of each server in server cluster T3 can be represented;
[0210] P(S) can represent the initial weight value of each server in server cluster T3.
[0211] According to the above calculation results, the initial weight value of each server in server cluster T3 can be obtained, as shown in the following Table 11:
[0212] Table 11 Initial weight value table of each server in server cluster T3
[0213] Server Server A Server B Server C Server D Initial weight value 0.117 0.173 0.38 0.33
[0214] According to Table 11, the initial weight value of each server in server cluster T3 can be obtained, which is helpful to select a server suitable for processing the access request at the current time according to the initial weight value of each server in server cluster T3.
[0215] From the above technical solutions can be seen, the method provided by the embodiments of the present application can obtain and determine the contribution degree of each hardware in each server according to the information of each hardware in each server, which helps to calculate and determine the initial weight value of each server according to the contribution degree of each hardware in each server. After obtaining the initial weight value of each server, the alarm factor corresponding to each hardware of each server can be determined according to the initial weight value of each server and the contribution degree of each hardware, which helps to determine the alarm threshold of each server according to the alarm factor corresponding to each hardware of each server. The embodiments of the present application can obtain the initial weight value and the alarm threshold of each server through the information of each hardware of each server, which can help to select a server suitable for processing the access request at the current time.
[0216] In another embodiment of the present application, the process of dynamically obtaining the remaining hardware resource information of each server at a preset time interval is introduced for the above step S120, which can include the following steps:
[0217] Step S301, register all the servers for service.
[0218] Specifically, after step S110, the initial weight value and the alarm threshold of each server can be obtained, which can be used for server selection, but the server selected to process the access request received at the current time also needs to be determined according to the real-time hardware resource remaining amount of each server.
[0219] Suppose there are server A3 and server B3.
[0220] If the initial weight value of the server A3 is higher than that of the server B3 after calculation, but the server A3 is processing the access request a3 at the current time, and the server B3 is idle, and the access request b3 is received at this time. If the hardware resource remaining amount of the server A3 at the current time is lower than that of the server B3 after calculation, the server B3 needs to be selected as the server for processing the access request b3, so as to ensure the normal operation of the server.
[0221] In order to realize the above functions, it is necessary to obtain the remaining hardware resource information of each server in real time, but in order to obtain the remaining hardware resource information of each server, it is necessary to register each server for service. Only after the service registration of the server is realized, the remaining resource information of each server can be monitored in real time.
[0222] Step S302, determining the second target server which completes the service registration.
[0223] Specifically, as known from the above description, each of the servers can be registered for service through step S301. Further, since only the servers which complete the service registration can obtain the remaining resource information of the servers in real time, it is necessary to further determine which servers complete the service registration.
[0224] Screening the servers which complete the service registration from each of the servers and determining the servers as the second target server can help to obtain the remaining hardware resource information of the second target server in real time according to the preset time interval.
[0225] Step S303, determining the remaining hardware resource information of the second target server according to the preset time interval.
[0226] Specifically, as known from the above description, the servers which complete the service registration can be determined as the second target server through the processing of step S302. Further, the remaining hardware resource information of the second target server can be obtained in real time according to the preset time interval.
[0227] By obtaining the remaining hardware resource information of the second target server in real time, the latest remaining hardware resource information of each of the second target server can be used as an influencing factor for selecting a server to process the access request when the access request is received.
[0228] As can be seen from the above technical solution, the method provided by the embodiments of the present application can first register all the servers for service and determine the second target server which completes the service registration. This can help to determine the remaining hardware resource information of each of the second target server according to the preset time interval and determine the first target server according to the remaining hardware resource information of each of the second target server and the alarm threshold. The embodiments of the present application can realize real-time obtaining of the remaining hardware resource information of each of the second target server which completes the service registration by registering each of the servers for service. This can help to select a server suitable for processing the access request at the current time according to the remaining hardware resource information of each of the second target server.
[0229] In another embodiment of the present application, the process of determining the servers whose hardware resource remaining amount exceeds the alarm threshold as the first target server according to the remaining hardware resource information of each of the servers is introduced for step S130. The process can include the following steps:
[0230] Step S401, judging whether there is the second target server whose remaining hardware resource information exceeds the alarm threshold of the second target server corresponding thereto.
[0231] Specifically, as introduced above, after step S120, the remaining hardware resource information of the second target server can be determined according to the preset time interval. After obtaining the remaining hardware resource information of the second target server, the second target server that can process access requests at the current time is further screened out as the first target server according to the remaining hardware resource information of the second target server.
[0232] The obtained latest remaining hardware resource information of each second target server and the alarm threshold of each second target server corresponding thereto need to be compared first. According to the comparison result, the second target server that can process access requests at the current time can be screened out as the first target server.
[0233] If there is the second target server whose remaining hardware resource information exceeds the alarm threshold of the second target server corresponding thereto, it means that the second target server whose remaining hardware resource information exceeds the alarm threshold of the second target server corresponding thereto has sufficient hardware resources for processing the received access request at the current time, and then step S402 can be executed.
[0234] If there is the second target server whose remaining hardware resource information is lower than the alarm threshold of the second target server corresponding thereto, it means that the second target server whose remaining hardware resource information is lower than the alarm threshold of the second target server corresponding thereto does not have sufficient hardware resources for processing the received access request at the current time, and then step S403 can be executed.
[0235] Step S402, determining the second target server whose remaining hardware resource information exceeds the alarm threshold of the second target server corresponding thereto as the first target server.
[0236] Specifically, as introduced above, after the judgment of step S401, the relationship that the remaining hardware resource information of each second target server exceeds the alarm threshold of the corresponding server can be obtained, and the corresponding operation is selected according to the relationship.
[0237] If the second target server whose remaining hardware resource information exceeds the alarm threshold of the second target server corresponding thereto exists, it indicates that the second target server whose remaining hardware resource information exceeds the alarm threshold of the second target server corresponding thereto can have sufficient hardware resources for processing the access request received at the current time, and the second target server whose remaining hardware resource information exceeds the alarm threshold of the second target server corresponding thereto can be determined as the first target server as a candidate server for processing the current received access request.
[0238] In step S403, it is determined that the second target server whose remaining hardware resource information does not exceed the alarm threshold of the second target server corresponding thereto no longer processes the current access request.
[0239] Specifically, as known from the above description, after the judgment in step S401, if the second target server whose remaining hardware resource information is lower than the alarm threshold of the second target server corresponding thereto exists, it indicates that the second target server whose remaining hardware resource information is lower than the alarm threshold of the second target server corresponding thereto is currently relatively short of hardware resources and is difficult to support processing of the received access request at the current time, so the second target server whose remaining hardware resource information is lower than the alarm threshold of the second target server corresponding thereto can directly skip the processing of the current access request and no longer processes the current access request.
[0240] As can be seen from the above-described technical solutions, the method provided in this application embodiment can determine whether there is a second target server whose remaining hardware resource information exceeds the alarm threshold of the corresponding second target server. If there is a second target server whose remaining hardware resource information exceeds the alarm threshold of the corresponding second target server, it indicates that the remaining hardware resources of the second target server are relatively sufficient and can still process access requests. If there is a second target server whose remaining hardware resource information is lower than the alarm threshold of the corresponding second target server, it indicates that the hardware resources of the second target server whose remaining hardware resource information is lower than the alarm threshold of the corresponding second target server are currently occupied too much and cannot continue to process the access requests at the current moment. Therefore, it is directly skipped to ensure that the second target server whose remaining hardware resource information is lower than the alarm threshold of the corresponding second target server will not crash due to overload. This application embodiment can determine whether there is a second target server whose remaining hardware resource information exceeds the alarm threshold of the corresponding second target server, and take different processing methods for different second target servers according to the determination result, thus ensuring the load balance of the second target servers.
[0241] In another embodiment of this application, the process of obtaining the current weight value of each first target server by combining the initial weight value and the dynamic weight value of each first target server in step S140 is described. This process may include the following steps:
[0242] Step S501: Determine the initial weight value and the dynamic weight value corresponding to each of the first target servers.
[0243] Specifically, as described above, after the processing in step S130, the dynamic weight value of each of the first target servers can be calculated. Since determining whether a first target server can process an access request at the current moment requires considering the initial weight value and the dynamic weight value of each server, it is necessary to further obtain and determine the initial weight value and the dynamic weight value of each of the first target servers so that the current weight value of each of the first target servers can be determined based on their initial weight value and dynamic weight value.
[0244] Step S502: Determine the current weight value of each first target server based on the initial weight value and the dynamic weight value corresponding to each first target server.
[0245] Specifically, as known from the above introduction, the initial weight value and the dynamic weight value corresponding to each first target server can be determined in step S501, and further, the initial weight value and the dynamic weight value corresponding to each first target server are integrated to obtain the current weight value of each first target server.
[0246] The current weight value of each first target server can be obtained by adding the occurrence weight value and the dynamic weight value of each first target server, and obtaining the current weight value of each first target server can facilitate selection of the first target server most suitable for processing access requests at the current time according to the current weight value of each first target server.
[0247] As can be seen from the above technical solution, the method provided in the embodiments of the present application can determine the initial weight value and the dynamic weight value corresponding to each first target server, which is helpful for determining the current weight value of each first target server according to the initial weight value and the dynamic weight value corresponding to each first target server, and is helpful for selecting the corresponding first target server as the server for finally processing access requests at the current time according to the current weight value of each first target server. The embodiments of the present application can determine the current weight value of each first target server through the initial weight value and the dynamic weight value corresponding to each first target server, which is helpful for selecting the server for finally processing access requests at the current time according to the current weight value of each first target server.
[0248] In another embodiment of the present application, the process of sorting the current weight values of the first target servers to obtain a weight sequence is introduced for the above step S150, which can include the following steps:
[0249] Step S601: obtaining the current weight values of all first target servers to obtain a weight set.
[0250] Specifically, as known from the above introduction, in step S140, the initial weight value and the dynamic weight value of each first target server can be combined to obtain the current weight value of each first target server, and further, the selection of the first target server most suitable for processing access requests at the current time can be performed according to the current weight value of each first target server.
[0251] The first target server most suitable for processing the access request at the current time is selected according to the current weight value of each first target server, the current weight value of all the first target servers is acquired, a weight set is obtained by comprehensively acquiring the current weight value of all the first target servers, and the first target server most suitable for processing the access request at the current time is selected according to the weight set.
[0252] In step S602, the current weight values of all the first target servers in the weight set are sorted to obtain the weight sequence.
[0253] Specifically, as known from the above description, in step S601, the weight set containing the current weight values of all the first target servers is acquired. Since the data of the acquired weight set is not sorted according to size, it is difficult to directly find the first target server with the highest current weight value from the weight set, and the current weight values of the first target servers in the weight set need to be further sorted to facilitate obtaining the first target server with the highest current weight value according to the sorted result.
[0254] As can be seen from the above technical solutions, the method provided in the embodiments of the present application can first acquire the current weight values of all the first target servers to obtain a weight set, which is helpful to further sort the current weight values of each first target server in the weight set to obtain a weight sequence. The current weight values of all the first target servers can be sorted to obtain the weight sequence, which is helpful to selecting the first target server with the highest current weight value as the server for processing the access request at the current time according to the weight sequence.
[0255] In another embodiment of the present application, the process of determining the third target server according to the weight sequence and a preset manner is introduced, which can include the following steps:
[0256] In step S701, the first target server with the highest current weight value in the weight sequence is selected according to the weight sequence.
[0257] Specifically, as known from the above description, after the sorting in step S150, the sorted weight sequence can be obtained, and the first target server with the highest current weight value needs to be further found from the weight sequence.
[0258] Since the weight sequence is sorted according to the current weight value of each first target server, it is indicated that the first target server corresponding to the current weight value with the highest current weight value in the weight sequence is the server most suitable for processing the access request received at the current time.
[0259] Step S702, selecting the first target server with the highest current weight value in the weight sequence and determining it as the third target server.
[0260] Specifically, as described above, after step S701, the first target server with the highest current weight value in the weight sequence can be selected, and further, the first target server with the highest current weight value in the weight sequence needs to be determined as the third target server, which is the server most suitable for processing the access request received at the current time. The server most suitable for processing the access request received at the current time can be determined as the third target server, which is used by the system to process the access request received at the current time.
[0261] As can be seen from the above technical solutions, the method provided by the embodiments of the present application can first select the first target server with the highest current weight value in the weight sequence according to the weight sequence, which helps to further determine the selected first target server with the highest current weight value in the weight sequence as the third target server, and helps to determine the third target server as the server for finally processing the access request at the current time. The embodiments of the present application can select the first target server with the highest current weight value from the weight sequence according to the weight sequence, find the first target server corresponding to the current weight value with the highest current weight value and determine it as the third target server, which helps to take the third target server as the server for processing the access request at the current time.
[0262] The gateway load balancing control device provided by the embodiments of the present application is described below. The gateway load balancing control device described below can be referred to the gateway load balancing control method described above.
[0263] Referring to Figure 3 , Figure 3 The gateway load balancing control device structure diagram disclosed by the embodiments of the present application is shown.
[0264] As Figure 3 shown, the gateway load balancing control device can include:
[0265] The server setting module 11 is configured to set initial weight values and alarm threshold values of the servers according to hardware resource information of the servers;
[0266] The information acquisition module 12 is configured to dynamically acquire the remaining hardware resource information of the servers at preset time intervals;
[0267] The first target server determination module 13 is configured to determine the servers whose remaining hardware resources exceed the alarm threshold values as the first target servers according to the remaining hardware resource information of the servers;
[0268] The dynamic weight value calculation module 14 is configured to calculate dynamic weight values of the first target servers;
[0269] The current weight value calculation module 15 is configured to obtain current weight values of the first target servers by combining the initial weight values and the dynamic weight values of the first target servers;
[0270] The weight sequence acquisition module 16 is configured to sort the current weight values of the first target servers to obtain a weight sequence;
[0271] The third target server determination module 17 is configured to determine the third target servers according to the weight sequence and a preset mode.
[0272] From the above technical solutions can be seen, the device provided by the embodiment of the application can set the initial weight value and the alarm threshold of each server according to the hardware resource information of each server by using the server setting module 11, and dynamically acquire the residual hardware resource information of each server according to a preset time interval through the information acquisition module 12, which helps to filter out the first target server according to the residual hardware resource information and the alarm threshold of each server. Further, the first target server determination module 13 can determine the server whose hardware resource residual amount exceeds the alarm threshold as the first target server according to the residual hardware resource information of each server, the dynamic weight value calculation module 14 can calculate the dynamic weight value of each first target server, and the current weight value calculation module 15 can obtain the current weight value of each first target server by combining the initial weight value and the dynamic weight value of each first target server, which helps to determine the processor for processing the access request at the current time according to the current weight value of each first target server. To determine the processor for processing the access request at the current time, the weight sequence acquisition module 16 is also needed to sort the current weight values of each first target server to obtain a weight sequence, and the third target server determination module 17 is also needed to determine the third target server according to the weight sequence and a preset manner, which helps to take the third target server as the server for processing the access request at the current time. The application can fully consider the hardware resource condition of each server when allocating the access request received at the current time, and select the server most suitable for the corresponding hardware resource condition according to the hardware resource condition of each server, which ensures that the performance of each server is fully utilized, and also realizes load balancing and ensures the stability of the server.
[0273] The specific processing procedure of each unit included in the gateway load balancing control device can refer to the related description in the foregoing gateway load balancing control method, which will not be described here again.
[0274] The gateway load balancing control device provided by the embodiment of the application can be applied to intelligent devices, such as terminals: mobile phones, computers, etc. Optionally, Figure 4 The hardware structure block diagram of the gateway load balancing control device is shown, which can refer to Figure 4 The hardware structure of the gateway load balancing control device can include at least one processor 1, at least one communication interface 2, at least one memory 3 and at least one communication bus 4.
[0275] In the embodiment of the application, the number of the processor 1, the communication interface 2, the memory 3 and the communication bus 4 is at least one, and the processor 1, the communication interface 2 and the memory 3 complete the communication among each other through the communication bus 4.
[0276] The processor 1 can be a central processing unit (CPU), or an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement one or more embodiments of the present application.
[0277] The memory 3 can include a high-speed RAM memory, and can also include a non-volatile memory, such as at least one disk memory.
[0278] The memory stores a program, and the processor can invoke the program stored in the memory, and the program is used to implement each processing flow in the foregoing gateway load balancing control scheme.
[0279] The application further provides a readable storage medium, which can store a program suitable for processor execution, and the program is used to implement each processing flow in the foregoing gateway load balancing control scheme.
[0280] Finally, it needs to be noted that, in this document, the relationship terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or sequence between the entities or operations. Moreover, the terms "include", "contain" or any other variants thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed or inherent to such process, method, article or device. Without more limitations, the element defined by the statement "including a" does not exclude the presence of another identical element in the process, method, article or device including the element.
[0281] The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the difference from other embodiments, and the same or similar parts between various embodiments can be referred to each other.
[0282] The above description of the disclosed embodiments enables a person skilled in the art to implement or use the present application. Various modifications to the embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. The various embodiments can be combined with each other. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A gateway load balancing control method, characterized by, The application relates to a method for dynamically setting weight values of servers. The application comprises the following steps: According to hardware resource information of each server, initial weight values and alarm threshold values of the servers are set; Residual hardware resource information of each server is dynamically obtained at a preset time interval; According to the residual hardware resource information of each server, a server whose residual hardware resource amount exceeds the alarm threshold value is determined as a first target server; Dynamic weight values of each first target server are calculated; Current weight values of each first target server are obtained by combining the initial weight values and the dynamic weight values of each first target server; The current weight values of each first target server are sorted to obtain a weight sequence; According to the weight sequence and a preset mode, a third target server is determined. The method comprises the following steps: The contribution degrees of each hardware of each server are calculated according to the information of each hardware in each server; The initial weight values of each server are determined according to the contribution degrees of each hardware of each server; Alarm factors corresponding to each hardware of each server are determined according to the initial weight values of each server and the contribution degrees of each hardware; 2. The method of claim 1, wherein, Alarm threshold values of each server are determined according to the alarm factors corresponding to each hardware of each server. The method comprises the following steps: All servers are registered for service; Second target servers that have completed service registration are determined; 3. The method of claim 2, wherein, Residual hardware resource information of the second target servers is determined at the preset time interval. The method comprises the following steps: It is judged whether there is a second target server whose residual hardware resource information exceeds the alarm threshold value of the corresponding second target server; If there is a second target server whose residual hardware resource information exceeds the alarm threshold value of the corresponding second target server, the second target server is determined as the first target server; 4. The method of claim 1, wherein, If there is a second target server whose residual hardware resource information is lower than the alarm threshold value of the corresponding second target server, the second target server is determined as not processing the current access request. The method comprises the following steps: The initial weight values and the dynamic weight values corresponding to each first target server are determined; The initial weight values and the dynamic weight values corresponding to each first target server are determined; According to the initial weight value and the dynamic weight value corresponding to each first target server, the current weight value of each first target server is determined.
5. The method of claim 1, wherein, The current weight values of each first target server are sorted to obtain a weight sequence, including: The current weight values of all first target servers are obtained to obtain a weight set; The current weight values of all first target servers in the weight set are sorted to obtain the weight sequence.
6. The method of claim 1, wherein, According to the weight sequence and a preset manner, a third target server is determined, including: According to the weight sequence, the first target server with the highest current weight value in the weight sequence is selected; The first target server with the highest current weight value in the weight sequence is selected and determined as the third target server.
7. A gateway load balancing apparatus, characterized by, Including: The server setting module is configured to set initial weight values and alarm thresholds of each server according to hardware resource information of each server; The information acquisition module is configured to dynamically acquire residual hardware resource information of each server at preset time intervals; The first target server determination module is configured to determine, according to the residual hardware resource information of each server, the server whose hardware resource residual amount exceeds the alarm threshold as a first target server; The dynamic weight value calculation module is configured to calculate a dynamic weight value of each first target server; The current weight value calculation module is configured to obtain a current weight value of each first target server by combining the initial weight value and the dynamic weight value of each first target server; The weight sequence acquisition module is configured to sort the current weight values of each first target server to obtain a weight sequence; The third target server determination module is configured to determine a third target server according to the weight sequence and a preset manner; The server setting module is configured to acquire and determine, according to information of each hardware in each server, a contribution degree of each hardware of each server; and determine, according to the contribution degree of each hardware of each server, an initial weight value of each server; According to the initial weight value of each server and the contribution degree of each hardware, an alarm factor corresponding to each hardware of each server is determined; and according to the alarm factor corresponding to each hardware of each server, an alarm threshold of each server is determined.
8. A gateway load balancing device, characterized by Including: One or more processors and a memory; The memory stores computer readable instructions, which are executed by the one or more processors to implement the steps of the gateway load balancing control method of any one of claims 1 to 6.
9. A readable storage medium characterized by: The readable storage medium stores computer readable instructions, which are executed by one or more processors to cause the one or more processors to implement the steps of the gateway load balancing control method of any one of claims 1 to 6.
Citation Information
Patent Citations
System with Nginx load balancing technology
CN113110933A