A dynamic resource allocation system, electronic device and storage medium for processing network threats

Through the dynamic resource allocation system, Kubernetes cluster resources are adjusted in real time, which solves the lag and threshold setting problems of the elastic scaling policy, improves the resource utilization and stability of the cluster, and ensures the normal operation of network threat services.

CN118331750BActive Publication Date: 2024-09-06CHINA ACADEMY OF INFORMATION & COMM
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410763544.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-14
Publication Date
2024-09-06
Estimated Expiration
2044-06-14

AI Technical Summary

Technical Problem

When Kubernetes handles network threats, its own elastic scaling policy has problems with dynamic allocation lag and no reference for threshold settings, resulting in poor service quality or unavailability.

Method used

A dynamic resource allocation system is designed, including a resource indicator collection module, a resource data analysis and evaluation module, a resource scheduling policy module and a resource controller. By periodically calling the Kubernetes resource monitoring plug-in, CPU and memory usage are obtained and a prediction model is built. , define the weight function, construct the expansion and reduction strategy functions, and adjust the number of resource instances in real time.

Benefits of technology

It improves the resource usage and stability of the Kubernetes cluster, ensures the effective operation of the service processing plug-in, improves the response speed, and ensures the normal development of network threat services.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118331750B
    Figure CN118331750B
Patent Text Reader

Abstract

The present invention provides a dynamic resource allocation system, electronic device and storage medium for processing network threats, wherein the system includes: a resource index collection module obtains a service plug-in instance resource allocation status index and a service plug-in instance resource usage status index; a resource data analysis and evaluation module obtains labels of CPU load level, memory load level, response time level, trend and stability index, and trains an evaluation prediction model based on the index and label; a resource scheduling strategy module obtains a model output result and a weight function based on the prediction model; an expansion strategy function and a contraction strategy function are constructed based on the weight function of the output result; a resource controller implements a configuration change of resource expansion or contraction based on the strategy function; and a resource scheduling strategy module determines the configuration change effect of expansion or contraction. The present invention has the functions of ensuring the effective operation of the service processing plug-in; improving the response speed of service processing; and ensuring the normal development of network threat services.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of network security, and in particular relates to a dynamic resource allocation system, electronic equipment and storage medium for processing network threats. Background Art

[0002] With the rapid development of information technology and the popularization of network applications, network security threats have become an issue that cannot be ignored. These threats are constantly evolving and taking various forms, including but not limited to APT (Advanced Persistent Threat), DDoS (Distributed Denial of Service), Phishing, Ransomware, Malware, Insider Threats, Zero-day Attack, Man-in-the-Middle Attack (MITM), etc. They may lead to information leakage and financial losses. Therefore, effectively managing and responding to these network security threats is an important task in protecting digital assets.

[0003] In order to cope with these challenges, the industry and academia have proposed many solutions and solutions, and finally realized the ability to handle different threats with service plug-ins as the carrier. However, when the corresponding service plug-ins are actually running, on the one hand, it is observed that idle service plug-ins occupy a large amount of computing resources, and on the other hand, the computing resources required by key service plug-ins are insufficient, which leads to contradictions and conflicts.

[0004] With the rapid development of cloud computing and the increasing popularity of microservice architecture, Kubernetes has become the main orchestration platform for containerized applications. Kubernetes provides powerful application orchestration capabilities for managing and scaling applications in dynamic environments. However, ensuring the reliability and performance of service plug-ins in such an environment remains a major challenge. Elastic scaling of containers is a key capability provided by Kubernetes, which can automatically adjust resource allocation according to application requirements. However, its built-in elastic scaling strategy cannot adapt to sudden increases in user requests or complex workload scenarios, making the service quality of service plug-ins prone to deterioration or even unavailability.

[0005] The current mainstream Kubernetes elastic scaling strategy mainly achieves elastic expansion and contraction by monitoring the resource usage of each instance in the container cluster and automatically increasing or decreasing the number of resources in the cluster. When the resource utilization rate is higher than the preset threshold, the elastic scaling strategy will automatically increase the number of Pods. Conversely, when the resource utilization rate is lower than the preset threshold, the elastic scaling strategy will automatically reduce the number of Pods to reduce resource usage. This mechanism has the following disadvantages when applied to network threat business scenario calculations:

[0006] Dynamic allocation lag: There is a certain lag in monitoring indicators such as CPU and memory. When faced with sudden surges in traffic, there are response delays and insufficient expansion and contraction capacity, which causes the service quality to deteriorate or even become unavailable.

[0007] Threshold setting has no reference: Setting effective thresholds requires in-depth understanding of the performance of service plug-ins, making it difficult for Kubernetes to determine when to scale the container cluster, and how much capacity needs to be expanded to meet the changing load. Summary of the invention

[0008] In order to solve the above technical problems, the present invention proposes a technical solution of a dynamic resource allocation system, an electronic device and a storage medium for processing network threats to solve the above technical problems.

[0009] A first aspect of the present invention discloses a dynamic resource allocation system for handling network threats; the system comprises:

[0010] Resource indicator collection module, resource data analysis and evaluation module, resource scheduling strategy module and resource controller;

[0011] The resource indicator collection module periodically calls the kubernetes resource monitoring plug-in interface to obtain the service plug-in instance resource allocation indicators: CPU allocation and memory allocation and service plug-in instance resource usage indicators: CPU usage, memory usage and request response time;

[0012] The resource data analysis and evaluation module obtains labels of CPU load level, memory load level, response time level, trend and stability indicators by analyzing the CPU allocation, memory allocation, CPU usage, memory usage and request response time;

[0013] The resource data analysis and evaluation module constructs a prediction model, and uses the average proportion of CPU usage, the average proportion of memory usage and the request response time as model inputs, and uses the CPU usage level, memory usage level, response time level, trend indicators, stability indicators and the configuration change effect of the expansion or contraction of the resource scheduling strategy module as model labels to train and evaluate the prediction model;

[0014] The resource scheduling strategy module obtains the CPU usage, memory usage and request response time collected in real time; inputs the CPU usage, memory usage and request response time collected in real time into the prediction model to obtain the model output results: CPU usage level, memory usage level, response time level, trend index, and stability index;

[0015] The resource scheduling strategy module defines a CPU load weight function according to the CPU usage level, defines a memory load weight function according to the memory usage level, defines a response time weight function according to the response time level, defines a trend weight function according to the trend index, and defines a stability weight function according to the stability index;

