Load Balancing System, Method, Device and Storage Medium for Server Cluster
A separate strategy adjustment server in server clusters dynamically adjusts load balancing based on server parameters, reducing complexity and enhancing stability and efficiency by bypassing strategy servers, addressing the limitations of existing load balancing methods.
Patent Information
- Application Number
- CN201911025029.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-10-25
- Publication Date
- 2025-07-15
- Estimated Expiration
- 2039-10-25
AI Technical Summary
In the prior art, the load balancing strategy of server clusters is complex and depends on the developer's technical level, and the load balancing server downtime causes the server cluster to be unavailable, which is relatively high.
Introduce an independent policy adjustment server in the load balancing system, collect the operating parameters and performance parameters of the business server through bypass monitoring, dynamically adjust the load balancing strategy, reduce the business complexity of the load balancing server, and update the task distribution service weight when needed.
It realizes dynamic load balancing more efficiently without affecting the overall function of the server cluster, reduces the performance loss of the load balancing server, and improves the service stability and external request processing efficiency of the server cluster.
Smart Images

Figure CN112711479B_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present invention relate to Internet technologies, and in particular, to a load balancing system, method, device, and storage medium for a server cluster. Background Art
[0002] With the development of Internet technologies, it has become a general trend to use a server cluster as a carrier for services. A server cluster is a collection of business servers that work together to provide a more stable, efficient, and scalable service platform than a single server. A server cluster is generally composed of two or more business servers, and each business server is called a cluster node, and the cluster nodes can communicate with each other. The ideal state of cluster services is that when a node fails, another node in the cluster can automatically take over the resources of the failed node, so as to ensure the persistent and uninterrupted operation of the service. However, cluster servers are restricted by hardware resources such as CPUs, memory, network cards, etc., and some unpredictable software problems, which may cause the traffic that each business server in the cluster can withstand to be different. Therefore, it is necessary to set a load balancing strategy in the server cluster to ensure the efficient operation of the server cluster.
[0003] The existing solutions for load balancing in a server cluster mainly include: First, set a fixed priority order and task volume for each business server in the cluster, so that the load balancing server can distribute external requests to each business server according to the priority order and task volume; Second, monitor the cluster performance and the performance of business servers, and reduce the traffic or remove low-performance business servers manually; Third, set a controller in the load balancing server, and various queues are set in the controller to receive external requests, and collect the response time of each business server in the cluster to requests or other performance detection data through the data flow situation in these queues. Furthermore, the load balancing server performs load balancing control on each business server according to the response time or other performance detection data, and distributes the external requests in the controller to the corresponding business server. Among the above three solutions, the third solution is the current mainstream load balancing strategy.
[0004] In the process of implementing the present invention, the inventors found that there are at least the following problems in the prior art: Due to the complexity of the controller and queues in the load balancing strategy, the implementation logic of the load balancing server is too complex and overly dependent on the technical level of developers; In addition, external requests must be processed through the serial path of the controller, the load balancing server, and the business server. If the load balancing server fails due to its own performance problems, the entire server cluster will become unavailable, resulting in a relatively high risk for the server cluster. Summary of the Invention
[0005] An embodiment of the present invention provides a load balancing system, method, device, and storage medium for a server cluster to achieve more efficient load balancing of the server cluster and improve the service stability of the server cluster.
[0006] In a first aspect, an embodiment of the present invention provides a load balancing system for a server cluster. The system includes a policy adjustment server, a load balancing server, and at least one service server that are communicatively connected to each other.
[0007] The load balancing server is configured to receive external requests, distribute the external requests according to the task distribution service weights of the service servers, and update the task distribution service weights of at least one of the service servers according to the policy adjustment request when detecting the policy adjustment request sent by the policy adjustment server.
[0008] The service server is configured to process the external requests and collect server operation parameters and / or server performance parameters at a preset frequency.
[0009] The policy adjustment server is configured to receive the server operation parameters and / or the server performance parameters reported by each service server, determine the current service weights of the service servers according to the server operation parameters and / or the server performance parameters, and send the policy adjustment request to the load balancing server when determining that the current service weights meet the load balancing policy adjustment conditions.
[0010] In a second aspect, an embodiment of the present invention further provides a load balancing method for a server cluster. The method includes:
[0011] Receiving the server operation parameters and / or the server performance parameters reported by each service server, and determining the current service weights of the service servers according to the server operation parameters and / or the server performance parameters.
[0012] When it is determined that the current service weights meet the load balancing policy adjustment conditions, sending a policy adjustment request to the load balancing server so that the load balancing server updates the task distribution service weights of at least one of the service servers according to the policy adjustment request.
[0013] In a third aspect, an embodiment of the present invention further provides a load balancing device for a server cluster. The device includes:
[0014] A current service weight determination module, configured to receive the server operation parameters and / or the server performance parameters reported by each service server, and determine the current service weights of the service servers according to the server operation parameters and / or the server performance parameters.
[0015] A policy adjustment request sending module, configured to send a policy adjustment request to a load balancing server when it is determined that the current service weight meets the load balancing policy adjustment condition, so that the load balancing server updates the task distribution service weight of at least one of the service servers according to the policy adjustment request.
[0016] Fourthly, an embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it implements the load balancing method of the server cluster provided in any embodiment of the present invention.
[0017] In the embodiment of the present invention, an independent policy adjustment server is additionally provided outside the load balancing server and multiple service servers, which is used to receive the server operation parameters and / or server performance parameters reported by each service server, and determine the current service weight of each service server according to each server operation parameter and / or each server performance parameter, and when it is determined that the current service weight meets the load balancing policy adjustment condition, send a policy adjustment request to the load balancing server, so that the load balancing server updates the task distribution service weight of at least one service server according to the policy adjustment request. It realizes collecting the server operation parameters and / or server performance parameters of each service server by means of bypass monitoring, and then determining the current service weight of each service server, and prompting the load balancing server to adjust the load balancing policy when it is determined that the load balancing policy needs to be adjusted. On the one hand, without affecting the overall function of the server cluster, it more efficiently dynamically balances the load of the server cluster, reduces the business complexity of the load balancing server, and to a certain extent reduces the performance loss of the load balancing server, thereby improving the service stability of the server cluster; on the other hand, external requests only need to flow between the load balancing server and the service server, avoiding the flow of external requests in the policy adjustment server, and improving the processing efficiency of external requests to a certain extent. Description of the Drawings
[0018] Figure 1 It is a schematic structural diagram of a load balancing system of a server cluster in Embodiment 1 of the present invention;
[0019] Figure 2 It is a schematic structural diagram of a load balancing system of a server cluster in Embodiment 2 of the present invention;
[0020] Figure 3 It is a flowchart of a load balancing method of a server cluster in Embodiment 3 of the present invention;
[0021] Figure 4 It is a schematic structural diagram of a load balancing device of a server cluster in Embodiment 4 of the present invention. Detailed implementation manners
[0022] The present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It can be understood that the specific embodiments described herein are only used to explain the present invention, rather than limiting the present invention. In addition, it should be noted that for the sake of description, only parts related to the present invention rather than all structures are shown in the accompanying drawings.
[0023] Embodiment 1
[0024] This embodiment provides a load balancing system for a server cluster. Refer to Figure 1 , the system includes: a policy adjustment server 130, a load balancing server 110, and at least one service server 120 that are communicatively connected to each other;
[0025] The load balancing server 110 is configured to receive external requests, distribute the external requests according to the task distribution service weights of the service servers 120, and update the task distribution service weights of at least one service server 120 according to the policy adjustment requests when detecting the policy adjustment requests sent by the policy adjustment server 130;
[0026] The service server 120 is configured to process external requests and collect server operation parameters and / or server performance parameters at a preset frequency;
[0027] The policy adjustment server 130 is configured to receive the server operation parameters and / or server performance parameters reported by each service server 120, determine the current service weights of the service servers 120 according to the server operation parameters and / or the server performance parameters, and send a policy adjustment request to the load balancing server 110 when determining that the current service weights meet the load balancing policy adjustment conditions.
[0028] Among them, the external request is a service processing request sent by a device outside the server cluster, which needs to be processed by using the corresponding service in the server cluster. The task distribution service weight is the weight value corresponding to each service server stored in the load balancing server, which is used to measure the service capabilities of the service servers, such as performance and load conditions, etc., so that the load balancing server can reasonably distribute the received external requests according to the task distribution service weights, and promote the load balancing of the entire server cluster. The policy adjustment request is a request used to instruct the load balancing server to adjust the load balancing policy, which may carry the identifier of the service server whose task distribution service weight needs to be adjusted and its adjusted weight value, etc.
[0029] The preset frequency is the data acquisition frequency set in advance, which can be empirically set according to the adjustment granularity of the load balancing policy. For example, if the business requirement emphasizes the timeliness of load balancing policy adjustment, then the preset frequency is high. Server operation parameters refer to the parameters representing the operation state of the business server. Server performance parameters refer to the parameters representing the performance of the business server. Exemplarily, the server operation parameters include at least one of the central processing unit usage rate (i.e., CPU usage rate), memory usage rate, central processing unit load (i.e., CPU load), transmission control protocol connection number (i.e., TCP connection number), and the number of threads. The server performance parameters include response time and / or service availability rate. Here, the response time (RT) refers to the time when the system responds to a request, specifically, the average time of all functions of the system or the maximum response time of all functions. The service availability rate refers to the proportion of services available in the business server. For example, if the original availability rate of the business server is 100%, and due to various errors, 10% of the service duration in the business server is unavailable, then the service availability rate of the business server is 90%.
[0030] The current service weight refers to the latest weight value of each business server in the policy adjustment server. The load balancing policy adjustment condition is pre-set and used to determine whether the load balancing policy needs to be adjusted. For example, it can be that the current service weight of the business server has changed relative to its previous service weight (i.e., the stored service weight), or the change value reaches a pre-set weight value change threshold (i.e., the preset weight difference), etc.
[0031] In the embodiment of the present invention, the load balancing policy of the server cluster is to perform load balancing according to the service weights of the business servers. On this basis, the operation process of the load balancing system of the server cluster in this embodiment is as follows: After receiving an external request, the load balancing server 110 determines which business server (i.e., the target business server) the external request should be distributed to according to the numerical values of the task distribution service weights of each business server 120 stored therein, and then distributes the external request to the target business server. After receiving the external request, the target business server processes it and feeds back the processing result to the load balancing server 110. The load balancing server 110 and each business server 120 continuously process the incoming external requests through the above process. During the transfer and processing of the above external requests, each business server 120 also collects its corresponding server operation parameters and / or server performance parameters at a preset frequency and reports them to the policy adjustment server 130. The policy adjustment server 130 will regularly receive the above data sent by each business server 120 and calculate the current service weight of the corresponding business server 120 according to the server operation parameters and / or server performance parameters. Then, the policy adjustment server 130 determines whether it is necessary to adjust the load balancing policy according to the judgment method corresponding to the load balancing policy adjustment condition. If adjustment is required, a policy adjustment request will be generated according to the business server identifier and its corresponding current service weight and sent to the load balancing server 110. During the process of distributing external requests, the load balancing server 110 also monitors whether it receives a policy adjustment request sent by the policy adjustment server 130. If the load balancing server 110 monitors this request, it adjusts the task distribution service weights corresponding to each business server 120 in the load balancing server 110 according to the information in the policy adjustment request, completing the adjustment of the load balancing policy.
[0032] Exemplarily, the policy adjustment server is specifically configured to: determine the absolute value of the weight difference between the current service weight and the stored service weight; if the absolute value of the weight difference is greater than a preset weight difference, send a policy adjustment request to the load balancing server through the communication unit; and update the stored service weight with the current service weight. Among them, the preset weight difference is also a value empirically set according to the adjustment granularity of the load balancing policy. For example, it can be 10-20. If the adjustment granularity is small, then the preset weight difference is also small.
[0033] During the operation of the above load balancing system, the policy adjustment server needs to determine whether the current service weight meets the load balancing policy adjustment condition. When the load balancing policy adjustment condition is that the weight change value reaches the preset weight difference, the judgment process is as follows: calculate the absolute value of the weight difference between the current service weight of the business server and the stored service weight. Then, compare the absolute value of the weight difference with the preset weight difference. If the absolute value of the weight difference is less than or equal to the preset weight difference, there is no need to adjust the task distribution service weight of this business server. If the absolute value of the weight difference is greater than the preset weight difference, it is necessary to adjust the task distribution service weight of this business server. Then, the business server identifier and the corresponding current service weight are used to generate a policy adjustment request. Processing the current service weights of each business server one by one according to the above process, the final policy adjustment request can be obtained. Then, send this policy adjustment request to the load balancing server 110. In this process, whether the current service weight meets the load balancing policy adjustment condition or not, the policy adjustment server 130 needs to replace the corresponding stored service weight with the current service weight of each business server 120 for subsequent load balancing policy increase judgment. The advantage of this setting is that by setting the preset weight difference, it is possible to more conveniently and reasonably control the frequency of load balancing policy adjustment, thereby further improving the load balancing efficiency.
[0034] Exemplarily, the load balancing server is specifically used for: determining the initial service weight of the corresponding business server according to the number of central processing unit cores of each business server. According to the above description, the distribution basis of the load balancing server 120 for external requests is the task distribution service weights of each business server. Then, when the load balancing system runs for the first time, it is necessary to initialize the task distribution service weights of each business server. The initialization method can be to set the task distribution service weights of each business server to the same value. However, in order to further improve the overall service performance of the server cluster, in this embodiment, on the basis of the task distribution service weights with the same value for each business server, the task distribution service weights are further fine-tuned according to the number of central processing unit cores (i.e., CPU cores) of each business server. For example, the initial service weight value of the business server with more CPU cores is larger, while the initial service weight value of the business server with fewer CPU cores is smaller.
[0035] The above load balancing server can be a backend server or dedicated hardware, such as a load balancing device F5, etc. Similarly, the policy adjustment server can be a server or other computer devices with data operation functions, etc.
[0036] The load balancing system of the server cluster in this embodiment, by additionally setting up an independent policy adjustment server outside the load balancing server and multiple business servers, is used to receive the server operation parameters and / or server performance parameters reported by each business server, and determine the current service weights of each business server based on the server operation parameters and / or server performance parameters of each server. When it is determined that the current service weights meet the load balancing policy adjustment conditions, a policy adjustment request is sent to the load balancing server, so that the load balancing server updates the task distribution service weights of at least one business server according to the policy adjustment request. It realizes collecting the server operation parameters and / or server performance parameters of each business server by means of bypass monitoring, and then determining the current service weights of each business server, and prompting the load balancing server to adjust the load balancing policy when it is determined that the load balancing policy needs to be adjusted. On the one hand, without affecting the overall function of the server cluster, it can more efficiently and dynamically balance the load of the server cluster, reduce the business complexity of the load balancing server, and reduce the performance loss of the load balancing server to a certain extent, thus improving the service stability of the server cluster. On the other hand, external requests only need to flow between the load balancing server and the business server, avoiding the flow of external requests in the policy adjustment server, and improving the processing efficiency of external requests to a certain extent.
[0037] Embodiment 2
[0038] Based on the above Embodiment 1, this embodiment further optimizes the internal structures of the "load balancing server", "business server" and "policy adjustment server". The explanations of the same or corresponding terms as those in the above embodiment will not be repeated here.
[0039] See Figure 2 , the load balancing system of the server cluster provided in this embodiment includes: a policy adjustment server 130, a load balancing server 110 and at least one business server 120 that are communicatively connected to each other.
[0040] The load balancing server 110 includes a task distribution service weight management unit 111 and a request distribution unit 112. The task distribution service weight management unit 111 is used to store the task distribution service weights corresponding to each business server 120, and update the task distribution service weights of at least one business server 120 according to the policy adjustment request when detecting the policy adjustment request sent by the policy adjustment server 130. The request distribution unit 112 is used to receive external requests and distribute external requests according to the task distribution service weights of each business server 120.
[0041] The service server 120 includes a service unit 121 and an asynchronous data collection unit 122. Among them, the service unit 121 is used to receive and process external requests sent by the load balancing server 110. The service unit 121 is a synchronous service, and provides real services externally through the HTTP interface or the TCP / UDP interface. The asynchronous data collection unit 122 is used to collect server operation parameters and / or server performance parameters at a preset frequency. The asynchronous data collection unit 122 collects relevant data at a preset frequency without affecting the service unit 121. For example, it can obtain information through logs and system services, and then transmit the collected server operation parameters and / or server performance parameters to the processing unit 132 in the policy adjustment server. There are various ways to implement data collection, which can be an open-source framework or a self-developed tool, or a self-modified version based on an open-source framework.
[0042] The policy adjustment server 130 includes a communication unit 131 and a processing unit 132. The communication unit 131 is used to receive the server operation parameters and / or server performance parameters reported by the asynchronous data collection units 122 in each service server 120. The processing unit 132 is used to determine the current service weight of the service server 120 based on the preset operation weights corresponding to the server operation parameters of the service server 120 and the preset performance weights corresponding to the server performance parameters respectively; and, when it is determined that the current service weight meets the load balancing policy adjustment condition, send a policy adjustment request to the load balancing server 110 through the communication unit 131.
[0043] Among them, the preset operation weight is a pre-set weight value, which is used to represent the proportion of the server operation parameters in determining the current service weight. If there are multiple server operation parameters, corresponding preset operation weights can be set for each server operation parameter. The preset performance weight is a pre-set weight value, which is used to represent the proportion of the server performance parameters in determining the current service weight. If there are multiple server performance parameters, corresponding preset performance weights can be set for each server performance parameter.
[0044] In the processing unit 132, a weight calculation formula for calculating the current service weight using server performance parameters and / or server operation parameters can be preset in advance, and then a suitable weight calculation formula is selected for weight calculation. The weight calculation formula can include all server performance parameters and server operation parameters, or only some of them. The weight calculation formula can be a formula shared by all services, or a corresponding formula can be set for each service. The form of each weight calculation formula can be set according to the actual situation, but it should at least include one parameter and its corresponding weight for weighted operation of relevant parameters. For example, the weight calculation formula for calculating the current service weight can be set as follows:
[0045] Current service weight = 100 / (CPU usage weight * CPU usage rate + memory weight * memory usage rate + CPU load weight * CPU load + TCP connection number weight * TCP connection number + response time weight * response time + service availability weight * (1 - service availability)). The CPU usage rate, memory usage rate, CPU load, and TCP connection number in this formula are server operation parameters. Correspondingly, the CPU usage weight, memory weight, CPU load weight, and TCP connection number weight are preset operation weights. The response time and service availability are server performance parameters, while the response time weight and service availability weight are preset performance weights.
[0046] Exemplarily, the processing unit 132 is specifically configured to: determine a service weight determination algorithm corresponding to each service interface identifier according to multiple service interface identifiers corresponding to the service server 120; use the service weight determination algorithm corresponding to each service interface, each server operation parameter, each preset operation weight, each server performance parameter, and each preset performance weight to determine the interface service weight corresponding to each service interface; and determine the current service weight of the service server according to each interface service weight.
[0047] Among them, the service interface identifier refers to the identifier of the service interface, which is used to uniquely identify a service interface. The service weight determination algorithm is the weight calculation formula. The interface service weight is the service weight corresponding to a service interface.
[0048] When there are multiple service interfaces in the service server 120 and the business requirement emphasizes the precision of the current service weight, when determining the current service weight, the processing unit 132 may first calculate the interface service weight corresponding to each service interface, and then use the interface service weights of each interface to calculate the current service weight corresponding to the entire service server 120. Specifically, when implemented, the processing unit 132 first obtains the service weight determination algorithm corresponding to the corresponding service interface from the configuration file according to each service interface identifier. Then, each server operation parameter and each preset operation weight that are irrelevant to the service interface, as well as each server performance parameter and each preset performance weight corresponding to the service interface, are substituted into the corresponding service weight determination algorithm to calculate the interface service weight corresponding to each service interface. Finally, according to the proportion of each service interface in the entire service server, a weighted operation is performed on the interface service weights of each interface to obtain the current service weight of the service server. The advantage of such a setting is that the number of parameters for determining the current service weight is increased, so that the adjustment of the weight can be controlled with a finer granularity, and then the load balancing can be controlled more precisely, achieving the technical effect of fully utilizing the hardware resources of the service server and reducing costs.
[0049] Exemplarily, the processing unit is specifically configured to: determine each comprehensive performance parameter of the service server according to each server performance parameter corresponding to each service interface identifier corresponding to the service server; and determine the current service weight of the service server according to each comprehensive performance parameter and each preset performance weight.
[0050] When there are multiple service interfaces in the service server 120 and the business requirement emphasizes the determination efficiency of the current service weight, when determining the current service weight, the processing unit 132 may first calculate the comprehensive performance parameter corresponding to each service interface, and then use each comprehensive performance parameter to perform a weighted calculation of the current service weight corresponding to the entire service server 120. Specifically, when implemented, since the server operation parameter is irrelevant to the service interface and is the operation parameter of the entire service server 120, when there are multiple service interfaces, only the server performance parameters related to the service interface, that is, the response time and the service availability rate, can be used to calculate the current service weight. First, the response time and the service availability rate corresponding to each service interface are used to calculate each comprehensive performance parameter corresponding to the service server 120, such as the comprehensive response time and the comprehensive service availability rate. Then, the comprehensive response time, the comprehensive service availability rate, and the preset performance weight are substituted into the service weight determination algorithm corresponding to the service server 120 to calculate the current service weight of the service server 120. The advantage of such a setting is that it can balance the determination precision and the determination efficiency of the current service weight to a certain extent, and thus balance the precision and the efficiency of the load balancing to a certain extent.
[0051] The load - balancing system of the server cluster in this embodiment, by setting the business server as a service unit and an asynchronous data collection unit, can asynchronously collect relevant data for load balancing without affecting the processing efficiency of external requests, thus improving the data collection efficiency. By setting the policy adjustment server as a communication unit and a processing unit, it can improve the interaction efficiency between the policy adjustment server and other servers, as well as the processing efficiency of the load - balancing policy adjustment judgment process, thereby further improving the load - balancing efficiency of the load - balancing system.
[0052] Embodiment III
[0053] The load - balancing method for the server cluster provided in this embodiment is applicable to the dynamic adjustment of the load - balancing policy. This method can be executed by the load - balancing device of the server cluster. This device can be implemented in software and / or hardware, and can be integrated into an electronic device with data operation functions, such as a laptop, a desktop computer, or a server, etc. Refer to Figure 3 , the method of this embodiment specifically includes the following steps:
[0054] S110. Receive the server operation parameters and / or server performance parameters reported by each business server, and determine the current service weights of each business server according to the server operation parameters and / or server performance parameters.
[0055] Exemplarily, the server operation parameters include at least one of the central - processing - unit usage rate, memory usage rate, central - processing - unit load, Transmission Control Protocol connection number, and number of threads. The server performance parameters include response time and / or service availability rate.
[0056] Exemplarily, determining the current service weights of each business server according to the server operation parameters and / or server performance parameters includes:
[0057] Determine the service - weight determination algorithm corresponding to each service - interface identifier according to the multiple service - interface identifiers corresponding to the business server;
[0058] Use the service - weight determination algorithm corresponding to each service interface, the server operation parameters, the preset operation weights, the server performance parameters, and the preset performance weights to determine the interface service weights corresponding to each service interface;
[0059] Determine the current service weights of the business server according to the interface service weights.
[0060] Exemplarily, determining the current service weights of each business server according to the server operation parameters and / or server performance parameters includes:
[0061] Determine the comprehensive performance parameters of the service server according to the server performance parameters corresponding to each service interface identifier of the service server;
[0062] Determine the current service weight of the service server according to the comprehensive performance parameters and the preset performance weights.
[0063] S120. When it is determined that the current service weight meets the load balancing policy adjustment condition, send a policy adjustment request to the load balancing server, so that the load balancing server updates the task distribution service weight of at least one service server according to the policy adjustment request.
[0064] Exemplarily, determining that the current service weight meets the load balancing policy adjustment condition includes:
[0065] Determine the absolute value of the weight difference between the current service weight and the storage service weight;
[0066] If the absolute value of the weight difference is greater than the preset weight difference, it is determined that the current service weight meets the load balancing policy adjustment condition, and a policy adjustment request is sent to the load balancing server;
[0067] Update the storage service weight using the current service weight.
[0068] The technical solution of this embodiment receives the server operation parameters and / or server performance parameters reported by each service server, and determines the current service weight of each service server according to the server operation parameters and / or server performance parameters of each server; when it is determined that the current service weight meets the load balancing policy adjustment condition, a policy adjustment request is sent to the load balancing server, so that the load balancing server updates the task distribution service weight of at least one service server according to the policy adjustment request. It realizes collecting the server operation parameters and / or server performance parameters of each service server by means of bypass monitoring, and then determining the current service weight of each service server, and prompting the load balancing server to adjust the load balancing policy when it is determined that the load balancing policy needs to be adjusted. On the one hand, without affecting the overall function of the server cluster, it more efficiently dynamically balances the load of the server cluster, reduces the business complexity of the load balancing server, and reduces the performance loss of the load balancing server to a certain extent, thereby improving the service stability of the server cluster; on the other hand, external requests only need to flow between the load balancing server and the service server, avoiding the flow of external requests in the policy adjustment server, and improving the processing efficiency of external requests to a certain extent.
[0069] Embodiment 4
[0070] This embodiment provides a load balancing device for a server cluster. Refer to Figure 4 , the device specifically includes:
[0071] The current service weight determination module 410 is configured to receive the server operation parameters and / or server performance parameters reported by each business server, and determine the current service weight of each business server according to the server operation parameters and / or server performance parameters of each server;
[0072] The policy adjustment request sending module 420 is configured to send a policy adjustment request to the load balancing server when it is determined that the current service weight meets the load balancing policy adjustment condition, so that the load balancing server updates the task distribution service weight of at least one business server according to the policy adjustment request.
[0073] Optionally, the current service weight determination module 410 is specifically configured to:
[0074] Determine the service weight determination algorithm corresponding to each service interface identifier according to the multiple service interface identifiers corresponding to the business server;
[0075] Use the service weight determination algorithm corresponding to each service interface, the server operation parameters of each server, the preset operation weights of each server, the server performance parameters of each server, and the preset performance weights of each server to determine the interface service weight corresponding to each service interface;
[0076] Determine the current service weight of the business server according to the interface service weights of each interface.
[0077] Alternatively, the current service weight determination module 410 is specifically configured to:
[0078] Determine the comprehensive performance parameters of the business server according to the server performance parameters corresponding to each service interface identifier corresponding to the business server;
[0079] Determine the current service weight of the business server according to the comprehensive performance parameters and the preset performance weights of each server.
[0080] Optionally, the policy adjustment request sending module 420 is specifically configured to:
[0081] Determine the absolute value of the weight difference between the current service weight and the stored service weight;
[0082] If the absolute value of the weight difference is greater than the preset weight difference, it is determined that the current service weight meets the load balancing policy adjustment condition, and a policy adjustment request is sent to the load balancing server;
[0083] Update the stored service weight using the current service weight.
[0084] Optionally, the server operation parameters include at least one of the central processing unit usage rate, memory usage rate, central processing unit load, transmission control protocol connection number, and number of threads, and the server performance parameters include response time and / or service availability rate.
[0085] Through the load balancing device of a server cluster according to Embodiment 4 of the present invention, it is realized to collect the server operation parameters and / or the server performance parameters of each business server in a bypass monitoring manner, and then determine the current service weight of each business server, and prompt the load balancing server to adjust the load balancing strategy when it is judged that the load balancing strategy needs to be adjusted. On the one hand, without affecting the overall function of the server cluster, the load of the server cluster is more efficiently and dynamically balanced, and the business complexity of the load balancing server is also reduced, and the performance loss of the load balancing server is reduced to a certain extent, thereby improving the service stability of the server cluster; on the other hand, external requests only need to flow between the load balancing server and the business server, avoiding the flow of external requests in the policy adjustment server, and improving the processing efficiency of external requests to a certain extent.
[0086] The load balancing device of the server cluster provided by the embodiments of the present invention can execute the load balancing method of the server cluster provided by any embodiment of the present invention, and has the corresponding functional modules and beneficial effects for executing the method.
[0087] It should be noted that in the embodiments of the above-mentioned load balancing device of the server cluster, the included units and modules are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be realized; in addition, the specific names of the functional units are only for the convenience of mutual distinction and do not limit the protection scope of the present invention.
[0088] Embodiment 5
[0089] This embodiment provides a storage medium containing computer-executable instructions, and the computer-executable instructions are used to execute a load balancing method of a server cluster when executed by a computer processor. The method includes:
[0090] Receiving the server operation parameters and / or the server performance parameters reported by each business server, and determining the current service weight of each business server according to the server operation parameters and / or the server performance parameters of each server;
[0091] When it is judged that the current service weight meets the load balancing strategy adjustment condition, sending a strategy adjustment request to the load balancing server, so that the load balancing server updates the task distribution service weight of at least one business server according to the strategy adjustment request.
[0092] Of course, the computer-executable instructions of the storage medium containing computer-executable instructions provided by the embodiments of the present invention are not limited to the above method operations, and can also execute the related operations in the load balancing method of the server cluster provided by any embodiment of the present invention.
[0093] Through the above description of the embodiments, those skilled in the art can clearly understand that the present invention can be implemented by means of software and necessary general hardware. Of course, it can also be implemented by hardware, but in many cases the former is a better implementation. Based on such an understanding, the technical solution of the present invention, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as a floppy disk, read-only memory (ROM), random access memory (RAM), flash memory (FLASH), hard disk, or optical disc of a computer, etc., and includes several instructions to enable an electronic device (which can be a personal computer, server, or network device, etc.) to execute the load balancing method of the server cluster provided by each embodiment of the present invention.
[0094] Note that the above is only the preferred embodiment of the present invention and the technical principles applied. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein. Various obvious changes, re-adjustments, and substitutions can be made by those skilled in the art without departing from the protection scope of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments. Without departing from the concept of the present invention, it can also include more other equivalent embodiments, and the scope of the present invention is determined by the scope of the appended claims.
Claims
1. A load balancing system for a server cluster, characterized in that The system includes a policy adjustment server, a load balancing server, and at least one business server that are communicatively connected to each other; The load balancing server is configured to receive external requests, distribute the external requests according to the task distribution service weights of the business servers, and update the task distribution service weights of at least one of the business servers according to the policy adjustment requests when detecting the policy adjustment requests sent by the policy adjustment server; The business server is configured to process the external requests and collect server operation parameters and / or server performance parameters at a preset frequency; The policy adjustment server is configured to receive the server operation parameters and / or the server performance parameters reported by each of the business servers, determine the current service weights of the business servers according to the server operation parameters and / or the server performance parameters, and send the policy adjustment requests to the load balancing server when determining that the current service weights meet the load balancing policy adjustment conditions; Wherein, the policy adjustment server includes: A communication unit configured to receive the server operation parameters and / or the server performance parameters reported by each of the business servers; A processing unit configured to determine the current service weights of the business servers according to the server operation parameters corresponding to the business servers and the preset operation weights respectively corresponding to the server operation parameters, and / or the server performance parameters and the preset performance weights respectively corresponding to the server performance parameters; and, when determining that the current service weights meet the load balancing policy adjustment conditions, send the policy adjustment requests to the load balancing server through the communication unit; Wherein, the processing unit is specifically configured to: Determine the service weight determination algorithms corresponding to the service interface identifiers according to the multiple service interface identifiers corresponding to the business server, wherein the business server includes multiple service interfaces, and each service interface identifier uniquely identifies a service interface; Use the service weight determination algorithms corresponding to each service interface, the server operation parameters, the preset operation weights, the server performance parameters, and the preset performance weights to determine the interface service weights corresponding to each service interface; Determine the current service weights of the business servers according to the interface service weights; Alternatively, the processing unit is specifically configured to: Determine the comprehensive performance parameters of the business server according to the server performance parameters corresponding to each service interface identifier corresponding to the business server; Determine the current service weights of the business servers according to the comprehensive performance parameters and the preset performance weights.
2. The system according to claim 1, wherein The policy adjustment server is specifically configured to: Determine the absolute value of the weight difference between the current service weight and the stored service weight; If the absolute value of the weight difference is greater than the preset weight difference, send the policy adjustment request to the load balancing server; Update the stored service weight with the current service weight.
3. The system according to claim 1, wherein The server operation parameters include at least one of the central processing unit (CPU) utilization rate, memory utilization rate, CPU load, Transmission Control Protocol (TCP) connection count, and thread count, and the server performance parameters include response time and / or service availability rate.
4. The system according to any one of claims 1-3, characterized in that, The load balancing server is specifically configured to: Determine the initial service weight of each corresponding service server according to the number of CPU cores of each service server.
5. A load balancing method for a server cluster, characterized in that, including: Receive the server operation parameters and / or server performance parameters reported by each service server, and determine the current service weight of each service server according to each of the server operation parameters and / or each of the server performance parameters; When it is determined that the current service weight meets the load balancing policy adjustment condition, send a policy adjustment request to the load balancing server, so that the load balancing server updates the task distribution service weight of at least one of the service servers according to the policy adjustment request; Wherein, determining the current service weight of each service server according to each of the server operation parameters and / or each of the server performance parameters includes: Determine the service weight determination algorithm corresponding to each service interface identifier according to the multiple service interface identifiers corresponding to the service server, wherein the service server includes multiple service interfaces, and each service interface identifier uniquely identifies a service interface; Use the service weight determination algorithm corresponding to each service interface, each of the server operation parameters, each preset operation weight, each of the server performance parameters, and each preset performance weight to determine the interface service weight corresponding to each service interface; Determine the current service weight of the service server according to each interface service weight; Alternatively, determining the current service weight of each service server according to each of the server operation parameters and / or each of the server performance parameters includes: Determine the comprehensive performance parameters of the service server according to each of the server performance parameters corresponding to each service interface identifier corresponding to the service server; Determine the current service weight of the service server according to each of the comprehensive performance parameters and each preset performance weight.
6. A load balancing device for a server cluster, characterized in that, including: A current service weight determination module, configured to receive the server operation parameters and / or server performance parameters reported by each service server, and determine the current service weight of each service server according to each of the server operation parameters and / or each of the server performance parameters; A policy adjustment request sending module, configured to send a policy adjustment request to the load balancing server when it is determined that the current service weight meets the load balancing policy adjustment condition, so that the load balancing server updates the task distribution service weight of at least one of the service servers according to the policy adjustment request; Wherein, the current service weight determination module is specifically configured to: Determine the service weight determination algorithm corresponding to each service interface identifier according to the multiple service interface identifiers corresponding to the service server, wherein the service server includes multiple service interfaces, and each service interface identifier uniquely identifies a service interface; Determine the interface service weights corresponding to each of the service interfaces by using the service weight determination algorithms corresponding to each service interface, the operating parameters of each of the servers, the preset operating weights, the performance parameters of each of the servers, and the preset performance weights; Determine the current service weight of the business server according to the interface service weights; Alternatively, the current service weight determination module is specifically configured to: Determine the comprehensive performance parameters of the business server according to the performance parameters of each of the servers corresponding to each service interface identifier corresponding to the business server; Determine the current service weight of the business server according to the comprehensive performance parameters and the preset performance weights.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the load balancing method of the server cluster as described in claim 5.
Citation Information
Patent Citations
Business distribution method, system and related device
CN105812437A