Website traffic management method and system based on load balancer
By obtaining server status and load information in real time, and dynamically adjusting the load balancing configuration using the preset load decision model, the problem that traditional load balancing technology cannot adapt to dynamic load fluctuations is solved, and more efficient resource utilization and system performance are achieved.
Patent Information
- Application Number
- CN202411639461.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-15
- Publication Date
- 2025-04-11
- Estimated Expiration
- 2044-11-15
AI Technical Summary
Traditional load balancing technologies cannot flexibly adapt to dynamic load fluctuations, resulting in unbalanced resource utilization and performance degradation. The existing technology relies on manual configuration and adjustment, and efficiency and accuracy are limited.
By obtaining real-time status information and load information for multiple servers, inputting preset load decision models to obtain real-time load decision data, dynamically adjusting load balancer configuration, periodically assessing and optimizing model performance.
It improves the accuracy and resource utilization of load balancing, can better adapt to dynamic load changes, and improves the efficiency and robustness of the system.
Smart Images

Figure CN119814792A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data analysis, and in particular to a website traffic management method and system based on a load balancer. Background Art
[0002] With the rapid development of the Internet, large-scale websites and applications are facing increasing pressure from user access, such as e-commerce platforms, social media, online videos, etc. The user experience of these applications often depends on their performance and reliability. Whether users can access these applications smoothly mainly depends on network traffic.
[0003] Traditional load balancing technology usually makes load balancing decisions based on fixed rules or statistical models, which cannot flexibly adapt to dynamic load fluctuations. Such fixed rules may not accurately predict and adjust the demand for server resources, resulting in uneven resource utilization and performance degradation. Traditional load prediction methods may only rely on historical data or simple statistical models, which cannot accurately capture the complex dynamic changes in server resource status. Inaccurate load predictions will lead to inaccurate load balancing decisions and waste of resources. Existing technologies need to rely on manual configuration and adjustment to achieve load balancing, which is a heavy task for large-scale complex systems. At the same time, due to the rapid and complex load changes, the efficiency and accuracy of manual configuration and adjustment will also be limited. Traditional load balancing methods have low load prediction accuracy, and low load adjustment efficiency leads to low resource utilization, which can no longer meet the increasingly complex and changing traffic needs. Summary of the invention
[0004] In view of this, the present invention provides a website traffic management method and system based on a load balancer to solve the problems of low accuracy and low resource utilization of traditional load balancing.
[0005] In a first aspect, the present invention provides a method for managing website traffic based on a load balancer, wherein the load balancer is connected to a plurality of servers and is used to distribute load to each server, the method comprising:
[0006] Acquire real-time status information and real-time load information of multiple servers, and input the real-time status information and real-time load information into a preset load decision model to obtain real-time load decision data;
[0007] Configure the load balancer based on real-time load decision data to determine the network traffic borne by each server;
[0008] Periodically obtain the performance indicator data of the website system under the real-time load decision data, and evaluate and optimize the performance of the preset load decision model based on the performance indicator data of the website system.
[0009] The website traffic management method based on load balancer provided by the present invention collects the status data of each server, determines the real-time load decision data by using the preset load decision model, and dynamically adjusts the configuration of the load balancer to make the load distribution of each server more balanced, thereby improving the accuracy of load balancing and resource utilization. By periodically evaluating and optimizing the decision and implementation results, the efficiency and robustness of the system are guaranteed, and the traffic load balancing requirements of large websites or applications are effectively managed.
[0010] In an optional implementation, the training process of the preset load decision model includes:
[0011] Obtaining historical status information and corresponding historical load information and historical load decision data of multiple servers, and preprocessing the historical status information and corresponding historical load information and historical load decision data;
[0012] A neural network model is established based on the attention mechanism, and the historical state information and the corresponding historical load information are used as input to the neural network model to output the predicted load decision data;
[0013] Compare the predicted load decision data with the historical load decision data, and adjust the parameters of the neural network model according to the comparison results;
[0014] Repeat the process of using historical status information and corresponding historical load information as input to the neural network model, outputting predicted load decision data, comparing the predicted load decision data with the historical load decision data, and adjusting the parameters of the neural network model according to the comparison results, until the error between the predicted load decision data and the historical load decision data converges to obtain the preset load decision model.
[0015] The website traffic management method based on load balancer provided by the present invention determines the relationship between server status information, load information and load decision data by training a preset load decision model with historical data, so as to facilitate the accurate and rapid output of real-time load decision data according to real-time status information and load information.
[0016] In an optional implementation, the historical load information includes abnormal load information, the historical load decision data includes load decision data corresponding to the abnormal load information, and the abnormal load information includes burst traffic and abnormal traffic.
[0017] The website traffic management method based on load balancer provided by the present invention increases the extensiveness of samples by adding abnormal data to the model training data samples, better covers various load conditions, improves the generalization ability of the model, reduces the risk of overfitting, enables the model to better predict and use the traffic during peak hours, improves the system response speed, and provides a better user experience.
[0018] In an optional implementation, a neural network model is established based on an attention mechanism, including:
[0019] A neural network model based on a multi-layer perceptron structure is constructed, and an attention layer is added after the hidden layer of the neural network model to obtain a constructed neural network model. The attention layer is used to dynamically allocate weights of multiple servers.
[0020] The website traffic management method based on load balancer provided by the present invention realizes dynamic adjustment of server resources by adding attention mechanism to the neural network model and using the attention mechanism to perform dynamic feature weighting. It can better capture the complex relationship of server resource status, predict future traffic conditions and server load conditions, and provide more accurate traffic load prediction results.
[0021] In an optional implementation, the real-time load decision data includes: the weight of each server and the number of servers, and the load balancer is configured according to the real-time load decision data, and further includes:
[0022] Predict the predicted load information at the next moment based on the real-time load information;
[0023] Determine the number of servers to connect to the load balancer based on predicted load information and real-time load decision data.
[0024] The website traffic management method based on load balancer provided by the present invention implements elastic scaling decisions according to the load conditions after feature weighting, and realizes dynamic adjustment of server resources by increasing or decreasing resource capacity according to the attention weight of the server. This dynamic performance adjustment capability enables the system to better cope with load changes and improve the availability and efficiency of the system.
[0025] In an optional implementation, the performance of a preset load decision model is evaluated and optimized based on the performance indicator data of the website system, including:
[0026] Determine whether each performance indicator data meets the corresponding preset requirements. If at least one performance indicator data does not meet the corresponding preset requirements, re-acquire historical status information of multiple servers and corresponding historical load information and historical load decision data;
[0027] The preset load decision model is retrained using the historical status information of multiple servers and the corresponding historical load information and historical load decision data until all performance indicator data meet the corresponding preset requirements.
[0028] The website traffic management method based on load balancer provided by the present invention evaluates the performance of decision-making and implementation results through multiple performance indicators, adjusts and optimizes the preset load decision model and server resource balancing according to the evaluation results, improves system availability, flexibility and load decision efficiency, and better adapts to the requirements of dynamic load fluctuations on system performance and resource requirements.
[0029] In a second aspect, the present invention provides a website traffic management system based on a load balancer, wherein the load balancer is connected to a plurality of servers and is used to distribute load to each server, and the system comprises:
[0030] A real-time load decision module is used to obtain real-time status information and real-time load information of multiple servers, and input the real-time status information and real-time load information into a preset load decision model to obtain real-time load decision data;
[0031] Traffic configuration module, used to configure the load balancer according to real-time load decision data to determine the network traffic borne by each server;
[0032] The model optimization module is used to periodically obtain the performance indicator data of the website system under the real-time load decision data, and evaluate and optimize the performance of the preset load decision model based on the performance indicator data of the website system.
[0033] In a third aspect, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.
[0034] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to cause a computer to execute the method of the first aspect or any corresponding embodiment thereof.
[0035] In a fifth aspect, the present invention provides a computer program product, comprising computer instructions for causing a computer to execute the method of the first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0037] Figure 1is a flow chart of a method for managing website traffic based on a load balancer according to an embodiment of the present invention;
[0038] Figure 2 is a flow chart of another method for managing website traffic based on a load balancer according to an embodiment of the present invention;
[0039] Figure 3 is a structural block diagram of a website traffic management system based on a load balancer according to an embodiment of the present invention;
[0040] Figure 4 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0041] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0042] The embodiment of the present invention provides a website traffic management method based on a load balancer, which obtains real-time load decision data through model calculation to distribute the workload of each server, so as to achieve the effect of improving load balancing accuracy and resource utilization.
[0043] According to an embodiment of the present invention, an embodiment of a website traffic management method based on a load balancer is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0044] In this embodiment, a method for managing website traffic based on a load balancer is provided, which can be used in the above-mentioned computer system. Figure 1 is a flow chart of a method for managing website traffic based on a load balancer according to an embodiment of the present invention. The load balancer is connected to a plurality of servers and is used to distribute load to each server. Figure 1 As shown, the process includes the following steps:
[0045] Step S101, obtaining real-time status information and real-time load information of multiple servers, and inputting the real-time status information and real-time load information into a preset load decision model to obtain real-time load decision data.
[0046] Specifically, in order to monitor the status information of each server, it is necessary to deploy and configure monitoring tools, such as Prometheus, on the server, install the necessary software components and set up the operating environment. Configure the monitoring target (the specific server, service or application to be monitored) in the operating environment, and specify the address, port and indicator type of the monitoring target. Once the monitoring target is defined, it is necessary to configure the corresponding monitoring indicator and select the system performance parameters to be monitored, such as CPU utilization, memory usage, disk space, etc. Specify the data collection method for the monitoring tool to obtain data: actively poll the target to obtain data or send data from the target to the monitoring tool. The collected monitoring data needs to be stored and processed. The monitoring tool can be configured to store the data in a database or time series database, such as InfluxDB, for subsequent analysis and query. The collected monitoring data can be aggregated, compressed and processed to optimize storage and query performance. Through the interface or API provided by the monitoring tool, the server status information can be monitored in real time and displayed (the real-time status of each server can be displayed through the Grafana dashboard, for example, but not limited to this), so as to understand the status of each server more intuitively and set up alarm trigger mechanisms as needed, such as sending emails, text messages, or integrating into the notification system. At the same time, historical alarms and events can also be recorded for subsequent analysis and backtracking.
[0047] Step S102, configuring the load balancer according to the real-time load decision data to determine the network traffic borne by each server.
[0048] Specifically, the real-time load information is the traffic consumed when users visit the website. Nginx is used as a reverse proxy server (i.e., a load balancer) to distribute the traffic consumed by users requesting the website to multiple backend servers connected to the load balancer. Traffic is distributed according to pre-set rules (such as polling, minimum number of connections, or source address hashing, etc.), and the load of the backend server is monitored in real time. In the process of implementing load balancing, Nginx is used as a load balancer and deployed on a separate server. The load balancer is connected to multiple backend servers. In order to achieve high availability, multiple load balancers can be used to build redundancy and failover mechanisms.
[0049] Adjust the configuration of the load balancer according to the real-time load decision data, such as dynamically adjusting the weight of each server, adding or removing backend servers, etc. In the decision-making process, you can set a load threshold and fault tolerance mechanism for each server. When the difference between the current load distribution and the real-time load decision data is not very large, no adjustment is required to avoid frequent adjustments leading to instability. For example, the three servers connected to the load balancer have a current load rate of 40%, 45%, and 60% for each server. According to the real-time load decision data, the load rate of each server should be 42%, 43%, and 59%. It is preset that the load rate of each server can have a 2% fault tolerance. At this time, you do not need to follow up with the real-time load decision data to make adjustments, maintain the current load situation of each server, avoid frequent adjustments, and maintain the stability of network traffic.
[0050] While implementing the load balancing function, in order to achieve rapid troubleshooting and problem solving, it is necessary to set up monitoring and diagnostic functions, including logging, metric collection and analysis, performance benchmarking, and application tracing. In order to improve security, it is necessary to configure Secure Socket Layer (SSL) termination, and to improve the performance of applications or services, caching and acceleration mechanisms can be used. Finally, in order to protect applications or services from malicious attacks, it is necessary to configure firewalls and security group rules, limit access to load balancers, and control inbound and outbound traffic. Through the above steps, a highly reliable, highly available, and high-performance load balancing solution can be implemented to distribute the traffic and workload of applications or services.
[0051] In some optional implementations, the real-time load decision data includes: the weight of each server and the number of servers. The load balancer is configured according to the real-time load decision data, and further includes:
[0052] Predict the load information at the next moment based on the real-time load information.
[0053] Specifically, by analyzing historical load information, the predicted load information at the next moment can be predicted based on the real-time load information. For example, historical data analysis shows that the peak period for website usage is from 10 a.m. to 6 p.m. on weekdays. Deep learning algorithms can be used to train historical traffic data to predict future traffic load conditions. This is just an example, but not limited to this.
[0054] Determine the number of servers to connect to the load balancer based on predicted load information and real-time load decision data.
[0055] Specifically, based on predicted load information and real-time load decision data, the website system can use the elastic scaling functions provided by cloud service providers (such as AWS Auto Scaling) to automatically increase or decrease the number of servers, and automatically increase backend server resources during peak hours to cope with increased traffic demand.
[0056] The website traffic management method based on the load balancer provided in this embodiment implements elastic scaling decisions according to the load conditions after feature weighting, and realizes dynamic adjustment of server resources by increasing or decreasing resource capacity according to the attention weight of the server. This dynamic performance adjustment capability enables the system to better cope with load changes and improve the availability and efficiency of the system.
[0057] Step S103, periodically obtaining performance indicator data of the website system under the real-time load decision data, and evaluating and optimizing the performance of the preset load decision model based on the performance indicator data of the website system.
[0058] Specifically, the performance of the website system is evaluated regularly, key performance indicators are collected and compared with the expected goals. If the key performance indicators can reach the expected goals, no adjustment is required; otherwise, the preset load decision model needs to be optimized or server resources need to be increased. By regularly monitoring the throughput, response time, service quality and other indicators of the website system, the performance of the preset load decision model is evaluated and adjusted and optimized according to the evaluation results.
[0059] The load balancer-based website traffic management method provided in this embodiment collects the status data of each server, presets a load decision model to determine the real-time load decision data, and dynamically adjusts the configuration of the load balancer to make the load distribution of each server more balanced, thereby improving the accuracy of load balancing and resource utilization. By periodically evaluating and optimizing the decision and implementation results, the efficiency and robustness of the system are guaranteed, meeting the requirements for effectively managing the traffic load balancing of large websites or applications.
[0060] In this embodiment, a method for managing website traffic based on a load balancer is provided, which can be used in the above-mentioned computer system. Figure 2 is a flow chart of a method for managing website traffic based on a load balancer according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:
[0061] Step S201, obtaining real-time status information and real-time load information of multiple servers, and inputting the real-time status information and real-time load information into a preset load decision model to obtain real-time load decision data.
[0062] Specifically, the training process of the preset load decision model in the above step S201 includes:
[0063] Step S2011, obtaining historical status information and corresponding historical load information and historical load decision data of multiple servers, and preprocessing the historical status information and corresponding historical load information and historical load decision data.
[0064] Specifically, historical data is used for model training. In this embodiment, the historical data includes historical status information of multiple servers and corresponding historical load information and historical load decision data. Data preprocessing and feature extraction are performed on the historical data to obtain real-time server resource status data and perform normalization and normalization. Features are extracted from these historical data, such as CPU utilization, memory usage, and network bandwidth, and correlation information between servers is included in the feature set.
[0065] In some optional implementations, the historical load information includes abnormal load information, the historical load decision data includes load decision data corresponding to the abnormal load information, and the abnormal load information includes burst traffic and abnormal traffic.
[0066] Specifically, for burst traffic and abnormal situations, it is necessary to add historical abnormal data to the samples, increase the breadth of the model training data samples, better cover various traffic situations, improve the model's generalization ability, reduce the risk of overfitting, and help the model learn to cope with burst traffic and peak loads. Through training that simulates burst traffic, abnormal traffic, and other situations, the system can better predict and adapt to peak traffic, improve system response speed, reduce user waiting time, and provide a better user experience. During operation, the server resource status collected in real time is input into the trained model, and dynamic load balancing decisions are made based on the output of the model. In addition, the performance of the load balancing algorithm in the preset load decision model is continuously monitored and evaluated, and it is optimized and improved to adapt to different load situations, thereby improving the performance and reliability of the load balancing system.
[0067] The load balancer-based website traffic management method provided in this embodiment increases the breadth of samples by adding abnormal data to the model training data samples, better covers various load conditions, improves the generalization ability of the model, reduces the risk of overfitting, enables the model to better predict and use traffic during peak hours, improves system response speed, and provides a better user experience.
[0068] Step S2012, establish a neural network model based on the attention mechanism, use the historical state information and the corresponding historical load information as input to the neural network model, and output predicted load decision data.
[0069] In some optional implementations, the above step S2012 includes:
[0070] A neural network model based on a multi-layer perceptron structure is constructed, and an attention layer is added after the hidden layer of the neural network model to obtain a constructed neural network model. The attention layer is used to dynamically allocate weights of multiple servers.
[0071] Specifically, a model based on a multilayer perceptron (MLP) structure is designed and constructed, and an attention layer is introduced after the output of the hidden layer. By weighting the output of the hidden layer, the attention layer can allocate attention to important features to pay more attention to factors that have a significant impact on load balancing decisions. The training process of the model uses a labeled training dataset and uses a back-propagation algorithm and optimizer to iteratively optimize the model parameters so that it can accurately predict the appropriate load distribution.
[0072] In the real-time load monitoring phase, the server resource status collected in real time is input into the trained model, and the attention weight of each server is calculated. These weights represent the importance of the server under the current load conditions. The features are weighted according to the attention weights, and the various indicators required for load balancing decisions are comprehensively considered. The elastic scaling decision is made based on the load after feature weighting: if the load of a server is high and its attention weight is high, the resource capacity of the server is increased; on the contrary, if the load is low and the attention weight is low, the resources of the server are reduced or released.
[0073] The website traffic management method based on the load balancer provided in this embodiment realizes dynamic adjustment of server resources by adding an attention mechanism to the neural network model and using the attention mechanism to perform dynamic feature weighting, which can better capture the complex relationship between server resource status, predict future traffic conditions and server load conditions, and provide more accurate traffic load prediction results. Elastic scaling is performed according to the real-time server resource status to meet the requirements of dynamic load fluctuations on system performance and resource requirements. In this way, server resources can be utilized to the maximum extent and the availability, flexibility and efficiency of the system can be improved.
[0074] Step S2013, comparing the predicted load decision data with the historical load decision data, and adjusting the parameters of the neural network model according to the comparison result.
[0075] Specifically, the historical state information and the corresponding historical load information are used as input to the neural network model, and the predicted load decision data is output. The error between the predicted load decision data and the historical load decision data is used to evaluate the prediction accuracy of the preset load decision model, and the model parameters are adjusted according to the error.
[0076] Step S2014, repeat the process of using historical status information and corresponding historical load information as input to the neural network model, outputting predicted load decision data, comparing the predicted load decision data with the historical load decision data, and adjusting the parameters of the neural network model according to the comparison result, until the error between the predicted load decision data and the historical load decision data converges to obtain the preset load decision model.
[0077] Specifically, each time the model parameters are adjusted, the model is trained again using historical data until the error between the predicted load decision data output by the model and the actual historical load decision data converges or the error reaches a preset expected error or reaches a preset number of iterative training times, and the last neural network model is used as the preset load decision model.
[0078] The website traffic management method based on the load balancer provided in this embodiment uses historical data to train a preset load decision model to determine the relationship between server status information, load information and load decision data, so as to facilitate the accurate and rapid output of real-time load decision data based on real-time status information and load information.
[0079] Step S202: Configure the load balancer based on the real-time load decision data to determine the network traffic borne by each server. Figure 1 Step S102 of the illustrated embodiment will not be described in detail here.
[0080] Step S203, periodically obtaining performance indicator data of the website system under the real-time load decision data, and evaluating and optimizing the performance of the preset load decision model based on the performance indicator data of the website system.
[0081] Specifically, the above step S203 includes:
[0082] Step S2031, determine whether each performance indicator data meets the corresponding preset requirements. If there is at least one performance indicator data that does not meet the corresponding preset requirements, re-acquire the historical status information of multiple servers and the corresponding historical load information and historical load decision data.
[0083] Specifically, performance indicator data include but are not limited to: throughput, response time, service quality, etc. If each performance indicator data meets the corresponding preset requirements, no adjustment or optimization is required; if at least one performance indicator data does not meet the corresponding preset requirements, it is necessary to re-acquire historical data. At this time, the historical data includes the latest historical status information of multiple servers and the corresponding historical load information and historical load decision data.
[0084] Step S2032, using the historical status information of multiple servers and the corresponding historical load information and historical load decision data, retrain the preset load decision model until all performance indicator data meet the corresponding preset requirements.
[0085] Specifically, the latest historical data is used to retrain the preset load decision model and adjust the number of servers until all performance indicator data meet the corresponding preset requirements. The optimized preset load decision model is used for load balancing, and performance indicator evaluation and system optimization are performed periodically to continuously improve and optimize the load balancing algorithm to better meet business needs and enhance user experience.
[0086] The website traffic management method based on the load balancer provided in this embodiment evaluates the performance of decisions and implementation results through multiple performance indicators, adjusts and optimizes the preset load decision model and server resource balancing according to the evaluation results, improves system availability, flexibility and load decision efficiency, and better adapts to the requirements of dynamic load fluctuations on system performance and resource requirements.
[0087] In this embodiment, a website traffic management system based on a load balancer is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the system described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0088] This embodiment provides a website traffic management system based on a load balancer, wherein the load balancer is connected to multiple servers, such as Figure 3 As shown, including:
[0089] The real-time load decision module 301 is used to obtain the real-time status information and real-time load information of multiple servers, and input the real-time status information and real-time load information into a preset load decision model to obtain real-time load decision data.
[0090] The traffic configuration module 302 is used to configure the load balancer according to the real-time load decision data to determine the network traffic borne by each server.
[0091] The model optimization module 303 is used to periodically obtain the performance indicator data of the website system under the real-time load decision data, and evaluate and optimize the performance of the preset load decision model based on the performance indicator data of the website system.
[0092] In some optional implementations, the training process of the preset load decision model in the real-time load decision module 301 includes:
[0093] The historical data acquisition unit is used to acquire historical status information and corresponding historical load information and historical load decision data of multiple servers, and pre-process the historical status information and the corresponding historical load information and historical load decision data.
[0094] The model prediction unit is used to establish a neural network model based on the attention mechanism, take the historical state information and the corresponding historical load information as input to the neural network model, and output the predicted load decision data.
[0095] The model parameter optimization unit is used to compare the predicted load decision data with the historical load decision data and adjust the parameters of the neural network model according to the comparison results.
[0096] The preset load decision model determination unit is used to repeatedly use historical state information and corresponding historical load information as input to the neural network model, output predicted load decision data, compare the predicted load decision data with the historical load decision data, and adjust the parameters of the neural network model according to the comparison result, until the error between the predicted load decision data and the historical load decision data converges to obtain the preset load decision model.
[0097] In some optional implementations, the model optimization module 303 includes:
[0098] The performance evaluation unit is used to determine whether each performance indicator data meets the corresponding preset requirements. If there is at least one performance indicator data that does not meet the corresponding preset requirements, the historical status information of multiple servers and the corresponding historical load information and historical load decision data are re-acquired.
[0099] The model optimization unit is used to use the historical status information of multiple servers and the corresponding historical load information and historical load decision data to retrain the preset load decision model until all performance indicator data meet the corresponding preset requirements.
[0100] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.
[0101] The load balancer-based website traffic management system in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.
[0102] The embodiment of the present invention also provides a computer device having the above Figure 3 The website traffic management system based on load balancer is shown.
[0103] See also Figure 4 , Figure 4 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Figure 4 As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 4 A processor 10 is taken as an example.
[0104] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.
[0105] The memory 20 stores instructions executable by at least one processor 10, so that the at least one processor 10 executes the method shown in the above embodiment.
[0106] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0107] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.
[0108] The computer device further comprises a communication interface 30 for the computer device to communicate with other devices or a communication network.
[0109] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.
[0110] A part of the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the existence of the computer program instruction in a computer-readable medium includes, but is not limited to, a source file, an executable file, an installation package file, etc., and accordingly, the way in which the computer program instruction is executed by the computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium may be any available computer-readable storage medium or communication medium accessible to the computer.
[0111] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.
Claims
1. A method for managing website traffic based on a load balancer, wherein the load balancer is connected to a plurality of servers and is used to distribute load to each server, characterized in that: The method comprises: Acquire real-time status information and real-time load information of multiple servers, and input the real-time status information and real-time load information into a preset load decision model to obtain real-time load decision data; The load balancer is configured according to the real-time load decision data to determine the network traffic borne by each server; Periodically obtain performance indicator data of the website system under the real-time load decision data, and evaluate and optimize the performance of the preset load decision model based on the performance indicator data of the website system.
2. The method according to claim 1, characterized in that The training process of the preset load decision model includes: Obtaining historical status information and corresponding historical load information and historical load decision data of multiple servers, and preprocessing the historical status information and corresponding historical load information and historical load decision data; Establishing a neural network model based on the attention mechanism, taking the historical state information and the corresponding historical load information as inputs to the neural network model, and outputting predicted load decision data; Comparing the predicted load decision data with the historical load decision data, and adjusting the parameters of the neural network model according to the comparison result; Repeat the process of using the historical status information and the corresponding historical load information as input to the neural network model, outputting predicted load decision data, comparing the predicted load decision data with the historical load decision data, and adjusting the parameters of the neural network model according to the comparison result, until the error between the predicted load decision data and the historical load decision data converges to obtain a preset load decision model.
3. The method according to claim 2, characterized in that The historical load information includes abnormal load information, the historical load decision data includes load decision data corresponding to the abnormal load information, and the abnormal load information includes burst traffic and abnormal traffic.
4. The method according to claim 2, characterized in that: The neural network model is established based on the attention mechanism, including: A neural network model based on a multi-layer perceptron structure is constructed, and an attention layer is added after the hidden layer of the neural network model to obtain a constructed neural network model, wherein the attention layer is used to dynamically allocate weights of multiple servers.
5. The method according to claim 1, characterized in that The real-time load decision data includes: the weight of each server and the number of servers, and the load balancer is configured according to the real-time load decision data, and further includes: Predicting the predicted load information at the next moment according to the real-time load information; The number of servers connected to the load balancer is determined according to the predicted load information and the real-time load decision data.
6. The method according to claim 1, characterized in that Evaluating and optimizing the performance of the preset load decision model based on the performance indicator data of the website system includes: Determine whether each performance indicator data meets the corresponding preset requirements. If at least one performance indicator data does not meet the corresponding preset requirements, re-acquire historical status information of multiple servers and corresponding historical load information and historical load decision data; The preset load decision model is retrained using the historical status information of the multiple servers and the corresponding historical load information and historical load decision data until each performance indicator data meets the corresponding preset requirements.
7. A website traffic management system based on a load balancer, wherein the load balancer is connected to a plurality of servers and is used to distribute load to each server, characterized in that: The system comprises: A real-time load decision module is used to obtain real-time status information and real-time load information of multiple servers, and input the real-time status information and real-time load information into a preset load decision model to obtain real-time load decision data; A traffic configuration module, configured to configure the load balancer according to the real-time load decision data to determine the network traffic borne by each server; The model optimization module is used to periodically obtain the performance indicator data of the website system under the real-time load decision data, and evaluate and optimize the performance of the preset load decision model based on the performance indicator data of the website system.
8. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the method according to any one of claims 1 to 6 by executing the computer instructions.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the method according to any one of claims 1 to 6.
10. A computer program product, characterized in that The method comprises computer instructions for causing a computer to execute the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Server load balancing method and system based on comparison service
CN117311984A
Self-adaptive load balancing method suitable for data intermediate station service grid
CN117793115A
Flow scheduling method and system for multi-core SDN (Software Defined Network) switch
CN118509373A
Adaptive load balancing method and system based on multiple models
CN118656211A
Intelligent load balancing in a hybrid cloud environment
US20240320060A1
Cited By
Network request processing method and device, equipment and storage medium
CN121462586A
Network request processing method, apparatus, device, and storage medium
CN121462586B