[0016] The resource scheduling strategy module constructs an expansion strategy function and a contraction strategy function according to the CPU load weight function, the memory load weight function, the response time weight function, the trend weight function and the stability weight function; and gives the final number of instances according to the expansion strategy function or the contraction strategy function;

[0017] The resource controller implements a configuration change of expanding or shrinking the resource according to the final number of instances;

[0018] The resource scheduling strategy module determines the effect of the configuration change of expansion or reduction according to the final number of instances.

[0019] According to the system of the first aspect of the present invention, the resource data analysis and evaluation module obtains the labels of CPU load level, memory load level, response time level, trend and stability indicators by analyzing the CPU allocation, memory allocation, CPU usage, memory usage and request response time, including:

[0020] According to the CPU usage and CPU allocation, the average CPU usage ratio is obtained;

[0021] According to the memory usage and memory allocation, the average memory usage ratio is obtained;

[0022] Calculate the CPU change rate based on the CPU usage at the previous moment and the CPU usage at the current moment;

[0023] Calculate the memory change rate based on the memory usage at the previous moment and the memory usage at the current moment;

[0024] Calculate the request response time change rate based on the request response time at the previous moment and the request response time at the current moment;

[0025] Obtaining a CPU load level according to the average proportion of CPU usage;

[0026] Obtaining a memory load level according to the average proportion of memory usage;

[0027] According to the comparison between the request response time change rate and the response time threshold, a response time grade label including fast, medium and slow is obtained;

[0028] Construct characteristic indicators based on the CPU change rate, memory change rate and request response time change rate;

[0029] According to the comparison between the characteristic index and the characteristic threshold, a trend label including rising, stable and falling is obtained;

[0030] Calculate a first average value and a first standard deviation of the characteristic index in a first time window; then calculate a second average value and a second standard deviation of the characteristic index in a second time window; compare the second average value with the first average value to calculate the average value change rate; compare the second standard deviation with the first standard deviation to calculate the standard deviation change rate;

[0031] When both the mean value change rate and the standard deviation change rate exceed the statistical threshold, the label of the stability index is judged to be fluctuation, otherwise, the label of the stability index is judged to be stable.

[0032] According to the system of the first aspect of the present invention, obtaining the CPU load level according to the average proportion of CPU usage includes:

[0033] CPU load level = 1 / (1 + e^(-0.1 × (average CPU usage percentage (t-1,t) - 50)));

[0034] Obtaining the memory load level according to the average proportion of memory usage includes:

[0035] Memory load level = 1 / (1 + e^(-0.1 × (average memory usage percentage (t-1,t) - 50)));

[0036] Among them, t represents the current time and t-1 represents the previous time.

[0037] According to the system of the first aspect of the present invention, the comparison between the request response time change rate and the response time threshold to obtain the response time grade labels including fast, medium and slow includes:

[0038] The response time threshold includes: a first response time threshold and a second response time threshold; the first response time threshold is less than the second response time threshold;

[0039] When the request response time change rate is less than or equal to the first response time threshold, the response time level label is defined as slow;

[0040] When the first response time threshold < request response time change rate ≤ the second response time threshold, define the response time level label as medium;

[0041] When the request response time change rate is greater than the second response time threshold, the response time level label is defined as fast.

[0042] According to the system of the first aspect of the present invention, constructing a characteristic index according to the CPU change rate, the memory change rate and the request response time change rate includes:

[0043] Characteristic index = a×CPU change rate + b×memory change rate + c×request response time change rate;

[0044] Among them, a, b and c are hyperparameters;

[0045] According to the comparison between the characteristic index and the characteristic threshold, trend labels including rising, stable and falling are obtained, including:

[0046] The feature threshold includes: a first feature threshold and a second feature threshold; the first feature threshold is greater than the second feature threshold;

[0047] When the characteristic index is greater than the first characteristic threshold, the trend label is defined as rising;

[0048] When the first feature threshold ≤ feature index ≤ first feature threshold, the trend label is defined as stable;

[0049] When the characteristic index is less than the second characteristic threshold, the trend label is defined as decreasing.

[0050] According to the system of the first aspect of the present invention, the resource data analysis and evaluation module constructs a prediction model, including:

[0051] The prediction model includes: a time series prediction model and a classification prediction model;

[0052] The time series prediction model is constructed by using the autoregressive integrated moving average method;

[0053] Adopting decision tree method to construct the classification prediction model;

[0054] The CPU usage, memory usage and request response time collected in real time are input into the prediction model to obtain the model output result, including:

[0055] By default, the system inputs the real-time collected CPU usage, memory usage and request response time into the time series prediction model to obtain the model output result;

[0056] When the system default time series prediction model is manually switched to the classification prediction model, the CPU usage, memory usage and request response time collected in real time are input into the classification prediction model to obtain the model output result.

[0057] According to the system of the first aspect of the present invention, the step of defining a CPU load weight function according to a CPU usage level includes:

[0058] W_cpu(L) = 0.7 × e^(1.5 × L); where L is the CPU load level; W_cpu(L) is the CPU load weight function;

[0059] Defining a memory load weight function according to the memory usage level includes:

[0060] W_mem(M) = 1.2 × M^2; where M is the memory load level; W_mem(M) is the memory load weight function; where M^2 represents M 2 .

[0061] Defining a response time weight function according to the response time level includes:

[0062] W_resp(T) = 3 / log(5 + T); T is the response time level, and its value is: slow = 7, medium = 8, fast = 9; W_resp(T) is the response time weight function;

[0063] Defining a trend weight function according to a trend indicator includes:

[0064] W_trend(Tr) = 1.1 × Tr; Tr is a trend indicator, with values ​​of: rising = 1, stable = 0.9, falling = 0.8; W_trend(Tr) is a trend weight function;

[0065] Defining a stationary weight function according to a stationary index includes:

[0066] W_stab(St) = 0.9 × sqrt(St); St is the stability index, and its value is: volatility = 1.5, stability = 1.2; W_stab(St) is the stability weight function.

[0067] According to the system of the first aspect of the present invention, the expansion strategy function and the reduction strategy function are constructed according to the CPU load weight function, the memory load weight function, the response time weight function, the trend weight function and the stability weight function, including:

[0068] Expand(L, M, T, Tr, St) = β × [W_cpu(L) + W_mem(M) + W_resp(T)] ×W_trend(Tr) × W_stab(St);

[0069] Among them, β is the basic expansion multiple constant; Expand(L, M, T, Tr, St) is the expansion strategy function;

