Server load balancing method and device, equipment and medium
By predicting and adjusting the server load balancing strategy, the problems of load imbalance and inflexibility in the existing technology are solved, and adaptive load balancing allocation and fast response are achieved.
Patent Information
- Application Number
- CN202411498013.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-24
- Publication Date
- 2025-02-18
AI Technical Summary
Existing server load balancing technologies are difficult to quickly adapt to sudden traffic surges or changes in resource demand, and cannot intelligently adapt to long-term load mode changes, resulting in unbalanced load allocation.
By obtaining the reference load balancing policies of multiple servers to be load balancing, predicting their allocated operating data to determine the load balancing prediction results. If the prediction result is greater than the preset threshold, a short-term and/or long-term load balancing adjustment strategy is determined, the reference strategy is adjusted, and the adjusted strategy is shared to the global network.
Adaptive load balancing allocation is realized, reducing the idle time and resource waste of servers, significantly improving the server's response speed in high concurrency scenarios, reducing the queuing time of user requests, and quickly adjusting through multi-node collaboration and information sharing. and recovery.
Smart Images

Figure CN119484540A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a server load balancing method, device, equipment and medium. Background Art
[0002] With the rapid development of big data technology, servers, as data processing devices, need to acquire load balancing technology to ensure the normal operation of big data in the device. Among them, load balancing technology is the technology of distributing the workload to multiple operating units to reduce the burden of a single server. Load balancing can distribute tasks to multiple physical servers through a certain strategy to achieve load balance among different physical servers.
[0003] At present, the load balancing of existing servers usually adopts static load balancing or dynamic load balancing, among which static load balancing is allocated according to pre-defined strategies, such as polling or minimum number of connections, and dynamic load balancing is real-time allocation based on real-time performance indicators of the server, such as CPU, memory, response time, etc. However, the load distribution strategy predefined by static load balancing cannot adapt to the load fluctuations of actual servers, which may cause some servers to be overloaded while other servers are idle. Dynamic load balancing usually relies on historical data or short-term performance monitoring, which is prone to lag effects, cannot quickly adapt to sudden traffic surges or changes in resource demand, cannot intelligently adapt to long-term load pattern changes, and is difficult to achieve optimal performance and resource utilization in complex applications. At the same time, the inability to effectively share and coordinate information between server nodes will lead to problems of unbalanced load distribution. Summary of the invention
[0004] In view of this, the present invention provides a server load balancing method and device method, device, equipment and medium, the main purpose of which is to solve the problem of unbalanced and inflexible load distribution of existing servers.
[0005] According to one aspect of the present invention, a server load balancing method is provided, comprising:
[0006] Obtaining a reference load balancing strategy for multiple servers to be load balanced, and predicting the operating data allocated by the reference load balancing strategy to determine a load balancing prediction result;
[0007] If the load balancing prediction result is greater than a preset prediction threshold, a short-term load balancing adjustment strategy and / or a long-term load balancing adjustment strategy corresponding to the server is determined, and the reference load balancing strategy is adjusted by the short-term load balancing adjustment strategy and / or the long-term load balancing adjustment strategy;
[0008] The adjusted reference load balancing strategy is shared in a global network, and the shared node server is instructed to perform load balancing processing according to the adjusted reference load balancing strategy, wherein the global network includes a plurality of shared node servers.
[0009] Furthermore, predicting the operation data allocated by the reference load balancing strategy to determine the load balancing prediction result includes:
[0010] Acquire real-time operation data and historical operation data of the server allocated according to the reference load balancing strategy;
[0011] The historical operation data is predicted using the long-term prediction model that has completed model training to obtain a long-term load balancing prediction result, and the real-time operation data is predicted using the short-term prediction model that has completed model training to obtain a short-term load balancing prediction result;
[0012] The long-term prediction model is obtained by training the long short-term memory network based on long-term load balancing samples, and the short-term prediction model is obtained by training the long short-term memory network based on short-term load balancing samples.
[0013] Furthermore, before obtaining the reference load balancing strategies of the multiple servers to be load balanced, the method further includes:
[0014] Obtain cluster information, processing demand information, and operation extreme value information of different servers;
[0015] Generate multiple source load balancing strategies corresponding to the cluster information, the processing demand information, and the operation extreme value information according to a preset balancing strategy;
[0016] When a load balancing request instruction is received, a reference load balancing strategy is determined from the source load balancing strategies according to the identity carried in the load balancing request instruction, and sent to the server corresponding to the identity.
[0017] Further, the adjusting the reference load balancing strategy by using the short-term load balancing adjustment strategy and / or the long-term load balancing adjustment strategy includes:
[0018] Analyzing the short-term load item and the short-term adjustment value in the short-term load balancing adjustment strategy, and analyzing the long-term load item and the long-term adjustment value in the long-term load balancing adjustment strategy;
[0019] Adjusting the balancing item and the balancing value in the reference load balancing strategy according to the short-term load item, the short-term load value, the long-term load item, and the long-term load value;
[0020] The adjusting the balancing item and the balancing value in the reference load balancing strategy according to the short-term load item, the short-term load value, the long-term load item, and the long-term load value includes:
[0021] Determine a balancing item with an adjustment priority in the reference load balancing strategy using the short-term load item, and adjust the balancing value of the balancing item using the short-term load value;
[0022] If the adjusted equilibrium value exceeds the load extreme value of the long-term load item, the equilibrium value is adjusted using the long-term load value.
[0023] Furthermore, after sharing the adjusted reference load balancing strategy to the global network, the method further includes:
[0024] In response to the policy update request of the shared node server, the reference load balancing policy is adjusted based on the node update information carried in the policy update request, and fed back to the shared node server.
[0025] Furthermore, after performing load balancing processing on the associated servers of the shared node server based on the updated reference load balancing strategy, the method further includes:
[0026] Determine the shared key item in the shared node server, and retrieve the shared operation data of the shared key item;
[0027] The shared operation data is load tested using a preset detection model to obtain a detection result. The preset detection model is used to characterize a data indicator detection model and a system operation detection model that affect server load operation.
[0028] Furthermore, the method further comprises:
[0029] Analyze the load optimization target corresponding to the detection result, and determine the optimization authority corresponding to the load optimization target, wherein the optimization authority is used to characterize the priority authority for adjusting the optimization target;
[0030] If the optimization authority matches the adjustment authority of the short-term load item and the long-term load item, the load optimization target is adjusted using the short-term load value and the long-term load value of the short-term load item and the long-term load item.
[0031] According to another aspect of the present invention, a server load balancing device is provided, comprising:
[0032] An acquisition module is used to acquire a reference load balancing strategy of multiple servers to be load balanced, and predict the operation data allocated by the reference load balancing strategy to determine a load balancing prediction result;
[0033] An adjustment module, configured to determine a short-term load balancing adjustment strategy and / or a long-term load balancing adjustment strategy corresponding to the server if the load balancing prediction result is greater than a preset prediction threshold, and to adjust the reference load balancing strategy by means of the short-term load balancing adjustment strategy and / or the long-term load balancing adjustment strategy;
[0034] The processing module is used to share the adjusted reference load balancing strategy to the global network, and instruct the shared node server to perform load balancing processing according to the adjusted reference load balancing strategy, and the global network includes multiple shared node servers.
[0035] Furthermore, the acquisition module is specifically used to obtain the real-time operation data and historical operation data allocated by the server according to the reference load balancing strategy; use the long-term prediction model that has completed model training to predict the historical operation data to obtain a long-term load balancing prediction result, and use the short-term prediction model that has completed model training to predict the real-time operation data to obtain a short-term load balancing prediction result; wherein the long-term prediction model is obtained by training a long short-term memory network based on long-term load balancing samples, and the short-term prediction model is obtained by training a long short-term memory network based on short-term load balancing samples.
[0036] Furthermore, the device further comprises: a generating module, a determining module,
[0037] The acquisition module is also used to obtain cluster information, processing demand information, and operation extreme value information of different servers;
[0038] The generating module is used to generate a plurality of source load balancing strategies corresponding to the cluster information, the processing demand information, and the operation extreme value information according to a preset balancing strategy;
[0039] The determination module is used to determine a reference load balancing strategy from the source load balancing strategies according to the identity carried in the load balancing request instruction when receiving the load balancing request instruction, and send it to the server corresponding to the identity.
[0040] Furthermore, the adjustment module is used to parse the short-term load items and short-term adjustment values in the short-term load balancing adjustment strategy, and to parse the long-term load items and long-term adjustment values in the long-term load balancing adjustment strategy; and to adjust the balancing items and balancing values in the reference load balancing strategy according to the short-term load items, the short-term load values, the long-term load items, and the long-term load values; wherein, adjusting the balancing items and balancing values in the reference load balancing strategy according to the short-term load items, the short-term load values, the long-term load items, and the long-term load values includes: using the short-term load items to determine the balancing items with adjustment priority in the reference load balancing strategy, and using the short-term load values to adjust the balancing values of the balancing items; if the adjusted balancing value exceeds the load extreme value of the long-term load item, then using the long-term load value to adjust the balancing value.
[0041] Furthermore, the device also includes:
[0042] The calling module is used to respond to the policy update request of the shared node server, adjust the reference load balancing policy based on the node update information carried in the policy update request, and feed back to the shared node server.
[0043] Furthermore, the device further comprises: a detection module,
[0044] The determination module is further used to determine the shared key item in the shared node server and retrieve the shared operation data of the shared key item;
[0045] The detection module is used to perform load detection on the shared operation data through a preset detection model to obtain a detection result. The preset detection model is used to characterize a data indicator detection model and a system operation detection model that affect the server load operation.
[0046] Furthermore, the device further comprises: a parsing module,
[0047] The parsing module is used to parse the load optimization target corresponding to the detection result, and determine the optimization authority corresponding to the load optimization target, wherein the optimization authority is used to represent the priority authority for adjusting the optimization target;
[0048] The adjustment module is also used to adjust the load optimization target using the short-term load value and long-term load value of the short-term load item and the long-term load item if the optimization authority matches the adjustment authority of the short-term load item and the long-term load item.
[0049] According to another aspect of the present invention, a storage medium is provided, wherein at least one executable instruction is stored in the storage medium, and the executable instruction enables a processor to execute operations corresponding to the above-mentioned server load balancing method.
[0050] According to another aspect of the present invention, there is provided a computer device, comprising: a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus;
[0051] The memory is used to store at least one executable instruction, and the executable instruction enables the processor to execute operations corresponding to the above-mentioned server load balancing method.
[0052] By means of the above technical solution, the technical solution provided by the embodiment of the present invention has at least the following advantages:
[0053] The present invention provides a server load balancing method, device, equipment and medium. Compared with the prior art, the embodiment of the present invention obtains reference load balancing strategies of multiple servers to be load balanced, and predicts the operation data allocated by the reference load balancing strategy to determine the load balancing prediction result; if the load balancing prediction result is greater than a preset prediction threshold, the short-term load balancing adjustment strategy and / or the long-term load balancing adjustment strategy corresponding to the server are determined, and the reference load balancing strategy is adjusted by the short-term load balancing adjustment strategy and / or the long-term load balancing adjustment strategy; the adjusted reference load balancing strategy is shared in a global network, and the shared node server is instructed to perform load balancing processing according to the adjusted reference load balancing strategy. The global network includes multiple shared node servers. The adaptive mechanism can better utilize server processing resources by intelligently allocating requests, reduce server idle time and resource waste, significantly improve the response speed of the server in a high concurrency scenario, reduce the queuing time of user requests, and adjust and recover faster through multi-node collaboration and information sharing, thereby greatly improving the effectiveness and efficiency of server load balancing.
[0054] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present invention. Moreover, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:
[0056] Figure 1 A flow chart of a server load balancing method provided by an embodiment of the present invention is shown;
[0057] Figure 2 A block diagram showing the composition of a server load balancing device provided by an embodiment of the present invention is shown;
[0058] Figure 3 A schematic structural diagram of a computer device provided by an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0059] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.
[0060] A server is a specific computer device that provides computing power and runs software applications in a network environment. It provides computing or application services to other clients (such as personal computers, smart phones, ATM machines and other terminal devices) in the network. In order to ensure that the server has the processing capacity to respond to service requests, provide services, and ensure services, multiple servers can be combined in different business application scenarios to obtain a server cluster to process data with different needs or businesses. At present, requests for data processing in a server cluster need to be allocated in response to load balancing requests to improve the server's ability to process data.
[0061] The embodiment of the present invention provides a server load balancing method, such as Figure 1 As shown, the method includes:
[0062] 101. Obtain a reference load balancing strategy for a plurality of servers to be load balanced, and predict the operation data allocated by the reference load balancing strategy to determine a load balancing prediction result.
[0063] In the embodiment of the present invention, the current execution end, as the execution subject responding to the server load request, can be a server in the server cluster, or a processing end that uniformly allocates resources to the server cluster, which is not specifically limited in the embodiment of the present invention. Among them, the reference load balancing strategy for load balancing multiple servers is a strategy for initially allocating resources or data to multiple servers, which may include but is not limited to polling, least connection, weighted polling, weighted least connection, original address hash, performance-based dynamic scheduling, content-aware load balancing, geographic location load balancing, health check and other strategies, which can be pre-configured based on the operation status of the server device, which is not specifically limited in the embodiment of the present invention. After obtaining the reference load balancing strategy, the operating data corresponding to the reference load balancing strategy is predicted. At this time, training can be performed based on a machine learning algorithm to determine the predicted load balancing prediction result corresponding to the operating data under the allocation of the reference load balancing strategy. At this time, the machine learning model can adopt a long short-term memory network (LSTM, Long Short-Term Memory) and use the historical data corresponding to the reference load balancing strategy for training. The input dimension is the multi-dimensional performance indicator of the server, and the output is the future load prediction value. The performance data includes: CPU utilization, memory utilization, network bandwidth utilization, response time, request throughput, error rate, disk I / O performance, user behavior data, etc., which are not specifically limited in the embodiments of the present invention.
[0064] It should be noted that in the embodiment of the present invention, before predicting the reference load balancing strategy, for obtaining the data required for the reference load balancing strategy, the OS module of Node.js and node-usage or prom-client can be used to obtain real-time performance data at the system level and application level, and then use message queues such as Kafka or RabbitMQ to transmit these data in real time to the current execution end serving as the central monitoring system. The embodiment of the present invention does not make specific limitations.
[0065] 102. If the load balancing prediction result is greater than a preset prediction threshold, determine the short-term load balancing adjustment strategy and / or the long-term load balancing adjustment strategy corresponding to the server, and adjust the reference load balancing strategy through the short-term load balancing adjustment strategy and / or the long-term load balancing adjustment strategy.
[0066] In the embodiment of the present invention, the load balancing prediction results for different prediction models can obtain long-term load balancing prediction results or short-term load balancing prediction results, respectively, to compare with the pre-configured prediction threshold. When the prediction result is greater than the preset prediction threshold, it indicates that it is in a high load state. The current execution end can call the short-term load balancing adjustment strategy and / or the long-term load balancing adjustment strategy to adjust the reference load balancing strategy through the short-term load balancing adjustment strategy and / or the long-term load balancing adjustment strategy. At this time, the short-term load balancing adjustment strategy is used to characterize the strategy for short-term load balancing adjustment of the server, and the long-term load balancing adjustment strategy is used to characterize the strategy for long-term load balancing adjustment of the server. At this time, long-term and short-term are relative durations. For example, it can be configured in days as a short-term, such as 3 days, 5 days, and it can be configured as a long-term of more than 1 week. The embodiment of the present invention does not make specific limitations.
[0067] It should be noted that the short-term load balancing adjustment strategy is a strategy for coping with short-term processing pressure of servers such as instantaneous peaks through adjustment methods such as rapid expansion; the long-term load balancing adjustment strategy is a strategy for long-term processing of servers such as basic capacity through adjustment methods such as historical experience. For example, when the number of requests suddenly increases in a certain period of time in a short period of time, the short-term load balancing adjustment strategy can be a strategy for quickly increasing instances. When a high load is observed in a certain period of time for a long time, the long-term load balancing adjustment strategy is to adjust the number of basic servers. The embodiments of the present invention do not make specific limitations.
[0068] In an embodiment of the present invention, in order to enable the initial reference load balancing strategy to better perform load balancing on the server, the current execution end uses a short-term load balancing adjustment strategy and a long-term load balancing adjustment strategy to adjust it, such as increasing the allocated capacity, etc., to better adapt to the server's processing of data resources. The embodiment of the present invention does not make specific limitations.
[0069] 103. Share the adjusted reference load balancing strategy in the global network, and instruct the shared node server to perform load balancing processing according to the adjusted reference load balancing strategy.
[0070] In an embodiment of the present invention, the global network includes multiple shared node servers, that is, the shared node servers that need to be shared in the load balancing strategy can be selected from the server cluster. All of them can be selected or selected based on data processing requirements. The embodiment of the present invention does not make specific limitations. At this time, sending to the global network means sending the adjusted reference load balancing strategy to each shared node server in the global network, so that each shared node server processes according to this reference load balancing strategy. For example, during a big promotion, based on historical sales data and access traffic forecasts, server expansion and traffic distribution are carried out in advance to ensure stability under high concurrency. At the same time, the resource allocation of content distribution to the global network (CDN) can be dynamically adjusted according to user viewing habits and load forecasts during peak hours.
[0071] It should be noted that in order to ensure that load balancing can be effectively and dynamically performed between the servers, the current execution end performs real-time detection on the shared node server. When it is detected that the shared node server updates the received reference load balancing strategy, it indicates that there is a need to adjust the load balancing in each server. Therefore, the current execution end instructs the shared node server to perform load balancing according to the adjusted reference load balancing strategy. In addition, the current execution end can also regularly perform health checks on all shared node servers to ensure that the shared node servers are in an available state. By monitoring the use of resources such as CPU, memory, response time, and network bandwidth, the load balancer can promptly detect shared node failures, bottlenecks, or overloads. By collecting the status data of each shared node server, a global operating status view is formed to understand the profile and load distribution of the overall system. In addition, the current execution end can ensure uniform distribution of traffic based on the processing capacity of each shared node server through polling and weighted polling, and allocate more traffic to shared nodes with stronger processing capabilities, which is in line with global fairness and optimal use of global resources. The load balancer in the embodiment of the present invention generally has global traffic perception capabilities, and can route traffic to data centers in different geographical locations. It makes comprehensive judgments based on factors such as geographical location, network latency, and resource load to optimize overall performance, which is not specifically limited in the embodiment of the present invention.
[0072] In another embodiment of the present invention, for further definition and explanation, the step of determining the short-term load balancing adjustment strategy and / or the long-term load balancing adjustment strategy corresponding to the server includes:
[0073] Acquire real-time operation data and historical operation data of the server allocated according to the reference load balancing strategy;
[0074] The historical operation data is predicted using the long-term prediction model that has completed model training to obtain a long-term load balancing prediction result, and the real-time operation data is predicted using the short-term prediction model that has completed model training to obtain a short-term load balancing prediction result.
[0075] In order to realize intelligent load distribution and make adaptive adjustments, before the current execution end determines the short-term load balancing adjustment strategy and the long-term load balancing adjustment strategy of the server, the historical operation data and real-time operation data of the corresponding server allocated according to the reference load balancing strategy are first obtained. Among them, the operation data includes the CPU usage rate, memory occupancy rate, network I / O, disk I / O, request response time, current number of connections, error rate or failure rate, etc. of the server. The corresponding historical operation data can be the operation data of one day before the current moment, and the real-time operation data can be the operation data of the current moment corresponding to the day. The embodiment of the present invention does not make specific restrictions. In a specific implementation scenario summary, the current execution end uses the long-term prediction model and the historical operation data to predict and determine the long-term load balancing prediction result, that is, the long-term transportation prediction result. At this time, the operation data one month ago is used as the input of the model for prediction processing to determine the result of balancing processing of various operation data. For example, the memory occupancy rate, CPU usage rate, etc. are used as the model input to perform long-term load balancing prediction. The result is the memory occupancy rate, CPU usage rate, etc. after one month. The embodiment of the present invention does not make specific restrictions. Among them, the long-term prediction model is obtained by training the long short-term memory network based on the long-term load balancing sample, and the short-term prediction model is obtained by training the long short-term memory network based on the short-term load balancing sample. Specifically, the long-term load balancing sample includes the historical operation sample as input and the long-term load balancing sample as output, and the short-term load balancing sample includes the real-time operation sample as input and the short-term load balancing sample as output. The long short-term memory network trained for the long-term or short-term load balancing sample, at this time, the long short-term memory network is a time recurrent neural network, which is specially designed to solve the long-term dependency problem existing in the general RNN (recurrent neural network), and all RNNs have a chain form of a repeated neural network module. In addition, in the embodiment of the present invention, the models trained by the long-term prediction model and the short-term prediction model can be the same long short-term memory network, or they can be trained using different long short-term memory networks respectively. At the same time, during training, the load balancing item in the load balancing strategy can be used as a single model output to train multiple models simultaneously, or it can be used as an output corresponding to multiple models to train simultaneously, which is not specifically limited in the embodiment of the present invention.
[0076] It should be noted that the short-term load balancing adjustment strategy and / or long-term load balancing adjustment strategy in the embodiment of the present invention is matched and retrieved based on the short-term load balancing prediction results and the long-term load balancing prediction results, and can be pre-configured based on different adjustment requirements, and the embodiment of the present invention does not make specific limitations.
[0077] In another embodiment of the present invention, for further definition and explanation, before the step of obtaining a reference load balancing strategy for a plurality of servers to be load balanced, the method further includes:
[0078] Obtain cluster information, processing demand information, and operation extreme value information of different servers;
[0079] Generate multiple source load balancing strategies corresponding to the cluster information, the processing demand information, and the operation extreme value information according to a preset balancing strategy;
[0080] When a load balancing request instruction is received, a reference load balancing strategy is determined from the source load balancing strategies according to the identity carried in the load balancing request instruction, and sent to the server corresponding to the identity.
[0081] In order to effectively adjust the reference load balancing strategy to dynamically balance the load of the server optimally, the current execution end pre-configures the applicable load balancing strategy for each server. Specifically, first obtain the cluster information, processing demand information and motion extreme value information of different servers. Among them, the cluster information includes the number of servers, the storage space of all servers, the CPU size of all servers, the processing capacity, etc. The processing demand information is used to characterize the load demand content of each server requesting to process data, including but not limited to connection requirements, the size of available traffic, etc. The operation extreme value information includes the maximum and minimum values of each load item when each server is running. The load item at this time is the content that needs to be balanced and adjusted for each server, including but not limited to storage space, traffic, number of network connections, etc., which is not specifically limited in the embodiment of the present invention. At this time, different servers can pre-configure cluster information, processing demand information and operation extreme value information based on different device models and device operation conditions for real-time retrieval, which is not specifically limited in the embodiment of the present invention.
[0082] It should be noted that in order to configure the load balancing strategy for each server conveniently and efficiently, the current execution end generates an initial source load balancing strategy using the preset balancing strategy. At this time, the preset balancing strategy is a configured data list, which records the strategies for balancing the load items in the server with different cluster information, different processing demand information, and different operation extreme value information, and is used as the source load balancing strategy after searching. Furthermore, when each server triggers the load balancing request instruction, the current execution end determines the reference load balancing strategy from the source load balancing strategy according to the identity carried in the load balancing request instruction. At this time, the identity is used to characterize the identity of each server, which can be a device ID, and the embodiment of the present invention does not make specific limitations. Specifically, since the cluster information may include the identities of all servers to be requested for auxiliary balancing, when searching for the source load balancing policy, it may be determined based on the adaptation server ID in the processing requirement information whether the source load balancing policy corresponds to a server match. For example, if the processing requirement information includes adaptation servers ID1 and ID3, the source load balancing policy queried using the three conditions is applicable to ID1 and ID3. Therefore, after receiving the request instruction, the server based on the requested ID3 retrieves the source load balancing policy and feeds it back to the server ID3 so that the server ID3 is stored in the server as a reference load balancing policy.
[0083] In another embodiment of the present invention, for further definition and explanation, the step of adjusting the reference load balancing strategy by the short-term load balancing adjustment strategy and / or the long-term load balancing adjustment strategy includes:
[0084] Analyzing the short-term load item and the short-term adjustment value in the short-term load balancing adjustment strategy, and analyzing the long-term load item and the long-term adjustment value in the long-term load balancing adjustment strategy;
[0085] The balancing item and balancing value in the reference load balancing strategy are adjusted according to the short-term load item, the short-term load value, the long-term load item, and the long-term load value.
[0086] In order to achieve the purpose of dynamic balancing, reduce load balancing solidification, and avoid resource deposition in individual servers, when the current execution end uses the short-term load balancing adjustment strategy and the long-term load balancing adjustment strategy to adjust the reference load balancing strategy, specifically, first parse the short-term load item and short-term adjustment value in the short-term load balancing adjustment strategy, and parse the long-term load item and long-term adjustment value in the long-term load balancing adjustment strategy, so as to use the long-term load item, long-term adjustment value, short-term load item, and short-term adjustment value to adjust the balancing item and balancing value in the reference load balancing strategy. Among them, the long-term load item is used to characterize the object that needs to be load balanced in the long-term load balancing adjustment strategy, for example, the traffic within 1 month, and the corresponding long-term adjustment value is used to characterize the value that needs to be adjusted for this long-term load item, for example, the traffic increases by a, etc., which is not specifically limited in the embodiment of the present invention. Correspondingly, the short-term load item is used to characterize the object that needs to be load balanced in the short-term load balancing adjustment strategy, for example, the traffic within 10 days, and the corresponding short-term adjustment value is used to characterize the value that needs to be adjusted for this short-term load item, for example, the traffic increases by b, etc., which is not specifically limited in the embodiment of the present invention. In addition, in order to ensure the adjustment effect, the current execution end can implement a fast switching logic in the load balancer during adjustment, thereby allowing requests to be instantly redistributed when a high load is predicted, such as by configuring Nginx or using a custom load balancer based on Node.js, which is not specifically limited in the embodiments of the present invention.
[0087] In a specific embodiment, adjusting the balancing item and the balancing value in the reference load balancing strategy according to the short-term load item, the short-term load value, the long-term load item, and the long-term load value specifically includes:
[0088] Determine a balancing item with an adjustment priority in the reference load balancing strategy using the short-term load item, and adjust the balancing value of the balancing item using the short-term load value;
[0089] If the adjusted equilibrium value exceeds the load extreme value of the long-term load item, the equilibrium value is adjusted using the long-term load value.
[0090] In order to effectively combine the long-term and short-term load balancing adjustment strategies, so as to realize accurate and adaptive load balancing of the server, specifically, the current execution end uses the short-term load balancing adjustment strategy as the optimal adjustment basis, firstly, the short-term load item determines the balancing item of the adjustment priority in the reference load balancing strategy, that is, when the short-term load item contains multiple short-term load items, the balancing item that needs to be adjusted in the reference load balancing strategy is determined according to the pre-configured adjustment priority, so as to adjust the balancing value of the balancing item for the short-term load value, including but not limited to increase or decrease, etc., which is not specifically limited in the embodiment of the present invention. Furthermore, after the current execution end adjusts the short-term, it is determined whether this balancing value exceeds the load extreme value of the long-term load item. If it exceeds, it means that the adjustment is too large according to the short-term load item, and the long-term load value is used to readjust the balancing value, that is, the long-term load value is used to adjust the load value before the short-term load item is adjusted. If it does not exceed, it means that the adjustment is appropriate according to the short-term load item. Therefore, the adjusted balancing value can be directly used as the reference load balancing strategy, which is not specifically limited in the embodiment of the present invention. For example, if a certain type of low-priority request may time out due to excessive backlog, the current execution end will automatically increase their priority to avoid uneven resource allocation. At the same time, according to business needs, high-value or urgent business requests, such as payment transactions, data writing, etc., can be processed first through balancing items with adjusted priorities. Requests with short processing time can be processed first, thereby improving the smoothness of system response, making better use of system resources, reducing ineffective waiting for resources, and improving response speed and throughput.
[0091] In another embodiment of the present invention, for further definition and explanation, after the step of sharing the adjusted reference load balancing strategy to the global network, the method further includes:
[0092] In response to the policy update request of the shared node server, the reference load balancing policy is adjusted based on the node update information carried in the policy update request, and fed back to the shared node server.
[0093] In order to enable each shared node server in the shared global network to adjust the load balancing strategy adaptively and autonomously, after the current execution end sends the reference load balancing strategy to the global network, each shared node server can autonomously request to update the participating balancing strategy to meet the autonomous needs of individual shared node servers. The current execution end responds to the policy update request of the shared node server. At this time, the policy update request carries the node update information for requesting to update the load item according to the operation status of this shared node server, such as the number of visits, so that after the current execution end receives this node update information, it adjusts the reference load balancing strategy and re-shares it to each shared node server. Among them, the current execution end can manually detect the node update information to determine whether to adjust it. If it is determined to be adjusted, the adjusted reference load balancing strategy is fed back to this shared node server. Of course, it can also be shared with other shared node servers at the same time so that other shared node servers can determine whether to re-update or automatically perform shared updates. The embodiment of the present invention does not make specific limitations.
[0094] In another embodiment of the present invention, for further definition and description, the steps further include:
[0095] Determine the shared key item in the shared node server, and retrieve the shared operation data of the shared key item;
[0096] The shared operation data is load tested by a preset detection model to obtain a detection result. In order to avoid abnormal operation of the server due to load balancing, reduce ineffective waiting of resources, thereby improving response speed and throughput, and improving the effectiveness of load balancing, the current execution end first determines the shared key items of the shared node server after using the reference load balancing strategy to load balance the associated servers corresponding to the shared node server. Among them, the shared key items are used to characterize the load items that need to be monitored in the shared node server, and can be pre-configured based on the monitoring requirements. For example, the shared key items can be the CPU occupancy rate, in order to retrieve the shared operation data of the shared key items, that is, the specific value of the CPU occupancy rate. When calling, a call request can be sent to the shared node server to instruct the server to provide feedback. The embodiment of the present invention does not make specific limitations. Furthermore, the current execution end performs load detection on the shared operation data through a preset detection model to obtain a detection result. At this time, the preset detection model is used to characterize the data indicator detection model and the system operation detection model that affect the server load operation. The data indicator monitoring model is used to configure the detection model for indicators such as CPU usage, memory occupancy, network I / O, disk I / O, request response time, current number of connections, error rate or failure rate. It can include a machine learning algorithm model, or it can be a threshold model for comparison. The system operation detection model is used to combine multiple load items to determine whether the server system is running normally. The detection model can include a machine learning algorithm model, or it can include using the shared operation data corresponding to multiple load items to calculate the average value and compare it with the abnormal threshold to determine the abnormal result. The embodiment of the present invention does not make specific limitations. In addition, in the embodiment of the present invention, a distributed queue system, such as Redis or RabbitMQ, is also used to process peak requests to ensure that requests are not lost due to instantaneous high loads.
[0097] In another embodiment of the present invention, for further definition and description, the steps further include:
[0098] Analyze the load optimization target corresponding to the detection result, and determine the optimization authority corresponding to the load optimization target;
[0099] If the optimization authority matches the adjustment authority of the short-term load item and the long-term load item, the load optimization target is adjusted using the short-term load value and the long-term load value of the short-term load item and the long-term load item.
[0100] In order to improve the efficiency of adjusting the load balancing strategy and increase the response speed of key requests, the current execution end parses the load optimization target in the detection result. At this time, the load optimization target is the load item that needs to be balanced and optimized when there is an abnormal operation. If it is regarded as an abnormality according to the detection result, the load optimization target that causes the abnormal operation is determined, or all load items are regarded as targets that need to be optimized, and then the optimization authority of the load optimization target is determined. Among them, the optimization authority is used to characterize the priority authority for adjusting the optimization target, including the adjustment authority of short-term load items and long-term load items. At this time, the adjustment authority corresponding to the priority of different optimization target configurations in the optimization item list can be obtained for query, and the embodiment of the present invention does not make specific limitations. At this time, the adjustment authority of the short-term load item and the long-term load item that match the optimization authority is queried to adjust the load optimization target using the corresponding short-term load value and long-term load value of the short-term load item and the long-term load item, so as to perform load balancing through the optimized load optimization target.
[0101] The embodiment of the present invention provides a server load balancing method. Compared with the prior art, the embodiment of the present invention obtains reference load balancing strategies of multiple servers to be load balanced, and predicts the operating data allocated by the reference load balancing strategy to determine the load balancing prediction result; if the load balancing prediction result is greater than a preset prediction threshold, the short-term load balancing adjustment strategy and / or the long-term load balancing adjustment strategy corresponding to the server is determined, and the reference load balancing strategy is adjusted by the short-term load balancing adjustment strategy and / or the long-term load balancing adjustment strategy; the adjusted reference load balancing strategy is shared in a global network, and the shared node server is instructed to perform load balancing processing according to the adjusted reference load balancing strategy. The global network includes multiple shared node servers. The adaptive mechanism can better utilize server processing resources by intelligently allocating requests, reduce server idle time and resource waste, significantly improve the response speed of the server in a high concurrency scenario, reduce the queuing time of user requests, and adjust and recover faster through multi-node collaboration and information sharing, thereby greatly improving the effectiveness and efficiency of server load balancing.
[0102] Furthermore, as a response to the above Figure 1 The implementation of the method shown in the figure, the embodiment of the present invention provides a server load balancing device, such as Figure 2 As shown, the device comprises:
[0103] The acquisition module 21 is used to acquire a reference load balancing strategy of multiple servers to be load balanced, and predict the operation data allocated by the reference load balancing strategy to determine the load balancing prediction result;
[0104] An adjustment module 22 is used to determine the short-term load balancing adjustment strategy and / or the long-term load balancing adjustment strategy corresponding to the server if the load balancing prediction result is greater than a preset prediction threshold, and adjust the reference load balancing strategy by the short-term load balancing adjustment strategy and / or the long-term load balancing adjustment strategy;
[0105] The processing module 23 is used to share the adjusted reference load balancing strategy in the global network, and instruct the shared node server to perform load balancing processing according to the adjusted reference load balancing strategy, and the global network includes multiple shared node servers.
[0106] Furthermore, the acquisition module is specifically used to obtain the real-time operation data and historical operation data allocated by the server according to the reference load balancing strategy; use the long-term prediction model that has completed model training to predict the historical operation data to obtain a long-term load balancing prediction result, and use the short-term prediction model that has completed model training to predict the real-time operation data to obtain a short-term load balancing prediction result; wherein the long-term prediction model is obtained by training a long short-term memory network based on long-term load balancing samples, and the short-term prediction model is obtained by training a long short-term memory network based on short-term load balancing samples.
[0107] Furthermore, the device further comprises: a generating module, a determining module,
[0108] The acquisition module is also used to obtain cluster information, processing demand information, and operation extreme value information of different servers;
[0109] The generating module is used to generate a plurality of source load balancing strategies corresponding to the cluster information, the processing demand information, and the operation extreme value information according to a preset balancing strategy;
[0110] The determination module is used to determine a reference load balancing strategy from the source load balancing strategies according to the identity carried in the load balancing request instruction when receiving the load balancing request instruction, and send it to the server corresponding to the identity.
[0111] Furthermore, the adjustment module is used to parse the short-term load items and short-term adjustment values in the short-term load balancing adjustment strategy, and to parse the long-term load items and long-term adjustment values in the long-term load balancing adjustment strategy; and to adjust the balancing items and balancing values in the reference load balancing strategy according to the short-term load items, the short-term load values, the long-term load items, and the long-term load values; wherein, adjusting the balancing items and balancing values in the reference load balancing strategy according to the short-term load items, the short-term load values, the long-term load items, and the long-term load values includes: using the short-term load items to determine the balancing items with adjustment priority in the reference load balancing strategy, and using the short-term load values to adjust the balancing values of the balancing items; if the adjusted balancing value exceeds the load extreme value of the long-term load item, then using the long-term load value to adjust the balancing value.
[0112] Furthermore, the device also includes:
[0113] The calling module is used to respond to the policy update request of the shared node server, adjust the reference load balancing policy based on the node update information carried in the policy update request, and feed back to the shared node server.
[0114] Furthermore, the device further comprises: a detection module,
[0115] The determination module is further used to determine the shared key item in the shared node server and retrieve the shared operation data of the shared key item;
[0116] The detection module is used to perform load detection on the shared operation data through a preset detection model to obtain a detection result. The preset detection model is used to characterize a data indicator detection model and a system operation detection model that affect the server load operation.
[0117] Furthermore, the device further comprises: a parsing module,
[0118] The parsing module is used to parse the load optimization target corresponding to the detection result, and determine the optimization authority corresponding to the load optimization target, wherein the optimization authority is used to represent the priority authority for adjusting the optimization target;
[0119] The adjustment module is also used to adjust the load optimization target using the short-term load value and long-term load value of the short-term load item and the long-term load item if the optimization authority matches the adjustment authority of the short-term load item and the long-term load item.
[0120] The embodiment of the present invention provides a server load balancing device. Compared with the prior art, the embodiment of the present invention obtains reference load balancing strategies of multiple servers to be load balanced, and predicts the operating data allocated by the reference load balancing strategy to determine the load balancing prediction result; if the load balancing prediction result is greater than a preset prediction threshold, the short-term load balancing adjustment strategy and / or the long-term load balancing adjustment strategy corresponding to the server is determined, and the reference load balancing strategy is adjusted by the short-term load balancing adjustment strategy and / or the long-term load balancing adjustment strategy; the adjusted reference load balancing strategy is shared in a global network, and the shared node server is instructed to perform load balancing processing according to the adjusted reference load balancing strategy. The global network includes multiple shared node servers. The adaptive mechanism can better utilize server processing resources by intelligently allocating requests, reduce server idle time and resource waste, significantly improve the response speed of the server in a high concurrency scenario, reduce the queuing time of user requests, and adjust and recover faster through multi-node collaboration and information sharing, thereby greatly improving the effectiveness and efficiency of server load balancing.
[0121] According to an embodiment of the present invention, a storage medium is provided, wherein the storage medium stores at least one executable instruction, and the computer executable instruction can execute the server load balancing method in any of the above method embodiments.
[0122] Figure 3 A schematic diagram of the structure of a computer device provided according to an embodiment of the present invention is shown. The specific embodiment of the present invention does not limit the specific implementation of the computer device.
[0123] like Figure 3 As shown, the computer device may include: a processor (processor) 302 , a communication interface (Communications Interface) 304 , a memory (memory) 306 , and a communication bus 308 .
[0124] The processor 302 , the communication interface 304 , and the memory 306 communicate with each other via the communication bus 308 .
[0125] The communication interface 304 is used to communicate with other devices such as clients or other servers.
[0126] The processor 302 is used to execute the program 310, and specifically can execute the relevant steps in the above-mentioned server load balancing method embodiment.
[0127] Specifically, the program 310 may include program codes, which include computer operation instructions.
[0128] The processor 302 may be a central processing unit (CPU), or an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present invention. The one or more processors included in the computer device may be processors of the same type, such as one or more CPUs; or processors of different types, such as one or more CPUs and one or more ASICs.
[0129] The memory 306 is used to store the program 310. The memory 306 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.
[0130] The program 310 may be specifically configured to enable the processor 302 to perform the following operations:
[0131] Obtaining a reference load balancing strategy for multiple servers to be load balanced, and predicting the operating data allocated by the reference load balancing strategy to determine a load balancing prediction result;
[0132] If the load balancing prediction result is greater than a preset prediction threshold, a short-term load balancing adjustment strategy and / or a long-term load balancing adjustment strategy corresponding to the server is determined, and the reference load balancing strategy is adjusted by the short-term load balancing adjustment strategy and / or the long-term load balancing adjustment strategy;
[0133] The adjusted reference load balancing strategy is shared in a global network, and the shared node server is instructed to perform load balancing processing according to the adjusted reference load balancing strategy, wherein the global network includes a plurality of shared node servers.
[0134] Obviously, those skilled in the art should understand that the above modules or steps of the present invention can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, and optionally, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order than here, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.
[0135] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A server load balancing method, characterized in that: include: Obtaining a reference load balancing strategy for multiple servers to be load balanced, and predicting the operating data allocated by the reference load balancing strategy to determine a load balancing prediction result; If the load balancing prediction result is greater than a preset prediction threshold, a short-term load balancing adjustment strategy and / or a long-term load balancing adjustment strategy corresponding to the server is determined, and the reference load balancing strategy is adjusted by the short-term load balancing adjustment strategy and / or the long-term load balancing adjustment strategy; The adjusted reference load balancing strategy is shared in a global network, and the shared node server is instructed to perform load balancing processing according to the adjusted reference load balancing strategy, wherein the global network includes a plurality of shared node servers.
2. The method according to claim 1, characterized in that The predicting the operation data allocated by the reference load balancing strategy to determine the load balancing prediction result includes: Acquire real-time operation data and historical operation data of the server allocated according to the reference load balancing strategy; The historical operation data is predicted using the long-term prediction model that has completed model training to obtain a long-term load balancing prediction result, and the real-time operation data is predicted using the short-term prediction model that has completed model training to obtain a short-term load balancing prediction result; The long-term prediction model is obtained by training the long short-term memory network based on long-term load balancing samples, and the short-term prediction model is obtained by training the long short-term memory network based on short-term load balancing samples.
3. The method according to claim 1, characterized in that Before obtaining the reference load balancing strategies of the multiple servers to be load balanced, the method further includes: Obtain cluster information, processing demand information, and operation extreme value information of different servers; Generate multiple source load balancing strategies corresponding to the cluster information, the processing demand information, and the operation extreme value information according to a preset balancing strategy; When a load balancing request instruction is received, a reference load balancing strategy is determined from the source load balancing strategies according to the identity carried in the load balancing request instruction, and sent to the server corresponding to the identity.
4. The method according to claim 1, characterized in that: The adjusting the reference load balancing strategy by using the short-term load balancing adjustment strategy and / or the long-term load balancing adjustment strategy includes: Analyzing the short-term load item and the short-term adjustment value in the short-term load balancing adjustment strategy, and analyzing the long-term load item and the long-term adjustment value in the long-term load balancing adjustment strategy; Adjusting the balancing item and the balancing value in the reference load balancing strategy according to the short-term load item, the short-term load value, the long-term load item, and the long-term load value; The adjusting the balancing item and the balancing value in the reference load balancing strategy according to the short-term load item, the short-term load value, the long-term load item, and the long-term load value includes: Determine a balancing item with an adjustment priority in the reference load balancing strategy using the short-term load item, and adjust the balancing value of the balancing item using the short-term load value; If the adjusted equilibrium value exceeds the load extreme value of the long-term load item, the equilibrium value is adjusted using the long-term load value.
5. The method according to claim 1, characterized in that After sharing the adjusted reference load balancing strategy to the global network, the method further includes: In response to the policy update request of the shared node server, the reference load balancing policy is adjusted based on the node update information carried in the policy update request, and fed back to the shared node server.
6. The method according to claim 1, characterized in that The method further comprises: Determine the shared key item in the shared node server, and retrieve the shared operation data of the shared key item; The shared operation data is load tested using a preset detection model to obtain a detection result. The preset detection model is used to characterize a data indicator detection model and a system operation detection model that affect server load operation.
7. The method according to claim 6, characterized in that The method further comprises: Analyze the load optimization target corresponding to the detection result, and determine the optimization authority corresponding to the load optimization target, wherein the optimization authority is used to characterize the priority authority for adjusting the optimization target; If the optimization authority matches the adjustment authority of the short-term load item and the long-term load item, the load optimization target is adjusted using the short-term load value and the long-term load value of the short-term load item and the long-term load item.
8. A server load balancing device, characterized in that: include: An acquisition module is used to acquire a reference load balancing strategy of multiple servers to be load balanced, and predict the operation data allocated by the reference load balancing strategy to determine a load balancing prediction result; An adjustment module, configured to determine a short-term load balancing adjustment strategy and / or a long-term load balancing adjustment strategy corresponding to the server if the load balancing prediction result is greater than a preset prediction threshold, and to adjust the reference load balancing strategy by means of the short-term load balancing adjustment strategy and / or the long-term load balancing adjustment strategy; The processing module is used to share the adjusted reference load balancing strategy to the global network, and instruct the shared node server to perform load balancing processing according to the adjusted reference load balancing strategy, and the global network includes multiple shared node servers.
9. A storage medium, wherein at least one executable instruction is stored in the storage medium, and the executable instruction enables a processor to perform operations corresponding to the server load balancing method according to any one of claims 1 to 7.
10. A computer device comprising: A processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus; The memory is used to store at least one executable instruction, and the executable instruction enables the processor to perform operations corresponding to the server load balancing method according to any one of claims 1 to 7.
Citation Information
Cited By
User request distribution method and device, electronic equipment and storage medium
CN121442000A