A network traffic scheduling management method and system
By obtaining LVS traffic scheduling data in real time and dynamically updating the configuration, adaptive traffic scheduling and load balancing management are realized, which solves the problems of complex configuration and poor scalability in the existing technology, and improves the performance and reliability of the system.
Patent Information
- Application Number
- CN202311865192.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-29
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2043-12-29
AI Technical Summary
Existing technology makes it difficult to effectively schedule and manage back-end load balancing service clusters to cope with the impact of malicious traffic, resulting in website servers facing huge pressure, complex configuration, poor scalability, and insufficient dynamic adjustment capabilities.
By obtaining traceback data in the LVS traffic scheduling process in real time, we can determine whether traffic scheduling is needed, dynamically update configuration data, support the same node and cross-node scheduling methods, realize autonomous scheduling of traffic, and perform multiple load balancing on a single page. Configuration, supporting dynamic updates of multiple clusters and multiple nodes.
It implements adaptive traffic scheduling, quickly responds to traffic changes, supports manual and automatic scheduling, improves the performance and reliability of the load balancing system, simplifies operations, and enhances the scalability of the system.
Smart Images

Figure CN117749520B
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of network security protection, and in particular relates to a network traffic scheduling management method and system. Background Art
[0002] With the rapid development of information technology, Web sites are becoming more and more important in daily life. Web site security issues even affect the security and interests of the country, enterprises and citizens. At present, website traffic attacks are becoming more and more frequent and rampant. Attackers will launch DDOS and CC attacks through controlled zombies or scanners, which puts tremendous pressure on website servers. In this case, how to effectively schedule and manage the backend load balancing service cluster to cope with the impact of malicious traffic has become a severe challenge. Summary of the invention
[0003] In order to solve at least one technical problem in the background technology, the present invention proposes a network traffic scheduling management method and system, which can effectively schedule and manage a backend load balancing (LVS) service cluster to cope with the impact of malicious traffic.
[0004] According to a first aspect of the present invention, the present invention first provides a network traffic scheduling management method, the method comprising:
[0005] Obtain the back-tracing data of each LVS traffic scheduling process of different nodes in real time, including the inbound and outbound traffic size of LVS and the status code ratio of abnormal requests;
[0006] Based on the traceback data and the preset traffic scheduling judgment conditions, determine whether each LVS needs to be scheduled; if traffic scheduling is required, dynamically update the current LVS configuration data of the main data warehouse according to different traffic scheduling methods;
[0007] Synchronize the current LVS configuration data of the master data warehouse to the local data warehouses of each LVS of different nodes; and when the data of the local data warehouse is updated, record the data update time of the local data warehouse;
[0008] According to the data update time of the local data warehouse, determine whether to update the current LVS configuration file; if updated, read the configuration data related to the current LVS from the local data warehouse; and generate an updated LVS configuration file based on the configuration data, so that the current LVS performs traffic scheduling according to the updated LVS configuration file.
[0009] Furthermore, the method comprises:
[0010] Obtaining initial configuration parameters input by the user, the initial configuration parameters including the virtual server IP and port, the backend server IP and port, the IP address type, the backend server heartbeat detection method, and the configuration delivery target area;
[0011] An initial configuration file for each LVS is generated based on the initial configuration parameters, so that each LVS performs traffic scheduling for the first time according to the initial configuration file.
[0012] Furthermore, the process of obtaining the status code ratio of the request exception includes:
[0013] According to the LVS load balancing log, obtain all http status codes returned by each LVS load balancing backend server;
[0014] The status code ratio of a single user in the current LVS request exception and the status code ratio of a single user in the current LVS request exception within a preset interval are calculated according to the http status code.
[0015] Further, judging whether each LVS needs to perform traffic scheduling based on the backtracking data and the preset traffic scheduling judgment condition includes:
[0016] According to the inflow and outflow traffic of the LVS and the preset relationship between the traffic size and the score, the request traffic score of each LVS is obtained;
[0017] Based on the number of traffic requests within the preset interval and the current LVS request abnormal status code ratio, the abnormal status code ratio score of a single LVS is obtained;
[0018] Based on the status code ratio of all LVS requests with abnormalities on the same node, the score of the status code ratio of all LVS requests with abnormalities on a single node is obtained;
[0019] Based on the status code ratio of the same user in multiple LVS requests, the score of the status code ratio of the single user in the current LVS request is obtained;
[0020] Calculate the sum of the request flow score, the single LVS request abnormal status code ratio score, the all LVS request abnormal status code ratio scores in a single node, and the single user's current LVS request abnormal status code ratio score to obtain the current LVS total score;
[0021] According to the preset relationship between the total score of the current LVS and the threshold, it is determined whether the current LVS needs to perform traffic scheduling.
[0022] Further, judging whether the current LVS needs to perform traffic scheduling according to a preset relationship between the total score of the current LVS and a threshold value includes:
[0023] A first threshold and a second threshold are predefined, and the second threshold is greater than the first threshold;
[0024] If the total score of the current LVS is less than the first threshold, it is determined that the current LVS does not need to be scheduled and maintains the current state; or,
[0025] If the total score of the current LVS is greater than or equal to the first threshold and less than the second threshold, it is determined that the traffic scheduling mode of the current LVS is cross-LVS scheduling of traffic of the same node; or,
[0026] If the total score of the current LVS is greater than the second threshold, it is determined that the traffic scheduling mode of the current LVS is cross-node traffic scheduling.
[0027] Furthermore, if traffic scheduling is required, the current LVS configuration data of the main data warehouse is updated according to different traffic scheduling methods, including:
[0028] If the current LVS traffic scheduling mode is cross-LVS scheduling of the same node traffic, then the relevant information of the current faulty LVS in the master data warehouse is automatically deleted; or,
[0029] If the current LVS traffic scheduling mode is cross-node traffic scheduling, the relevant information of the current faulty node in the main data warehouse is automatically deleted.
[0030] Further, judging whether to update the current LVS configuration file according to the data update time of the local data warehouse includes:
[0031] Get the time when each LVS current configuration data is read from the local data warehouse;
[0032] Determine whether the data update time of the local data warehouse is greater than the reading time. If so, automatically trigger the LVS configuration file update signal.
[0033] Further, after generating an updated LVS configuration file according to the configuration data, the method includes:
[0034] Check whether the updated LVS configuration file is effective;
[0035] If it does not take effect, an alarm signal will be triggered.
[0036] According to a second aspect of the present invention, the present invention further provides a network traffic scheduling and management system, comprising:
[0037] The acquisition module is used to obtain the back-tracing data of each LVS traffic scheduling process of different nodes in real time. The back-tracing data includes the size of the LVS inflow and outflow traffic and the proportion of the status code of the request abnormality;
[0038] The analysis module is used to determine whether each LVS needs to perform traffic scheduling based on the backtracking data and the preset traffic scheduling judgment conditions; if traffic scheduling is required, the current LVS configuration data of the main data warehouse is dynamically updated according to different traffic scheduling methods;
[0039] A synchronization module is used to synchronize the current LVS configuration data of the master data warehouse to the local data warehouses of each LVS of different nodes; and when the data of the local data warehouse is updated, record the data update time of the local data warehouse;
[0040] A dynamic update module is used to determine whether to update the current LVS configuration file based on the data update time of the local data warehouse; if updated, read the configuration data related to the current LVS from the local data warehouse; and generate an updated LVS configuration file based on the configuration data, so that the current LVS performs traffic scheduling according to the updated LVS configuration file.
[0041] Furthermore, the analysis module also includes a request flow score calculation unit, an abnormal status code ratio score calculation unit, a total score calculation unit and a judgment unit;
[0042] The request flow score calculation unit is used to obtain the request flow score of each LVS according to the inflow and outflow flow of the LVS and the preset relationship between the flow size and the score;
[0043] The abnormal status code ratio score calculation unit is used to obtain the abnormal status code ratio score of a single LVS request based on the number of traffic requests within a preset interval and the status code ratio of the current LVS request abnormality; obtain the abnormal status code ratio score of all LVS requests in a single node based on the status code ratio of all LVS requests in the same node; obtain the abnormal status code ratio score of a single user in the current LVS request based on the status code ratio of multiple LVS requests of the same user;
[0044] The total score calculation unit is used to calculate the request flow score, the single LVS request abnormal status code ratio score, the total of all LVS request abnormal status code ratio scores in a single node and the current LVS request abnormal status code ratio score of a single user to obtain the total score of the current LVS;
[0045] The judging unit is used to judge whether the current LVS needs to perform traffic scheduling according to a preset relationship between the total score of the current LVS and a threshold.
[0046] Through the technical solution of the present invention, the following technical effects can be obtained:
[0047] The network traffic scheduling management method and system provided by the present invention can adaptively respond to changes in traffic and services and realize rapid traffic scheduling. It not only supports manual scheduling, but also can automatically schedule traffic according to the proportion of abnormal status codes of requests. Secondly, it can perform multiple load balancing configurations on a single page, which is simple and convenient to operate, and supports dynamic updates of multiple clusters and multiple nodes, realizing autonomous scheduling of traffic, thereby providing strong support for improving the performance and reliability of the load balancing system. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0049] Figure 1 A flow chart of a network traffic scheduling management method provided by an embodiment of the present invention;
[0050] Figure 2 A schematic diagram of a flow chart of performing traffic scheduling for the first time provided by an embodiment of the present invention;
[0051] Figure 3 A schematic diagram of a flow chart for determining whether traffic scheduling is required for each LVS based on the backtracking data and preset traffic scheduling judgment conditions provided in an embodiment of the present invention;
[0052] Figure 4 A method flow chart for determining whether to update the current LVS configuration file according to the data update time of the local data warehouse is provided for an embodiment of the present invention;
[0053] Figure 5 A schematic diagram of the structure of a network traffic scheduling and management system provided by another embodiment of the present invention. DETAILED DESCRIPTION
[0054] 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 ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0055] It should be noted that the terms "first", "second", "third" and "fourth" in the specification and claims of this application are used to distinguish different objects rather than to describe a specific order. The terms "including" and "having" in the embodiments of this application and any variations thereof are intended to cover non-exclusive inclusions.
[0056] In the related technology, the methods for updating LVS traffic load balancing mainly include the following aspects:
[0057] (1) Update the configuration of the LVS cluster by modifying the LVS configuration file, such as modifying the load balancing algorithm, adding or deleting servers, etc.
[0058] (2) LVS cluster updates generally adopt a rolling upgrade method, that is, updating each node one by one to avoid affecting the normal operation of the entire LVS cluster.
[0059] Specifically, the patent application with application number 202310930919.X includes: obtaining the status of the gateway (lvs), scoring according to the status and the corresponding weight of the status, determining the priority of each lvs, and allocating traffic according to the priority. However, this solution has the following shortcomings: How to reasonably set the status and weight is a challenge. Unreasonable settings will lead to uneven traffic distribution. When the number or performance of servers changes, the status and weight need to be recalculated, and traffic scheduling management cannot be completed quickly. The process may require manual operation and is relatively complicated.
[0060] The patent application with application number 202310581552.5 includes: defining two backend servers through keepalived static files. If one of them is down, the traffic will go to the other backend server. However, this solution has the following shortcomings: complex configuration, each backend server writes an independent configuration file, which increases the complexity of configuration and makes maintenance difficult. When the configuration of the backend server needs to be modified, the configuration files of the two servers need to be modified separately, which may lead to inconsistent configurations and poor scalability. If you need to increase or decrease the backend servers, you need to manually modify the configuration files, which increases the scalability of the system.
[0061] The patent application with application number 202211521541.X includes: obtaining LVS cluster data indicators and load weights for calculation, and distributing traffic according to the calculation results. However, this solution has the following shortcomings: insufficient dynamic adjustment capability. When the number or performance of cluster servers changes, it is necessary to recalculate the load weights and readjust the process distribution. This process may involve manual modification of configuration files, which is cumbersome to operate.
[0062] In summary, the present invention provides a network traffic scheduling management method and system to cope with the elastic scheduling and management of web traffic, aiming to achieve traffic perception and scheduling across machines and regions.
[0063] According to one embodiment of the present invention, Figure 1 A schematic diagram of a network traffic scheduling management method provided by the present invention is shown, such as Figure 1 As shown, an embodiment of the present invention provides a network traffic scheduling management method, which can be deployed in LVS (load balancer), and determines whether to dynamically update the current configuration of LVS by obtaining the backtracking data of LVS at the previous moment in real time, thereby achieving a purpose of dynamically updating the configuration. The method includes the following steps:
[0064] S200, obtaining in real time the traceback data of each LVS traffic scheduling process of different nodes, wherein the traceback data includes the size of the LVS inflow and outflow traffic and the proportion of the status code of the request abnormality;
[0065] This step simultaneously obtains the backtracking data of multiple LVSs, and each LVS corresponds to a set of backtracking data. The different nodes refer to different regions, and one region is regarded as a node, such as the Beijing node and the Shanghai node. Each node has multiple LVSs, and the backtracking data between different LVSs are independent of each other and do not affect each other. The backtracking data can be counted at a time granularity of one minute and one hour.
[0066] Among them, the calculation process of the status code ratio of the request exception includes: according to the LVS load balancing log, obtaining all http status codes returned by each LVS load balancing backend server; according to the http status code, calculating the status code ratio of the current LVS request exception of a single user and the status code ratio of the current LVS request exception within a preset interval. In other words, the request exception status code ratio is considered from two aspects. The first aspect is to calculate the status code ratio of each LVS request exception based on a single user, and the second aspect is to calculate the status code ratio of each LVS request exception based on a preset interval. In this embodiment, for the calculation of a single user, users can be distinguished based on domain names, and one domain name is regarded as one user, and the same root domain is regarded as one user.
[0067] The status code of the abnormal request can be determined according to the http protocol specification. In this embodiment, the status code starting with the number 5 is considered to be an abnormal status code, which is used to identify the LVS server abnormality. The status code ratio of the abnormal request refers to the percentage of the number of abnormal status codes to the total number.
[0068] Since the network traffic scheduling management method provided by the embodiment of the present invention is based on back-tracing data, when the network traffic scheduling management is started for the first time, there is no back-tracing data. Therefore, the embodiment of the present invention provides manual configuration of load balancing configuration input items to enable the first traffic scheduling. This process also achieves the purpose of easily configuring multiple LVS on a single page, and the configuration process is simple and convenient. Specifically, Figure 2 As shown, the method further comprises:
[0069] S100, obtaining the initial configuration parameters input by the user, wherein the initial configuration parameters include the virtual server IP and port, the backend server IP and port, the IP address type, the backend server heartbeat detection method, and the configuration delivery target area; wherein the IP address type supports both ipv4 and ipv6; the configuration delivery target area supports single and multiple LVS clusters to take effect at the same time, and the purpose of the configuration delivery target area is to migrate the user traffic in different regions to the nearest node.
[0070] S110, generating an initial configuration file for each LVS based on the initial configuration parameters, so that each LVS performs traffic scheduling for the first time according to the initial configuration file.
[0071] In this step, after manual configuration by the user, each LVS only reads the configuration data related to this cluster from the initial configuration parameters and ignores the data of other clusters; generates a corresponding initial configuration file based on the read configuration data, and each LVS loads its own initial configuration file for load balancing, thereby generating the first traceback data.
[0072] It should be noted that, in other embodiments, if other customers need to join the current load balancing system, they can also be purposefully configured through the manual configuration of the load balancing configuration input item so that the new customers can apply the management function.
[0073] S400, based on the backtracking data and the preset traffic scheduling judgment condition, determine whether each LVS needs to perform traffic scheduling; if traffic scheduling is required, dynamically update the current LVS configuration data of the main data warehouse according to different traffic scheduling methods;
[0074] This step is a process of analyzing and judging based on the returned traceback data to determine whether to perform traffic scheduling and the method of performing traffic scheduling. Different traffic scheduling methods correspond to different scheduling processes. In this embodiment, the traffic scheduling method includes cross-LVS scheduling of traffic on the same node and cross-node scheduling of traffic (i.e., cross-region scheduling).
[0075] Figure 3The flowchart of the method for determining whether each LVS needs to perform traffic scheduling based on the backtracking data and the preset traffic scheduling judgment condition is shown. Figure 3 As shown, the method of judging whether each LVS needs to perform traffic scheduling based on the backtracking data and the preset traffic scheduling judgment condition includes:
[0076] S410, according to the inbound and outbound traffic size of the LVS, and the preset relationship between the traffic size and the score, obtain the request traffic score of each LVS; this step is calculated based on the total bandwidth of the inbound and outbound traffic. In this embodiment, the preset relationship includes a predefined mapping relationship between the traffic size and the score, the larger the traffic, the larger the score, for example, the score is divided into ten levels of 1-10; the LVS kernel counts the incoming traffic and outgoing traffic of each LVS, and obtains the score a1 of the incoming traffic and the score a2 of the outgoing traffic according to the preset relationship, and the sum of a1 and a2 is the request traffic score of the current LVS.
[0077] S420, based on the number of traffic requests within a preset interval and the status code ratio of the current LVS request abnormality, obtain a single LVS request abnormal status code ratio score;
[0078] Steps S420 to S440 calculate the score b of the request abnormal status code ratio based on a single LVS machine, a single node, and a single user.
[0079] In step S420, a preset relationship between the request abnormal status code ratio level and the score is predefined; the level of the request abnormal status code ratio is matched according to the number of traffic flows of the current request, such as high risk, medium risk, and low risk. Different levels correspond to different scores. The higher the level, the greater the score. Finally, a single LVS request abnormal status code ratio score b1 is obtained. For example, if there are 100 requests within one minute, when the request abnormal status code ratio is less than 5%, the request abnormal status code ratio level is considered to be low, if it is greater than 5% and less than 20%, the request abnormal status code ratio level is considered to be medium, and if it is greater than 20%, the request abnormal status code ratio level is considered to be high.
[0080] S430, based on the status code ratio of all LVS requests that are abnormal on the same node, obtain a score of the ratio of all LVS request status codes that are abnormal on a single node;
[0081] This step obtains the abnormal status code ratio score of each LVS based on the above-defined preset relationship between the request abnormal status code ratio level and the score, and then accumulates the request abnormal status code ratio scores of all LVSs in the same node to obtain the abnormal status code ratio score b2 of all LVSs in a single node.
[0082] In other optional embodiments, the sources may be distinguished, the ratio of abnormal status codes of requests from the same source of all LVSs of a single node may be calculated, and scores may be assigned.
[0083] S440, based on the status code ratios of the same user in multiple LVS requests being abnormal, obtain a score of the status code ratio of the single user in the current LVS request being abnormal;
[0084] This step comprehensively evaluates the request abnormal status code ratio level of a single user in different LVSs, and obtains the abnormal status code ratio score b3 of a single user in the current LVS according to the above-defined preset relationship between the request abnormal status code ratio level and the score. For example, if three LVSs report inconsistent abnormal status code ratios of a certain user, which are 5%, 30%, and 10% respectively, then the LVS server with an abnormal status code ratio of 30% is judged to have a high possibility of abnormality. Of course, other factors are considered. For example, if the reported user abnormality ratios are very high, and the abnormal status code ratio data of each LVS tends to be consistent, then the possibility of abnormalities in the computer room and the source station is high. At this time, the abnormal statistics of other users will be combined as a reference to obtain the abnormal status code ratio level of a single user in the current LVS request, and then obtain the corresponding score.
[0085] S450, calculate the sum of the request flow score, the abnormal status code ratio score of a single LVS, the abnormal status code ratio score of all LVSs in a single node, and the abnormal status code ratio score of a single user in the current LVS to obtain the total score of the current LVS; this step obtains a total score X=a+b, a represents the request flow size score, b represents the request abnormal status code ratio score, where a=a1+a2, b=b1+b2+b3. The value range of a and b is set according to actual needs, for example, the value range of a is 0-10, and the value range of b is 0-5.
[0086] S460: Determine whether the current LVS needs to perform traffic scheduling according to a preset relationship between the total score of the current LVS and a threshold.
[0087] The threshold in this step can be set according to actual needs and can also be adjusted dynamically. The threshold is mainly used to determine whether a single LVS fails or a single node fails; the value of X is judged according to the actual size of the threshold to determine whether traffic scheduling is required. Specifically, step S460 includes:
[0088] A first threshold and a second threshold are predefined, and the second threshold is greater than the first threshold;
[0089] If the total score of the current LVS is less than the first threshold, it is determined that the current LVS does not need to be scheduled and the current state is maintained;
[0090] If the total score of the current LVS is greater than or equal to the first threshold and less than the second threshold, it is determined that the traffic scheduling mode of the current LVS is cross-LVS scheduling of the traffic of the same node;
[0091] If the total score of the current LVS is greater than the second threshold, it is determined that the traffic scheduling mode of the current LVS is cross-node traffic scheduling.
[0092] It can be understood as follows: if X is less than the first threshold, everything is considered normal and no scheduling is required; if X is greater than or equal to the second threshold, traffic is scheduled across nodes; if X is greater than or equal to the first threshold and less than the second threshold, traffic on the same node is scheduled across LVS. Through such calculations and judgments, traffic can be effectively managed and scheduled to ensure stable system operation.
[0093] In step S400, after determining whether traffic scheduling is required and the corresponding traffic scheduling method, the configuration data of the main data warehouse is automatically modified. Specifically, if traffic scheduling is required, the current LVS configuration data of the main data warehouse is updated according to different traffic scheduling methods, including:
[0094] If the current LVS traffic scheduling method is cross-LVS scheduling of the same node traffic, the relevant information of the current faulty LVS in the main data warehouse is automatically deleted; in this embodiment, the process of deleting the faulty LVS includes: a node has multiple LVSs, and these multiple LVSs are all configured with the same vip address, that is, the IP address of the main data warehouse; the traffic requested to the vip is migrated to the LVS through the ospf protocol, and when the LVS fault is determined, the vip address of the LVS is deleted, and the user's request will not reach the faulty LVS.
[0095] If the current LVS traffic scheduling mode is cross-node traffic scheduling, the relevant information of the current faulty node in the main data warehouse is automatically deleted.
[0096] That is to say, no matter which traffic scheduling method is used, the present invention does not consider which machine the traffic is specifically scheduled to when it is cross-scheduling. It only focuses on deleting the faulty LVS or faulty node. After removing the faulty machine, new requests will automatically go to the remaining available nodes or machines.
[0097] S600, synchronizing the current LVS configuration data of the master data warehouse to the local data warehouses of each LVS of different nodes; and when the data of the local data warehouse is updated, recording the data update time of the local data warehouse;
[0098] In this step, all modified configuration data exists in the master data warehouse, and the local data warehouse of each LVS will automatically synchronize data from the master data warehouse, realizing the need for data disaster recovery. When the data in the master data warehouse is lost, there are multiple backups, but each LVS will only update the data related to its own node. In this embodiment, the master data warehouse stores the identifiers corresponding to each LVS, and each LVS updates the local data warehouse data according to its own identifier.
[0099] Among them, when each LVS local data warehouse synchronizes data, there is not necessarily an update time. The data update time will not be modified during data synchronization. Only when the data in the local data warehouse itself is modified will there be a corresponding update time. At this time, the current time is recorded as the data update time.
[0100] S800, based on the data update time of the local data warehouse, determine whether to update the current LVS configuration file; if updated, read the configuration data related to the current LVS from the local data warehouse; and generate an updated LVS configuration file based on the configuration data, so that the current LVS performs traffic scheduling according to the updated LVS configuration file. After the above steps modify the main data warehouse, this step S800 determines whether the configuration data of the current LVS needs to be dynamically updated, and finally performs traffic scheduling according to the updated configuration data. Figure 4 The flowchart of the method for determining whether to update the current LVS configuration file according to the data update time of the local data warehouse is shown as follows: Figure 4 As shown, judging whether to update the current LVS configuration file according to the data update time of the local data warehouse includes:
[0101] S810, obtain the reading time of each LVS current configuration data from the local data warehouse; in this embodiment, when each LVS reads the relevant configuration data from the local data warehouse, it will also record the reading time and save it in the local static file, so it can be obtained from the local static file.
[0102] S820, determining whether the data update time of the local data warehouse is greater than the reading time, and if so, automatically triggering an LVS configuration file update signal.
[0103] In this step, since the data in the local data warehouse is updated, its data update time must be greater than the reading time saved in the current local static file. Therefore, the difference between the data update time of the local data warehouse and the storage time in the local static file can be regularly compared to decide whether to perform dynamic update.
[0104] It should be noted that the steps S810-S820 will continue to run in the background as a daemon process, and regularly compare the difference between the data warehouse update time and the storage time in the local static file every minute.
[0105] In step S800, if the current LVS configuration file needs to be updated, the template engine is imported according to the read configuration data to generate the LVS configuration file; and the LVS configuration file is moved to the LVS program loading path, and LVS will automatically trigger the Keepalived reload instruction. This instruction will read the new configuration from the configuration file and load it into the kernel file one by one. This process will establish a mapping relationship between LVS and upstream (back-end server) to ensure that the traffic can be correctly forwarded to the corresponding server. Once the new mapping correspondence is established, LVS will start forwarding traffic according to the new configuration. This process is completed automatically and does not require human intervention. In this way, LVS can quickly adapt to changes in traffic and services to ensure the reliability and stability of the system.
[0106] As an optional embodiment, after generating an updated LVS configuration file according to the configuration data, the method further includes:
[0107] Check whether the updated LVS configuration file is effective; if not, trigger an alarm signal. In this embodiment, the effectiveness of the dynamically updated configuration is checked periodically, specifically by comparing the data update time of the local data warehouse with the current read time saved in the local static file. If the read time is greater than the data update time, it means that the LVS configuration file has taken effect; if the read time is less than the data update time, an alarm is sent to the client, for example, through a pop-up window, a prompt sound, etc.
[0108] The website traffic scheduling management method provided by the present invention can adaptively respond to changes in traffic and services and realize rapid traffic scheduling. It not only supports manual scheduling, but also can automatically schedule traffic according to the proportion of abnormal request status codes. Secondly, it can perform load balancing configuration on a single page, with simple and convenient operation, and supports dynamic updates of multiple clusters and multiple nodes, realizing autonomous scheduling of traffic, thereby providing strong support for improving the performance and reliability of the load balancing system.
[0109] According to the second aspect of the present invention, the present invention also provides a device embodiment corresponding to the above method embodiment, and the same parts are not repeated here. Figure 5 A schematic diagram of the structure of a website traffic scheduling management system provided by an embodiment of the present application is shown. Figure 5 As shown, the system comprises:
[0110] The acquisition module 10 is used to obtain the traceback data of each LVS traffic scheduling process of different nodes in real time, and the traceback data includes the size of the LVS inflow and outflow traffic and the proportion of the status code of the request abnormality;
[0111] The analysis module 20 is used to determine whether each LVS needs to perform traffic scheduling based on the backtracking data and the preset traffic scheduling judgment condition; if traffic scheduling is required, the current LVS configuration data of the main data warehouse is dynamically updated according to different traffic scheduling methods;
[0112] The synchronization module 30 is used to synchronize the current LVS configuration data of the master data warehouse to the local data warehouses of each LVS of different nodes; and when the data of the local data warehouse is updated, record the data update time of the local data warehouse;
[0113] The dynamic update module 40 is used to determine whether to update the current LVS configuration file based on the data update time of the local data warehouse; if updated, read the configuration data related to the current LVS from the local data warehouse; and generate an updated LVS configuration file based on the configuration data, so that the current LVS performs traffic scheduling according to the updated LVS configuration file.
[0114] Furthermore, the analysis module 20 also includes a request flow score calculation unit 21, an abnormal status code ratio score calculation unit 22, a total score calculation unit 23 and a judgment unit 24;
[0115] The request flow score calculation unit 21 is used to obtain the request flow score of each LVS according to the inflow and outflow flow of the LVS and the preset relationship between the flow size and the score;
[0116] The abnormal status code ratio score calculation unit 22 is used to obtain the abnormal status code ratio score of a single LVS request based on the number of traffic requests within a preset interval and the status code ratio of the current LVS request abnormality; obtain the abnormal status code ratio score of all LVS requests in a single node based on the status code ratio of all LVS requests in the same node; obtain the abnormal status code ratio score of a single user in the current LVS request based on the status code ratio of multiple LVS requests of the same user;
[0117] The total score calculation unit 23 is used to calculate the request flow score, the single LVS request abnormal status code ratio score, the total of all LVS request abnormal status code ratio scores in a single node and the current LVS request abnormal status code ratio score of a single user to obtain the total score of the current LVS;
[0118] The judging unit 24 is configured to judge whether the current LVS needs to perform traffic scheduling according to a preset relationship between the total score of the current LVS and a threshold.
[0119] Furthermore, the judgment unit 24 is also used to predefine a first threshold and a second threshold, and the second threshold is greater than the first threshold; if the total score of the current LVS is less than the first threshold, it is judged that the current LVS does not need to be scheduled and maintains the current state; or, if the total score of the current LVS is greater than or equal to the first threshold and less than the second threshold, it is judged that the traffic scheduling method of the current LVS is the same node traffic cross-LVS scheduling; or, if the total score of the current LVS is greater than the second threshold, it is judged that the traffic scheduling method of the current LVS is traffic cross-node scheduling.
[0120] Furthermore, the analysis module 30 also includes a scheduling unit 25, which is used to: if the current LVS traffic scheduling method is cross-LVS scheduling of traffic on the same node, automatically delete the relevant information of the current faulty LVS in the main data warehouse; or, if the current LVS traffic scheduling method is cross-node scheduling of traffic, automatically delete the relevant information of the current faulty node in the main data warehouse.
[0121] Furthermore, the system also includes a configuration module 50, which is used to obtain initial configuration parameters input by the user, the initial configuration parameters including the virtual server IP and port, the back-end server IP and port, the IP address type, the back-end server heartbeat detection method, and the configuration delivery target area; and to generate an initial configuration file for each LVS based on the initial configuration parameters, so that each LVS performs traffic scheduling for the first time according to the initial configuration file.
[0122] Furthermore, the system also includes a backtracking module 60, which is used to obtain all http status codes returned by each LVS load balancing backend server based on the LVS load balancing log; and calculate the status code ratio of a single user in the current LVS request exception and the status code ratio of the current LVS request exception within a preset interval based on the http status code.
[0123] Furthermore, the dynamic update module 40 is also used to: obtain the reading time of each LVS current configuration data from the local data warehouse; determine whether the data update time of the local data warehouse is greater than the reading time, and if so, automatically trigger the LVS configuration file update signal.
[0124] Furthermore, the system further comprises a checking module 70, and the checking module 70 is used to check whether the updated LVS configuration file is effective; if not, triggering an alarm signal.
[0125] The website traffic scheduling and management system provided by the present invention can adaptively respond to changes in traffic and services and realize rapid traffic scheduling. It not only supports manual scheduling, but also can automatically schedule traffic according to the proportion of abnormal request status codes. Secondly, it can perform load balancing configuration on a single page, with simple and convenient operation, and supports dynamic updates of multiple clusters and multiple nodes, realizing autonomous scheduling of traffic, thereby providing strong support for improving the performance and reliability of the load balancing system.
[0126] Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working process of the above-described device and equipment can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0127] In the embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative.
[0128] Those skilled in the art should understand that the scope of the invention involved in the present invention is not limited to the technical solutions formed by the specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the inventive concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present invention (but not limited to) to form a technical solution.
[0129] It should be understood that the size of the serial numbers of each step in the content of the invention and the embodiments of the present invention does not absolutely mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
Claims
1. A network traffic scheduling management method, It is characterized in that The method comprises: Obtain the traceback data of the traffic scheduling process of each LVS (Linux virtual server) in different nodes in real time, including the inbound and outbound traffic size of the LVS and the status code ratio of abnormal requests; According to the inflow and outflow traffic of the LVS and the preset relationship between the traffic size and the score, the request traffic score of each LVS is obtained; Based on the number of traffic requests within the preset interval and the current LVS request abnormal status code ratio, the abnormal status code ratio score of a single LVS is obtained; Based on the status code ratio of all LVS requests with abnormalities on the same node, the score of the status code ratio of all LVS requests with abnormalities on a single node is obtained; Based on the status code ratio of the same user in multiple LVS requests, the score of the status code ratio of the single user in the current LVS request is obtained; Calculate the sum of the request flow score, the single LVS request abnormal status code ratio score, the all LVS request abnormal status code ratio scores in a single node, and the single user's current LVS request abnormal status code ratio score to obtain the current LVS total score; According to the preset relationship between the total score of the current LVS and the threshold, determine whether the current LVS needs to perform traffic scheduling; if traffic scheduling is required, and the traffic scheduling mode of the current LVS is traffic scheduling across LVSs on the same node, then the relevant information of the current faulty LVS in the main data warehouse is automatically deleted; or, if traffic scheduling is required, and the traffic scheduling mode of the current LVS is traffic scheduling across nodes, then the relevant information of the current faulty node in the main data warehouse is automatically deleted; Synchronize the current LVS configuration data of the master data warehouse to the local data warehouses of each LVS of different nodes; and when the data of the local data warehouse is updated, record the data update time of the local data warehouse; According to the data update time of the local data warehouse, determine whether to update the current LVS configuration file; if updated, read the configuration data related to the current LVS from the local data warehouse; and generate an updated LVS configuration file based on the configuration data, so that the current LVS performs traffic scheduling according to the updated LVS configuration file.
2. The network traffic scheduling management method according to claim 1, It is characterized in that The method further comprises: Obtaining initial configuration parameters input by the user, the initial configuration parameters including the virtual server IP and port, the backend server IP and port, the IP address type, the backend server heartbeat detection method, and the configuration delivery target area; An initial configuration file for each LVS is generated based on the initial configuration parameters, so that each LVS performs traffic scheduling for the first time according to the initial configuration file.
3. The network traffic scheduling management method according to claim 1, It is characterized in that The process of obtaining the status code ratio of the request exception includes: According to the LVS load balancing log, obtain all http status codes returned by each LVS load balancing backend server; The status code ratio of a single user in the current LVS request exception and the status code ratio of a single user in the current LVS request exception within a preset interval are calculated according to the http status code.
4. The network traffic scheduling management method according to claim 1, It is characterized in that The determining whether the current LVS needs to perform traffic scheduling according to the preset relationship between the total score of the current LVS and the threshold value includes: A first threshold and a second threshold are predefined, and the second threshold is greater than the first threshold; If the total score of the current LVS is less than the first threshold, it is determined that the current LVS does not need to be scheduled and maintains the current state; or, If the total score of the current LVS is greater than or equal to the first threshold and less than the second threshold, it is determined that the traffic scheduling mode of the current LVS is cross-LVS scheduling of traffic of the same node; or, If the total score of the current LVS is greater than the second threshold, it is determined that the traffic scheduling mode of the current LVS is cross-node traffic scheduling.
5. The network traffic scheduling management method according to claim 1, It is characterized in that Determining whether to update the current LVS configuration file according to the data update time of the local data warehouse includes: Get the time when each LVS current configuration data is read from the local data warehouse; Determine whether the data update time of the local data warehouse is greater than the reading time; if greater, automatically trigger the LVS configuration file update signal.
6. The network traffic scheduling management method according to claim 1, It is characterized in that After generating the updated LVS configuration file according to the configuration data, the method further includes: Check whether the updated LVS configuration file is effective; if not, trigger an alarm signal.
7. A network traffic scheduling and management system, It is characterized in that include: The acquisition module is used to obtain the back-tracing data of each LVS traffic scheduling process of different nodes in real time. The back-tracing data includes the size of the LVS inflow and outflow traffic and the proportion of the status code of the request abnormality; An analysis module, used to determine whether each LVS needs to perform traffic scheduling based on the backtracking data and preset traffic scheduling judgment conditions; If traffic scheduling is required, the current LVS configuration data of the main data warehouse is dynamically updated according to different traffic scheduling methods; A synchronization module is used to synchronize the current LVS configuration data of the master data warehouse to the local data warehouses of each LVS of different nodes; and when the data of the local data warehouse is updated, record the data update time of the local data warehouse; A dynamic update module is used to determine whether to update the current LVS configuration file according to the data update time of the local data warehouse; if updated, read the configuration data related to the current LVS from the local data warehouse; and generate an updated LVS configuration file based on the configuration data, so that the current LVS performs traffic scheduling according to the updated LVS configuration file; The analysis module further includes a request flow score calculation unit, an abnormal status code ratio score calculation unit, a total score calculation unit, a scheduling unit and a judgment unit; The request flow score calculation unit is used to obtain the request flow score of each LVS according to the inflow and outflow flow of the LVS and the preset relationship between the flow size and the score; The abnormal status code ratio score calculation unit is used to obtain the abnormal status code ratio score of a single LVS request based on the number of traffic requests within a preset interval and the status code ratio of the current LVS request abnormality; obtain the abnormal status code ratio score of all LVS requests in a single node based on the status code ratio of all LVS requests in the same node; obtain the abnormal status code ratio score of a single user in the current LVS request based on the status code ratio of multiple LVS requests of the same user; The total score calculation unit is used to calculate the request flow score, the single LVS request abnormal status code ratio score, the total of all LVS request abnormal status code ratio scores in a single node and the current LVS request abnormal status code ratio score of a single user to obtain the total score of the current LVS; The judging unit is used to judge whether the current LVS needs to perform traffic scheduling according to the preset relationship between the total score of the current LVS and the threshold; The scheduling unit is used to automatically delete the relevant information of the current faulty LVS in the main data warehouse if traffic scheduling is required and the traffic scheduling mode of the current LVS is cross-LVS scheduling of traffic on the same node; Alternatively, if traffic scheduling is required, and the current traffic scheduling mode of LVS is cross-node traffic scheduling, the relevant information of the current faulty node in the main data warehouse is automatically deleted.