[0070] Shrink(L, M, T, Tr, St) = δ × [W_cpu(L) + W_mem(M) + W_resp(T)] ×W_trend(Tr) × W_stab(St);

[0071] Among them, δ is the basic shrinkage multiple constant; Shrink(L, M, T, Tr, St) is the shrinkage strategy function;

[0072] The providing a final number of instances according to the expansion strategy function or the reduction strategy function includes:

[0073] At 10-second intervals, when the CPU usage ratio or memory usage ratio is greater than 80%, the expansion strategy function is used to determine the final number of instances.

[0074] At a time interval of 10 seconds, when the CPU usage ratio or the memory usage ratio is less than 20%, the scaling-down strategy function is used to determine the final number of instances.

[0075] A second aspect of the present invention provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the method in a dynamic resource allocation system for processing network threats as described in the first aspect of the present invention is executed.

[0076] A third aspect of the present invention provides a storage medium, which stores a computer program that can be executed by one or more processors and can be used to implement a method in a dynamic resource allocation system for processing network threats as described in the first aspect of the present invention.

[0077] In summary, the solution proposed by the present invention is:

[0078] 1) Improve the resource utilization of the Kubernetes cluster;

[0079] 2) Improve the stability of the Kubernetes cluster;

[0080] 3) Ensure the effective operation of service processing plug-ins;

[0081] 4) Improve the response speed of service processing;

[0082] 5) Ensure the normal development of network threat business. BRIEF DESCRIPTION OF THE DRAWINGS

[0083] 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.

[0084] Figure 1 A structural diagram of a dynamic resource allocation system for processing network threats according to an embodiment of the present invention;

[0085] Figure 2 A diagram of a resource data analysis and evaluation module according to an embodiment of the present invention;

[0086] Figure 3 A schematic diagram of resource rearrangement according to an embodiment of the present invention;

[0087] Figure 4 A schematic diagram of resource preloading according to an embodiment of the present invention;

[0088] Figure 5 The figure is a structural diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0089] 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 only 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 making creative work are within the scope of protection of the present invention.

[0090] The first aspect of the present invention discloses a dynamic resource allocation system for handling network threats. Figure 1 FIG. 1 is a structural diagram of a dynamic resource allocation system for processing network threats according to an embodiment of the present invention, specifically as follows Figure 1 As shown, the system comprises:

[0091] Resource indicator collection module, resource data analysis and evaluation module, resource scheduling strategy module and resource controller;

[0092] The resource indicator collection module periodically calls the kubernetes resource monitoring plug-in interface to obtain the service plug-in instance resource allocation indicators: CPU allocation and memory allocation and service plug-in instance resource usage indicators: CPU usage, memory usage and request response time;

[0093] The resource data analysis and evaluation module obtains labels of CPU load level, memory load level, response time level, trend and stability indicators by analyzing the CPU allocation, memory allocation, CPU usage, memory usage and request response time;

[0094] The resource data analysis and evaluation module constructs a prediction model, and uses the average proportion of CPU usage, the average proportion of memory usage and the request response time as model inputs, and uses the CPU usage level, memory usage level, response time level, trend indicators, stability indicators and the configuration change effect of the expansion or contraction of the resource scheduling strategy module as model labels to train and evaluate the prediction model; the resource scheduling strategy module obtains the CPU usage, memory usage and request response time collected in real time; the CPU usage, memory usage and request response time collected in real time are input into the prediction model to obtain the model output results: CPU usage level, memory usage level, response time level, trend indicators, stability indicators;

[0095] The resource scheduling strategy module defines a CPU load weight function according to the CPU usage level, defines a memory load weight function according to the memory usage level, defines a response time weight function according to the response time level, defines a trend weight function according to the trend index, and defines a stability weight function according to the stability index;

[0096] The resource scheduling strategy module constructs an expansion strategy function and a contraction strategy function according to the CPU load weight function, the memory load weight function, the response time weight function, the trend weight function and the stability weight function; and gives the final number of instances according to the expansion strategy function or the contraction strategy function;

[0097] The resource controller implements a configuration change of expanding or shrinking the resource according to the final number of instances;

[0098] The resource scheduling strategy module determines the effect of the configuration change of expansion or reduction according to the final number of instances.

[0099] The resource indicator collection module periodically calls the kubernetes resource monitoring plug-in interface to obtain the service plug-in instance resource allocation indicators: CPU allocation and memory allocation and service plug-in instance resource usage indicators: CPU usage, memory usage and request response time.

[0100] Specifically, the resource indicator collection module is responsible for collecting the resource usage of the container cluster and the resource usage of the service plug-ins in the network threat processing layer, and writing them into the storage component after unifying the format to provide basic data for data analysis.

[0101] Collector: By periodically calling the kubernetes resource monitoring plug-in interface, obtain the service plug-in instance resource allocation and service plug-in instance resource usage. The service plug-in instance resource allocation indicators are: CPU allocation and memory allocation; the service plug-in instance resource usage indicators are: CPU usage, memory usage and request response time.

[0102] Converter: responsible for the preliminary processing of the collected raw data, including format conversion, cleaning and normalization, and finally outputting it in the form of two-dimensional table and file.

[0103] Storage: Monitor the specified directory in real time. When the converter output data is detected, it is saved to the data storage system in a timely and secure manner through batch processing strategies.

[0104] The resource data analysis and evaluation module obtains labels of CPU load level, memory load level, response time level, trend and stability indicators by analyzing the CPU allocation, memory allocation, CPU usage, memory usage and request response time;

[0105] The resource data analysis and evaluation module constructs a time series prediction model, and uses the average CPU usage percentage, the average memory usage percentage and the request response time as model inputs, and uses the CPU usage level, memory usage level, response time level, trend indicators, stability indicators and the configuration change effects of the expansion or contraction of the resource scheduling strategy module as model labels to train and evaluate the time series prediction model.

[0106] In some embodiments, the resource data analysis and evaluation module obtains labels of CPU load level, memory load level, response time level, trend and stability indicators by analyzing the CPU allocation, memory allocation, CPU usage, memory usage and request response time, including:

[0107] According to the CPU usage and CPU allocation, the average CPU usage ratio is obtained;

[0108] According to the memory usage and memory allocation, the average memory usage ratio is obtained;

[0109] Calculate the CPU change rate based on the CPU usage at the previous moment and the CPU usage at the current moment;

[0110] Calculate the memory change rate based on the memory usage at the previous moment and the memory usage at the current moment;

[0111] Calculate the request response time change rate based on the request response time at the previous moment and the request response time at the current moment;

[0112] Obtaining a CPU load level according to the average proportion of CPU usage;

[0113] Obtaining a memory load level according to the average proportion of memory usage;

[0114] According to the comparison between the request response time change rate and the response time threshold, a response time grade label including fast, medium and slow is obtained;

[0115] Construct characteristic indicators based on the CPU change rate, memory change rate and request response time change rate;

[0116] According to the comparison between the characteristic index and the characteristic threshold, a trend label including rising, stable and falling is obtained;

[0117] Calculate a first average value and a first standard deviation of the characteristic index in a first time window; then calculate a second average value and a second standard deviation of the characteristic index in a second time window; compare the second average value with the first average value to calculate the average value change rate; compare the second standard deviation with the first standard deviation to calculate the standard deviation change rate;

[0118] When both the mean value change rate and the standard deviation change rate exceed the statistical threshold, the label of the stability index is judged to be fluctuation, otherwise, the label of the stability index is judged to be stable.

[0119] The CPU load level is obtained according to the average proportion of the CPU usage, including:

[0120] CPU load level = 1 / (1 + e^(-0.1 × (average CPU usage percentage (t-1,t) - 50)));

[0121] Obtaining the memory load level according to the average proportion of memory usage includes:

[0122] Memory load level = 1 / (1 + e^(-0.1 × (average memory usage percentage (t-1,t) - 50)));

[0123] Among them, t represents the current time and t-1 represents the previous time.

[0124] The comparison of the request response time change rate and the response time threshold to obtain response time grade labels including fast, medium and slow includes:

[0125] The response time threshold includes: a first response time threshold and a second response time threshold; the first response time threshold is less than the second response time threshold;

[0126] When the request response time change rate is less than or equal to the first response time threshold, the response time level label is defined as slow;

[0127] When the first response time threshold < request response time change rate ≤ the second response time threshold, define the response time level label as medium;

[0128] When the request response time change rate is greater than the second response time threshold, the response time level label is defined as fast.

[0129] The characteristic index is constructed according to the CPU change rate, memory change rate and request response time change rate, including:

[0130] Characteristic index = a×CPU change rate + b×memory change rate + c×request response time change rate;

[0131] Among them, a, b and c are hyperparameters;

[0132] According to the comparison between the characteristic index and the characteristic threshold, trend labels including rising, stable and falling are obtained, including:

[0133] The feature threshold includes: a first feature threshold and a second feature threshold; the first feature threshold is greater than the second feature threshold;

[0134] When the characteristic index is greater than the first characteristic threshold, the trend label is defined as rising;

[0135] When the first feature threshold ≤ feature index ≤ first feature threshold, the trend label is defined as stable;

[0136] When the characteristic index is less than the second characteristic threshold, the trend label is defined as decreasing.

[0137] Specifically, Figure 2 As shown in the figure, data analysis and model building are the basis for predicting demand and trends; resource allocation is based on these analysis results. The system collects the execution status of resource allocation and provides feedback to the model; the system evaluates and optimizes the execution effect of the model based on this, and continuously improves the resource allocation strategy.

[0138] Data analysis module: The data analysis module performs basic processing on the collected data, uses algorithms to analyze the indicators of CPU, memory, and request response time, and performs cluster analysis and trend analysis based on the collected task type, service type, time information, interface information, etc., to form summary wide tables and detailed wide tables to provide data support for subsequent model construction modules.

[0139] Data collection and preprocessing: collect CPU usage percentage, memory usage percentage, and request response time, and synchronize all collected data by timestamp to ensure the time series consistency of each sample point in the data set. Use the average value of the previous and next time points to handle missing data. Process outliers and use data smoothing or anomaly detection algorithms to clean the data.

[0140] Average CPU usage percentage = /

[0141] Average memory usage percentage = /

[0142] Calculate the CPU change rate based on the CPU usage at the previous moment and the CPU usage at the current moment;

[0143] CPU change rate = [( - / 1

[0144] Calculate the memory change rate based on the memory usage at the previous moment and the memory usage at the current moment;

[0145] Memory change rate = [( -M / 1

[0146] Calculate the request response time change rate based on the request response time at the previous moment and the request response time at the current moment;

[0147] Request response time change rate = (Res (t) - Res (t-1)) / 1

[0148] in is the CPU usage, The CPU configuration amount, is the memory usage, is the memory configuration amount, and Res(t) is the request response time function.

[0149] Obtaining a CPU load level according to the average proportion of CPU usage;

[0150] Obtaining a memory load level according to the average proportion of memory usage;

[0151] This indicator represents the CPU and memory load of the current service plug-in instance, and its value range is 0 to 1.

[0152] The CPU load level is obtained according to the average proportion of the CPU usage, including:

[0153] CPU load level = 1 / (1 + e^(-0.1 × (average CPU usage percentage (t-1,t) - 50)));

[0154] Obtaining the memory load level according to the average proportion of memory usage includes:

[0155] Memory load level = 1 / (1 + e^(-0.1 × (average memory usage percentage (t-1,t) - 50)));

[0156] Among them, t represents the current time and t-1 represents the previous time.

[0157] The service is labeled with response time grade information by using a clustering algorithm to perform cluster analysis on the response time increase rate. The response time grade labels include fast, medium, and slow.

[0158] According to the comparison between the request response time change rate and the response time threshold, a response time grade label including fast, medium and slow is obtained;

[0159] The comparison of the request response time change rate and the response time threshold to obtain response time grade labels including fast, medium and slow includes:

[0160] The response time threshold includes: a first response time threshold and a second response time threshold; the first response time threshold is less than the second response time threshold; the first response time threshold = 30%; the second response time threshold = 50%;

[0161] When the request response time change rate is less than or equal to the first response time threshold, the response time level label is defined as slow;

[0162] When the first response time threshold < request response time change rate ≤ the second response time threshold, define the response time level label as medium;

[0163] When the request response time change rate is greater than the second response time threshold, the response time level label is defined as fast.

[0164] Use the time series analysis algorithm to perform time series analysis on the feature data, obtain trend and stability indicators and save the results:

[0165] Trend is used to determine the long-term movement trend of characteristic indicators, and the values ​​include rising, stable, and falling.

[0166] Stationarity: Determines whether the feature remains stable over time in its statistical properties (such as mean, variance). The values ​​are: Fluctuating, Stable.

[0167] Construct characteristic indicators based on the CPU change rate, memory change rate and request response time change rate;

[0168] Characteristic index = a×CPU change rate + b×memory change rate + c×request response time change rate;

[0169] Among them, a, b and c are hyperparameters;

[0170] According to the comparison between the characteristic index and the characteristic threshold, a trend label including rising, stable and falling is obtained;

[0171] The feature threshold includes: a first feature threshold and a second feature threshold; the first feature threshold is greater than the second feature threshold; the first feature threshold = 5%; the second feature threshold = -5%;

[0172] When the characteristic index is greater than the first characteristic threshold, the trend label is defined as rising;

[0173] When the first feature threshold ≤ feature index ≤ first feature threshold, the trend label is defined as stable;

[0174] When the characteristic index is less than the second characteristic threshold, the trend label is defined as decreasing.

[0175] Calculate a first average value and a first standard deviation of the characteristic index in a first time window; then calculate a second average value and a second standard deviation of the characteristic index in a second time window; compare the second average value with the first average value to calculate the average value change rate; compare the second standard deviation with the first standard deviation to calculate the standard deviation change rate;

[0176] When both the mean value change rate and the standard deviation change rate exceed the statistical threshold, the label of the stability index is judged to be fluctuation, otherwise, the label of the stability index is judged to be stable.

[0177] Take request response time as an example:

[0178] - 0 to 5 minutes: average response time 200ms, standard deviation 20ms;

[0179] - 6 to 10 minutes: average response time 250ms, standard deviation 50ms;

[0180] The change rate of average response time = (250ms-200ms) / 200ms×100%=25%;

[0181] The rate of change of standard deviation = (50ms-20ms) / 20ms×100%=150%;

[0182] Both rates of change are greater than 10%, so the value of stationarity is fluctuation.

[0183] Generate a summary wide table containing a summary of all clustering and trend analysis results; generate a detailed wide table containing detailed data for each cluster group and trend analysis. Output the analysis results in an appropriate data format (such as CSV, Excel, etc.), and store the summary wide table and detailed wide table in the database to prepare for the input of the model building module.

[0184] Model construction module: the time series prediction model is constructed by using the autoregressive integrated moving average method; the average proportion of CPU usage, the average proportion of memory usage and the request response time are used as model inputs, and the CPU usage level, memory usage level, response time level, trend index, stability index and the configuration change effect of the expansion or contraction of the resource scheduling strategy module are used as model labels to train the model; three specific parameters are specified during training, namely AR(p)-autoregressive part, I(d)-integration part, MA(q)-moving average part, and the parameter values ​​are all 1.

[0185] After training is completed, an API interface is created for the model, which can be called by the resource controller to obtain the latest prediction data. The interface receives the following parameters: an array representing the CPU usage ratio in continuous time, an array representing the memory usage ratio, and an array representing the request response time. The interface will call the trained time series model to obtain the model prediction results, and use the model prediction results as the output of the interface, including CPU usage level, memory usage level, response time level, trend indicators, and stability indicators.

[0186] The time series forecasting model predicts future system load based on historical indicators of the same period. The historical period refers to the same time period of last week, last month, last quarter, and last year.

[0187] The classification prediction model is constructed by using a decision tree method; the average proportion of CPU usage, the average proportion of memory usage and the request response time are used as model inputs, and the CPU usage level, memory usage level, response time level, trend indicators, stability indicators and the configuration change effect of the expansion or contraction of the resource scheduling strategy module are used as model labels to train the model; five specific key parameters are specified during training, namely the depth of the tree (10), the segmentation quality (gini), the minimum number of segmentation samples (2), the minimum number of leaf node samples (1), and the maximum number of special certificates (auto). After the training is completed, an API interface is created for the model, which can be called by the resource controller to obtain the latest prediction data. The interface receives the following parameters: task type, service plug-in name, an array representing the CPU usage in continuous time, a memory usage array, and a request response time array. The interface will call the trained classification algorithm model to obtain the model prediction results, and use the model prediction results as the output of the interface, including the CPU usage level, memory usage level, response time level, trend indicators and stability indicators.

[0188] The classification prediction model predicts the resource space required for future special tasks based on historical indicators of similar tasks.

[0189] Model evaluation module: Verify the time series prediction model and classification prediction model, divide the data set into training set and test set. Use the test set to call the model prediction API interface, compare the interface output indicators with the indicators of the same name in the test set, and if the indicators correspond, the prediction is considered correct, otherwise the prediction is considered failed, and the prediction results are recorded.

[0190] Perform statistical calculations on the model prediction results to obtain the accuracy. When the accuracy is greater than 85%, the model is marked as valid for training and can be used for resource scheduling. When the accuracy is less than or equal to 85%, the model is marked as a training failure and needs to continue with the indicator collection, data analysis, and model building stages.

[0191] The resource scheduling strategy module obtains the CPU usage, memory usage and request response time collected in real time; inputs the CPU usage, memory usage and request response time collected in real time into the time series prediction model to obtain the model output results: CPU usage level, memory usage level, response time level, trend index, and stability index;

[0192] The resource scheduling strategy module defines a CPU load weight function according to the CPU usage level, defines a memory load weight function according to the memory usage level, defines a response time weight function according to the response time level, defines a trend weight function according to the trend index, and defines a stability weight function according to the stability index;

[0193] The resource scheduling strategy module constructs an expansion strategy function and a contraction strategy function according to the CPU load weight function, the memory load weight function, the response time weight function, the trend weight function and the stability weight function; and gives the final number of instances according to the expansion strategy function or the contraction strategy function;

[0194] The resource scheduling strategy module determines the effect of the configuration change of expansion or reduction according to the final number of instances.

[0195] In some embodiments, the resource data analysis and evaluation module constructs a prediction model, including:

[0196] The prediction model includes: a time series prediction model and a classification prediction model;

[0197] The time series prediction model is constructed by using the autoregressive integrated moving average method;

[0198] Adopting decision tree method to construct the classification prediction model;

[0199] The CPU usage, memory usage and request response time collected in real time are input into the prediction model to obtain the model output result, including:

[0200] By default, the system inputs the real-time collected CPU usage, memory usage and request response time into the time series prediction model to obtain the model output result;

[0201] When the system default time series prediction model is manually switched to the classification prediction model, the CPU usage, memory usage and request response time collected in real time are input into the classification prediction model to obtain the model output result.

[0202] Defining the CPU load weight function according to the CPU usage level includes:

[0203] W_cpu(L) = 0.7 × e^(1.5 × L); where L is the CPU load level; W_cpu(L) is the CPU load weight function;

[0204] Defining a memory load weight function according to the memory usage level includes:

[0205] W_mem(M) = 1.2 × M^2; where M is the memory load level; W_mem(M) is the memory load weight function;

[0206] Defining a response time weight function according to the response time level includes:

[0207] W_resp(T) = 3 / log(5 + T); T is the response time level, and its value is: slow = 7, medium = 8, fast = 9; W_resp(T) is the response time weight function;

[0208] Defining a trend weight function according to a trend indicator includes:

[0209] W_trend(Tr) = 1.1 × Tr; Tr is a trend indicator, with values ​​of: rising = 1, stable = 0.9, falling = 0.8; W_trend(Tr) is a trend weight function;

[0210] Defining a stationary weight function according to a stationary index includes:

[0211] W_stab(St) = 0.9 × sqrt(St); St is the stability index, and its value is: volatility = 1.5, stability = 1.2; W_stab(St) is the stability weight function.

[0212] The method of constructing a capacity expansion strategy function and a capacity reduction strategy function according to the CPU load weight function, the memory load weight function, the response time weight function, the trend weight function and the stability weight function includes:

[0213] Expand(L, M, T, Tr, St) = β × [W_cpu(L) + W_mem(M) + W_resp(T)] ×W_trend(Tr) × W_stab(St);

[0214] Among them, β is the basic expansion multiple constant; Expand(L, M, T, Tr, St) is the expansion strategy function;

[0215] Shrink(L, M, T, Tr, St) = δ × [W_cpu(L) + W_mem(M) + W_resp(T)] ×W_trend(Tr) × W_stab(St);

[0216] Among them, δ is the basic shrinkage multiple constant; Shrink(L, M, T, Tr, St) is the shrinkage strategy function;

[0217] The providing a final number of instances according to the expansion strategy function or the reduction strategy function includes:

[0218] At 10-second intervals, when the CPU usage ratio or memory usage ratio is greater than 80%, the expansion strategy function is used to determine the final number of instances.

[0219] At a time interval of 10 seconds, when the CPU usage ratio or the memory usage ratio is less than 20%, the scaling-down strategy function is used to determine the final number of instances.

[0220] Specifically, set a 10s time interval to continuously obtain 5 sets of data representing service performance, including CPU usage, memory usage, and request response time. Encapsulate the several sets of indicators into CPU usage array, memory usage array, and request response time array respectively.

[0221] The CPU usage, memory usage and request response time collected in real time are input into the prediction model to obtain the model output results, including:

[0222] By default, the system inputs the real-time collected CPU usage, memory usage and request response time into the time series prediction model to obtain the model output result;

[0223] When the system default time series prediction model is manually switched to the classification prediction model, the CPU usage, memory usage and request response time collected in real time are input into the classification prediction model to obtain the model output result.

[0224] Define the corresponding weighting function for the model prediction results and calculate the weighted values ​​of the indicators, which are:

[0225] CPU load weight function: As the CPU load level L increases, the weight increases exponentially. Defining the CPU load weight function according to the CPU usage level includes:

[0226] W_cpu(L) = 0.7 × e^(1.5 × L); where L is the CPU load level; W_cpu(L) is the CPU load weight function;

[0227] Memory load weight function: As the memory load level M increases, the weight increases quadratically. Defining the memory load weight function according to the memory usage level includes:

[0228] W_mem(M) = 1.2 × M^2; where M is the memory load level; W_mem(M) is the memory load weight function;

[0229] Response time weight function: As the response time T increases, the growth rate slows down. The response time weight function is defined according to the response time level, including:

[0230] W_resp(T) = 3 / log(5 + T); T is the response time level, and its value is: slow = 7, medium = 8, fast = 9; W_resp(T) is the response time weight function;

[0231] Trend weight function: The weight is proportional to the trend level Tr. The trend weight function is defined according to the trend indicator, including:

[0232] W_trend(Tr) = 1.1 × Tr; Tr is a trend indicator, with values ​​of: rising = 1, stable = 0.9, falling = 0.8; W_trend(Tr) is a trend weight function;

[0233] Stability weight function: The weight growth increases with the increase of the stability level St, but the growth rate decreases when the value is large. The stability weight function is defined according to the stability index, including:

[0234] W_stab(St) = 0.9 × sqrt(St); St is the stability index, and its value is: volatility = 1.5, stability = 1.2; W_stab(St) is the stability weight function.

[0235] The method of constructing a capacity expansion strategy function and a capacity reduction strategy function according to the CPU load weight function, the memory load weight function, the response time weight function, the trend weight function and the stability weight function includes:

[0236] Expand(L, M, T, Tr, St) = β × [W_cpu(L) + W_mem(M) + W_resp(T)] ×W_trend(Tr) × W_stab(St);

[0237] Among them, β is the basic expansion multiple constant, which will adjust the basic multiple of the entire calculation result. It can be adjusted according to the specific environment. The default value is β=0.45; Expand(L, M, T, Tr, St) is the expansion strategy function;

[0238] Shrink(L, M, T, Tr, St) = δ × [W_cpu(L) + W_mem(M) + W_resp(T)] ×W_trend(Tr) × W_stab(St);

[0239] Among them, δ is the basic shrinkage multiple constant, which is similar to β and has a basic impact on the shrinkage result. It can be adjusted according to the specific environment. The default value is δ =0.25; Shrink(L, M, T, Tr, St) is the shrinkage strategy function;

[0240] The providing a final number of instances according to the expansion strategy function or the reduction strategy function includes:

[0241] At 10-second intervals, when the CPU usage ratio or memory usage ratio is greater than 80%, the expansion strategy function is used to determine the final number of instances.

[0242] At a time interval of 10 seconds, when the CPU usage ratio or the memory usage ratio is less than 20%, the scaling-down strategy function is used to determine the final number of instances.

[0243] After obtaining the scaling factor based on the policy function, calculate the actual number of adjusted instances and round it up:

[0244] The final number of instances after expansion = round up {current number of instances × expansion multiple}

[0245] The final number of instances after scaling down = round down {current number of instances × scaling factor}

[0246] After the controller implements the resource change, it saves the scheduling change record information, including the change ID, change time, and usage model.

[0247] Calculate the effect of configuration changes on service indicators after model prediction, with values ​​of: valid or invalid. The specific calculation rules are as follows:

[0248] Set a 10s time interval to continuously obtain 5 sets of data representing service performance, including CPU usage, memory usage, and request response time. Compare and analyze the new data collected with the data before the change, and calculate the average proportion of CPU usage and memory usage before and after the change.

[0249] Determine the effect of configuration changes:

[0250] For capacity expansion: whether the CPU and memory have reached a low or medium load state, that is, the average usage is less than 80% (high load)

[0251] For shrinking: Check whether the CPU and memory have dropped significantly. A significant drop is defined as a percentage change of > 20%. If so, it is considered valid, otherwise it is invalid.

[0252] The configuration change effect and the corresponding change ID record are saved together for use by the resource data analysis and evaluation module.

[0253] The resource controller: implements configuration changes of expanding or shrinking resources according to the final number of instances.

[0254] Specifically, the resource controller is responsible for performing key resource management operations, including expansion, reduction, rescheduling, and preloading, etc. These operations ensure that the computing cluster can flexibly adapt to changes in workloads, thereby optimizing resource utilization and system performance.

[0255] Rearrange: Figure 3 As shown in the figure, the resource controller will comprehensively evaluate the current resource usage of the system and changes in task requirements. Through algorithm optimization, the controller can decide to migrate certain tasks to nodes with less resource usage, or integrate multiple small tasks into a single node to release resources on other nodes. During the implementation process, the controller first generates an optimization plan that ensures that services are not interrupted during the rescheduling process and minimizes performance impact. After that, the controller smoothly redistributes the tasks in the cluster and completes the rescheduling operation while ensuring data consistency and availability. The specific steps are as follows:

[0256] The resource controller collects the current resource usage and service distribution of the system in real time and calculates the remaining resources of each node.

[0257] Sort the service deployments by CPU and memory requirements from large to small.

[0258] Adjust the service deployment configuration template to prioritize services with greater resource requirements.

[0259] The remaining services that occupy less resources are distributed to various running nodes by specifying nodes.

[0260] Preload: Figure 4 As shown in Figure 1, the resource controller can preload the required service plug-ins before the system is about to experience high load. The process of implementing preloading includes determining which resources may be required, when they will be required, and the duration of the requirement. The resource controller then pre-allocates resources based on this information and deploys them to the appropriate location in the cluster. The specific steps are as follows:

[0261] The resource controller evaluates historical data and current system conditions to predict future resource usage trends and high-load periods by using time series models.

[0262] Identify service plug-ins that are likely to be heavily requested during high-load periods and determine their resource requirements.

[0263] Assess the gap between predicted resource demand and existing resource capacity, and plan resource reservation and expansion strategies.

[0264] Implement resource pre-configuration operations to expand service capacity.

[0265] In summary, the technical solutions of various aspects of the present invention have the following advantages compared with the prior art:

[0266] 1) Improve the resource utilization of the Kubernetes cluster;

[0267] 2) Improve the stability of the Kubernetes cluster;

[0268] 3) Ensure the effective operation of service processing plug-ins;

[0269] 4) Improve the response speed of service processing;

[0270] 5) Ensure the normal development of network threat business.

[0271] The second aspect of the present invention discloses an electronic device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps of a method in a dynamic resource allocation system for processing network threats disclosed in any one of the first aspects of the present invention are implemented.

[0272] Figure 5 is a structural diagram of an electronic device according to an embodiment of the present invention, such as Figure 5 As shown, the electronic device includes a processor, a memory, a communication interface, a display screen and an input device connected through a system bus. Among them, the processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the electronic device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, an operator network, near field communication (NFC) or other technologies. The display screen of the electronic device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the electronic device can be a touch layer covered on the display screen, or a key, trackball or touchpad set on the housing of the electronic device, or an external keyboard, touchpad or mouse, etc.

[0273] Those skilled in the art will understand that Figure 5 The structure shown in the figure is only a structural diagram of the part related to the technical solution of the present disclosure, and does not constitute a limitation on the electronic device to which the technical solution of the present application is applied. The specific electronic device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0274] The third aspect of the present invention discloses a storage medium, specifically a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of a method in a dynamic resource allocation system for processing network threats disclosed in any one of the first aspects of the present invention are implemented.

[0275] Please note that the technical features of the above embodiments can be combined arbitrarily. In order to make the description concise, all possible combinations of the technical features in the above embodiments are not described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification. The above embodiments only express several implementation methods of the present application, and their descriptions are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that for ordinary technicians in this field, without departing from the concept of the present application, several variations and improvements can be made, which all belong to the scope of protection of the present application. Therefore, the scope of protection of the patent in this application shall be based on the attached claims.

Claims

1. A dynamic resource allocation system for handling network threats, characterized in that: The system includes: a resource index collection module, a resource data analysis and evaluation module, a resource scheduling strategy module and a resource controller; The resource indicator collection module obtains the service plug-in instance resource allocation indicators, including CPU allocation and memory allocation, and service plug-in instance resource usage indicators by periodically calling the kubernetes resource monitoring plug-in interface. The indicators include CPU usage, memory usage and request response time. The resource data analysis and evaluation module obtains labels of CPU load level, memory load level, response time level, trend and stability indicators by analyzing the CPU allocation, memory allocation, CPU usage, memory usage and request response time; The resource data analysis and evaluation module constructs a prediction model, and uses the average proportion of CPU usage, the average proportion of memory usage and the request response time as model inputs, and uses the CPU usage level, memory usage level, response time level, trend indicators, stability indicators and the configuration change effect of the expansion or contraction of the resource scheduling strategy module as model labels to train and evaluate the prediction model; The resource scheduling strategy module obtains the CPU usage, memory usage and request response time collected in real time; inputs the CPU usage, memory usage and request response time collected in real time into the prediction model to obtain the model output result, and the output result includes the CPU usage level, memory usage level, response time level, trend index and stability index; The resource scheduling strategy module defines a CPU load weight function according to the CPU usage level, defines a memory load weight function according to the memory usage level, defines a response time weight function according to the response time level, defines a trend weight function according to the trend index, and defines a stability weight function according to the stability index; The resource scheduling strategy module constructs an expansion strategy function and a contraction strategy function according to the CPU load weight function, the memory load weight function, the response time weight function, the trend weight function and the stability weight function; and gives the final number of instances according to the expansion strategy function or the contraction strategy function; The resource controller implements a configuration change of expanding or shrinking the resource according to the final number of instances; The resource scheduling strategy module determines the effect of the configuration change of expansion or reduction according to the final number of instances.

2. A dynamic resource allocation system for handling network threats according to claim 1, characterized in that: The resource data analysis and evaluation module obtains labels of CPU load level, memory load level, response time level, trend and stability indicators by analyzing the CPU allocation, memory allocation, CPU usage, memory usage and request response time, including: According to the CPU usage and CPU allocation, the average CPU usage ratio is obtained; According to the memory usage and memory allocation, get the average memory usage ratio; Calculate the CPU change rate based on the CPU usage at the previous moment and the CPU usage at the current moment; Calculate the memory change rate based on the memory usage at the previous moment and the memory usage at the current moment; Calculate the request response time change rate based on the request response time at the previous moment and the request response time at the current moment; Obtaining a CPU load level according to the average proportion of CPU usage; Obtaining a memory load level according to the average proportion of memory usage; According to the comparison between the request response time change rate and the response time threshold, a response time grade label including fast, medium and slow is obtained; Construct characteristic indicators based on the CPU change rate, memory change rate and request response time change rate; According to the comparison between the characteristic index and the characteristic threshold, a trend label including rising, stable and falling is obtained; Calculate a first average value and a first standard deviation of the characteristic index in a first time window; then calculate a second average value and a second standard deviation of the characteristic index in a second time window; compare the second average value with the first average value to calculate the average value change rate; compare the second standard deviation with the first standard deviation to calculate the standard deviation change rate; When both the mean value change rate and the standard deviation change rate exceed the statistical threshold, the label of the stability index is judged to be fluctuation, otherwise, the label of the stability index is judged to be stable.

3. A dynamic resource allocation system for handling network threats according to claim 2, characterized in that: The CPU load level is obtained according to the average proportion of the CPU usage, including: CPU load level = 1 / (1 + e^(-0.1 × (average CPU usage percentage (t-1,t) - 50))); Obtaining the memory load level according to the average proportion of memory usage includes: Memory load level = 1 / (1 + e^(-0.1 × (average memory usage percentage (t-1,t) - 50))); Among them, t represents the current time and t-1 represents the previous time.

4. A dynamic resource allocation system for handling network threats according to claim 2, characterized in that: The comparison of the request response time change rate and the response time threshold to obtain response time grade labels including fast, medium and slow includes: The response time threshold includes: a first response time threshold and a second response time threshold; the first response time threshold is less than the second response time threshold; When the request response time change rate is less than or equal to the first response time threshold, the response time level label is defined as slow; When the first response time threshold < request response time change rate ≤ the second response time threshold, define the response time level label as medium; When the request response time change rate is greater than the second response time threshold, the response time level label is defined as fast.

5. A dynamic resource allocation system for handling network threats according to claim 2, characterized in that: The characteristic index is constructed according to the CPU change rate, memory change rate and request response time change rate, including: Characteristic index = a×CPU change rate + b×memory change rate + c×request response time change rate; Among them, a, b and c are hyperparameters; According to the comparison between the characteristic index and the characteristic threshold, trend labels including rising, stable and falling are obtained, including: The feature threshold includes: a first feature threshold and a second feature threshold; the first feature threshold is greater than the second feature threshold; When the characteristic index is greater than the first characteristic threshold, the trend label is defined as rising; When the first feature threshold ≤ feature index ≤ first feature threshold, the trend label is defined as stable; When the characteristic index is less than the second characteristic threshold, the trend label is defined as decreasing.

6. A dynamic resource allocation system for handling network threats according to claim 1, characterized in that: The resource data analysis and evaluation module constructs a prediction model, including: The prediction model includes: a time series prediction model and a classification prediction model; The time series prediction model is constructed by using the autoregressive integrated moving average method; Adopting decision tree method to construct the classification prediction model; The CPU usage, memory usage and request response time collected in real time are input into the prediction model to obtain the model output result, including: By default, the system inputs the real-time collected CPU usage, memory usage and request response time into the time series prediction model to obtain the model output result; When the system default time series prediction model is manually switched to the classification prediction model, the CPU usage, memory usage and request response time collected in real time are input into the classification prediction model to obtain the model output result.

7. A dynamic resource allocation system for handling network threats according to claim 1, characterized in that: Defining the CPU load weight function according to the CPU usage level includes: W_cpu(L) = 0.7 × e^(1.5 × L); where L is the CPU load level; W_cpu(L) is the CPU load weight function; Defining a memory load weight function according to the memory usage level includes: W_mem(M) = 1.2 × M^2; where M is the memory load level; W_mem(M) is the memory load weight function; Defining a response time weight function according to the response time level includes: W_resp(T) = 3 / log(5 + T); T is the response time level, and its value is: slow = 7, medium = 8, fast = 9; W_resp(T) is the response time weight function; Defining a trend weight function according to a trend indicator includes: W_trend(Tr) = 1.1 × Tr; Tr is a trend indicator, with values ​​of: rising = 1, stable = 0.9, falling = 0.8; W_trend(Tr) is a trend weight function; Defining a stationary weight function according to a stationary index includes: W_stab(St) = 0.9 × sqrt(St); St is the stability index, and its value is: volatility = 1.5, stability = 1.2; W_stab(St) is the stability weight function.

8. A dynamic resource allocation system for handling network threats according to claim 7, characterized in that: The method of constructing a capacity expansion strategy function and a capacity reduction strategy function according to the CPU load weight function, the memory load weight function, the response time weight function, the trend weight function and the stability weight function includes: Expand(L, M, T, Tr, St) = β × [W_cpu(L) + W_mem(M) + W_resp(T)] × W_trend(Tr) × W_stab(St); Among them, β is the basic expansion multiple constant; Expand(L, M, T, Tr, St) is the expansion strategy function; Shrink(L, M, T, Tr, St) = δ × [W_cpu(L) + W_mem(M) + W_resp(T)] × W_trend(Tr) × W_stab(St); Among them, δ is the basic shrinkage multiple constant; Shrink(L, M, T, Tr, St) is the shrinkage strategy function; The providing a final number of instances according to the expansion strategy function or the reduction strategy function includes: At 10-second intervals, when the CPU usage ratio or the memory usage ratio is greater than 80%, the expansion strategy function is used to determine the final number of instances. At 10-second intervals, when the CPU usage ratio or the memory usage ratio is less than 20%, the scaling-down strategy function is used to determine the final number of instances.

9. An electronic device, characterized in that: It comprises a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the method in a dynamic resource allocation system for processing network threats as claimed in any one of claims 1 to 8 is executed.

10. A storage medium, characterized in that: The computer program stored in the storage medium can be executed by one or more processors and can be used to implement the method in a dynamic resource allocation system for processing network threats as claimed in any one of claims 1 to 8.