Dynamic resource adjustment method and related product

By determining the operating scenarios and impact rankings in a containerized environment and dynamically adjusting resource requirements, the business interruption and environmental instability problems caused by static scheduling strategies are resolved, achieving flexible and efficient resource management.

CN120631508APending Publication Date: 2025-09-12NEUSOFT CORP
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510757231.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-06
Publication Date
2025-09-12

AI Technical Summary

Technical Problem

In a containerized environment, static scheduling strategies are difficult to meet dynamic resource demands, resulting in business interruptions and unstable container environments. The existing one-time batch operation adjustment method affects business continuity and environmental performance.

Method used

By determining the operating scenario of the target container environment, marking the service requiring resource adjustment as the first target service, calculating the dynamic weight coefficient and deviation of the indicator to be adjusted, and gradually expanding resources based on the impact ranking, ARIMA, LSTM, and Prophet models are used for resource prediction and reservation.

Benefits of technology

It achieves flexible and efficient resource scheduling in the container environment, reduces the interference of resource adjustments on the overall environment, and maintains business continuity and stability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120631508A_ABST
    Figure CN120631508A_ABST
Patent Text Reader

Abstract

The invention discloses a resource dynamic adjustment method and a related product, in a target container environment, when N services have resource adjustment requirements, firstly, an operation scene is determined, and the services are uniformly marked as target services; then, for each service, identifying an index which needs to be adjusted, and obtaining a current value of each index; according to the operation scene, the target value and the dynamic weight coefficient of each index are calculated, and then the deviation condition of each index is evaluated through the ratio of the current value to the target value (namely, the index deviation degree). And calculating the capacity expansion amount of each service according to the relationship between the deviation degree and the dynamic weight coefficient. When N is greater than 1, calculating the influence degree of each service, and carrying out resource expansion on the target services one by one according to the influence degrees; and when N is equal to 1, resource capacity expansion is directly performed on the target service based on the capacity expansion amount. According to the invention, dynamic adjustment and batch adjustment of resources in the container environment can be realized, so that interference to the whole environment is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method for dynamically adjusting resources and related products. Background Art

[0002] With the rapid development of cloud-native technologies, containerization has become the mainstream approach to modern application deployment. By packaging applications and their dependencies in an isolated environment, container technology enables applications to be quickly and easily deployed and run in different environments, greatly improving application portability and flexibility.

[0003] In containerized environments, resource demands and container environment status fluctuate significantly over time. When scheduling adjustments are necessary (such as data center migration or service architecture restructuring), container environments typically use static scheduling strategies for resource scheduling, completing adjustments in a one-time batch operation.

[0004] While this strategy can simplify management, static scheduling strategies struggle to meet dynamic demands. Furthermore, this "one-size-fits-all" approach (i.e., one-time, batch operations) not only impacts business continuity but can also trigger chain reactions that destabilize the container environment. For example, migrating all services of a microservice simultaneously can cause that service to become unavailable for a short period of time. Similarly, adjusting resource quotas for multiple containers simultaneously can lead to significant fluctuations in container environment performance, or even crashes. Summary of the Invention

[0005] Based on the above problems, this application provides a dynamic resource adjustment method and related products, aiming to achieve flexible and efficient resource scheduling in a containerized environment to cope with dynamic demand changes and avoid business interruptions and unstable container environment performance caused by static scheduling strategies.

[0006] The embodiments of this application disclose the following technical solutions:

[0007] A method for dynamically adjusting resources, the method comprising:

[0008] When N services in the target container environment have resource adjustment requirements, determining an operating scenario of the target container environment, and determining all of the N services in the target container environment that have resource adjustment requirements as first target services; N is a positive integer;

[0009] For each of the first target services, determining a plurality of indicators to be adjusted, and obtaining a current value of each of the indicators to be adjusted;

[0010] Determining a dynamic weight coefficient and a target value for each of the indicators to be adjusted based on the operating scenario, and calculating an indicator deviation of the indicator to be adjusted based on the target value of the indicator to be adjusted and the current value of the indicator to be adjusted; the indicator deviation = current value / target value; the indicator deviation has a one-to-one correspondence with the dynamic weight coefficient;

[0011] Calculating the expansion capacity of each first target service based on the indicator deviations of the plurality of indicators to be adjusted corresponding to each first target service and the dynamic weight coefficients corresponding to the indicator deviations;

[0012] When N is greater than 1, the impact of each first target service is calculated in combination with the expansion capacity of each first target service, and based on the size of the impact of each first target service, the resources of each first target service are expanded in sequence in combination with the expansion capacity of each first target service; when N is equal to 1, the resources of the first target service are expanded based on the expansion capacity of the first target service.

[0013] In a possible implementation, calculating the impact of each first target service in combination with the capacity expansion of each first target service includes:

[0014] For each first target service, determining a service level and a workload type of the first target service in the target container environment; the service level includes any one of core services, important services, ordinary services, and background tasks; and the workload type includes any one of central processing unit (CPU) intensive, memory intensive, input / output (IO) intensive, and regular.

[0015] Determining a grade weight corresponding to a service grade of each first target service and a load weight corresponding to a workload type; each service grade is preset with a corresponding grade weight; each workload type is preset with a corresponding load weight;

[0016] For each of the first target services, the impact of the first target service is calculated based on the level weight corresponding to its business level, the load weight corresponding to the workload type, and the expansion capacity.

[0017] In a possible implementation, the method further includes:

[0018] When no service in the target container environment has a resource adjustment requirement, for any service in the target container environment, the service is determined as a second target service, and a first historical data set of the second target service is obtained; the first historical data set includes multiple first subsets, each of the first subsets includes multiple first historical resource usage indicators, the first historical resource usage indicators in the same first subset have the same indicator category, and the first historical resource usage indicators in different first subsets have different indicator categories;

[0019] Predicting a set of predicted resource usage of the second target service at the next moment based on the first historical data set; the predicted resource usage includes a first prediction set, a second prediction set, and a third prediction set, each prediction set includes multiple prediction values, and the indicator categories of the respective prediction values ​​in the same prediction set are different;

[0020] Determining a preset accuracy rate corresponding to each predicted value in the predicted resource usage;

[0021] For each indicator category, based on the corresponding predicted values ​​of the indicator category in the first prediction set, the second prediction set, and the third prediction set and the accuracy rates of the predicted values, calculate the predicted resource usage of the indicator category;

[0022] Resources are reserved for the second target service based on all the predicted resource usages.

[0023] In a possible implementation, predicting a predicted resource usage set of the second target service at the next moment based on the first historical data set includes:

[0024] Taking each of the first subsets as input, respectively, and using an autoregressive integrated moving average model (ARIMA) model to predict resource usage of the second target service at the next moment to obtain the first prediction set;

[0025] Taking each of the first subsets as input, respectively, and using a long short-term memory network model (LSTM) model to predict the predicted resource usage of the second target service at the next moment to obtain the second prediction set;

[0026] Each of the first subsets is taken as input respectively, and the Prophet model is used to predict the predicted resource usage of the second target service at the next moment to obtain the third prediction set.

[0027] In a possible implementation, for each indicator category, calculating the predicted resource usage of the indicator category based on the predicted values ​​corresponding to the indicator category in the first prediction set, the second prediction set, and the third prediction set and the accuracy rates corresponding to the predicted values ​​includes:

[0028] For each indicator category, obtaining prediction values ​​belonging to the indicator category in the first prediction set, the second prediction set, and the third prediction set to obtain a first calculated value, a second calculated value, and a third calculated value;

[0029] Normalizing the accuracy rates corresponding to the first calculated value, the second calculated value, and the third calculated value to obtain calculation weights corresponding to the respective calculated values;

[0030] For each indicator category, the predicted resource usage of the indicator category is calculated based on the corresponding first calculated value, the second calculated value, the third calculated value and the calculation weights corresponding to the respective calculated values.

[0031] In a possible implementation, the reserving resources for the second target service based on all the predicted resource usages includes:

[0032] For each indicator category, determine the preset prediction confidence adjustment factor and basic buffer ratio for the indicator category;

[0033] For each indicator category, the reserved resources are calculated based on the predicted resource usage, basic buffer ratio, and prediction confidence adjustment factor of the indicator category;

[0034] Resource reservation is performed based on the reserved resources corresponding to each indicator category.

[0035] In one possible implementation, the process of presetting the accuracy rate and the prediction confidence adjustment factor includes:

[0036] For each indicator category, construct a second historical data set; the second historical data set includes a plurality of second historical resource usage indicators;

[0037] For each indicator category, use the ARIMA model, the LSTM prediction model, and the Prophet model to predict resource usage of the second historical data set, respectively, to obtain a first future resource usage, a second future resource usage, and a third future resource usage for the indicator category;

[0038] For each indicator category, statistical analysis is performed on the first future resource usage, the second future resource usage, the third future resource usage, and the actual resource usage corresponding to each future resource usage for the indicator category, to obtain the accuracy of the indicator category in the ARIMA model, the LSTM prediction model, and the Prophet model, as well as the prediction confidence adjustment factor for the indicator category;

[0039] Among them, one indicator category corresponds to one prediction confidence adjustment factor; the accuracy of each predicted value in the first prediction set is the accuracy of the indicator category to which it belongs in the ARIMA model; the accuracy of each predicted value in the second prediction set is the accuracy of the indicator category to which it belongs in the LSTM prediction model; the accuracy of each predicted value in the third prediction set is the accuracy of the indicator category to which it belongs in the Prophet model.

[0040] A dynamic resource adjustment system, comprising a resource monitor, a performance analyzer, a state evaluator, and a progressive scheduler connected in sequence;

[0041] The resource monitor is configured to, when N services in the target container environment have resource adjustment requirements, determine an operating scenario of the target container environment and determine all of the N services in the target container environment that have resource adjustment requirements as first target services; N is a positive integer;

[0042] The performance analyzer is configured to determine, for each of the first target services, a plurality of indicators to be adjusted, and obtain a current value of each of the indicators to be adjusted;

[0043] The state evaluator is configured to obtain a current value of each of the indicators to be adjusted, and determine a dynamic weight coefficient and a target value for each of the indicators to be adjusted based on the operating scenario, so as to calculate an indicator deviation of the indicator to be adjusted based on the target value of the indicator to be adjusted and the current value of the indicator to be adjusted; the indicator deviation = current value / target value; the indicator deviation has a one-to-one correspondence with the dynamic weight coefficient;

[0044] The state evaluator is further configured to calculate the expansion capacity of each first target service based on the indicator deviations of the plurality of indicators to be adjusted corresponding to each first target service and the dynamic weight coefficients corresponding to the indicator deviations;

[0045] The progressive scheduler is used to calculate the impact of each first target service in combination with the expansion capacity of each first target service when N is greater than 1, and based on the size of the impact of each first target service, in combination with the expansion capacity of each first target service, sequentially expand the resources of each first target service; when N is equal to 1, expand the resources of the first target service based on the expansion capacity of the first target service.

[0046] A computer-readable storage medium stores instructions, which, when executed on a terminal device, enable the terminal device to execute the above-mentioned method for dynamically adjusting resources.

[0047] A processor is used to run a computer program, wherein the program executes the above-mentioned dynamic resource adjustment method when running.

[0048] Compared with the existing technology, this application has the following beneficial effects:

[0049] In an embodiment of the present application, when one or more services (denoted as N) in the target container environment have resource adjustment requirements, it is first necessary to determine the operating scenario of the target container environment. Then, all services with resource adjustment requirements will be uniformly marked as first target services. Next, for each first target service, its multiple performance indicators to be adjusted are determined, and the current values ​​of these indicators are recorded. Based on the operating scenario, dynamic weight coefficients and target values ​​are calculated for each indicator to be adjusted. Subsequently, by comparing the current value of each indicator to be adjusted with the target value, the deviation of each indicator is calculated, that is, the deviation is obtained by the "current value / target value" formula, and the expansion requirements of each service are calculated based on the correspondence between the deviation and the dynamic weight coefficient. When N is greater than 1, the impact of each target service is first calculated, and the resources of these target services are expanded in sequence according to the impact size and expansion requirements. When N is equal to 1, adjustments are made directly according to the expansion requirements of the single target service. This application achieves accurate resource allocation by dynamically calculating the resource adjustment requirements of each service, combining the current operating status and actual needs of the target container environment. At the same time, a resource expansion strategy based on impact ranking is adopted, so that the resource adjustment process can be carried out gradually, thereby prioritizing resource expansion for services with higher impact, so as to effectively reduce the interference of resource adjustment on the overall environment and ensure that the container environment maintains business continuity and stability when making resource adjustments. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, 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 only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0051] Figure 1 A schematic diagram of dynamically adjusting container environment resources provided in an embodiment of the present application;

[0052] Figure 2 A flowchart of an implementation method of a dynamic resource adjustment method provided in an embodiment of the present application;

[0053] Figure 3 A flowchart of an implementation method of an influence calculation method provided in an embodiment of the present application;

[0054] Figure 4 A flowchart of an implementation method of a resource reservation method provided in an embodiment of the present application;

[0055] Figure 5 A flowchart of an implementation method of a method for predicting resource usage provided in an embodiment of the present application;

[0056] Figure 6 A flowchart of another implementation method of a resource reservation method provided in an embodiment of the present application;

[0057] Figure 7 A flowchart of an implementation method for presetting an accuracy rate and prediction confidence provided in an embodiment of the present application;

[0058] Figure 8 A structural diagram of a dynamic resource adjustment system provided in an embodiment of the present application. DETAILED DESCRIPTION

[0059] As previously described, with the rapid development of cloud-native technologies, containerization has become the mainstream approach to modern application deployment, significantly improving application portability and flexibility. However, in containerized environments, resource demands and container environment status fluctuate over time, and scheduling adjustments (such as cross-region migrations or architectural reorganizations) typically rely on static scheduling policies and one-time batch operations. While this approach simplifies management, it cannot adapt to dynamically changing requirements, and "one-size-fits-all" adjustments can disrupt business continuity and trigger a chain reaction of container environment instability.

[0060] Based on this, an embodiment of the present application provides a method for dynamic adjustment of resources and related products. When N services in a target container environment have resource adjustment requirements, the operating scenario of the environment is first determined, and these services with resource adjustment requirements are recorded as first target services. For each first target service, its multiple indicators to be adjusted are determined and the current values ​​of these indicators are obtained. Based on the operating scenario, the dynamic weight coefficient and target value of each indicator to be adjusted are determined, and the deviation of each indicator is calculated (indicator deviation = current value / target value). Then, the indicator deviation and the corresponding dynamic weight coefficient of each first target service are used to calculate its expansion capacity. When N is greater than 1, the influence of each first target service is calculated, and the resource expansion is performed in turn according to the size of the influence; when N is equal to 1, the resource expansion is performed directly on the only target service according to the calculated expansion capacity. This application can accurately adjust resources by dynamically calculating the resource adjustment requirements of each service and combining it with the actual operating status of the current container environment. At the same time, resource expansion adopts a strategy based on impact sorting to ensure that resource expansion can be carried out step by step according to priority, giving priority to those services that have a greater impact on the container environment. This can effectively reduce the interference of resource adjustments on the overall environment, thereby maintaining business continuity and the stability of the container environment.

[0061] In order to help those skilled in the art better understand the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. 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 those skilled in the art without creative work are within the scope of protection of this application.

[0062] See also Figure 1 , which is a schematic diagram of dynamically adjusting container environment resources provided in an embodiment of the present application.

[0063] In actual applications, the target container environment (Target Container Environment) refers to a group of server clusters that provides the basic environment for running applications or tasks.

[0064] Service: An application or task instance running in a cluster, typically packaged and deployed in a container. Services can adopt a microservices architecture, which divides the application into a set of independent services, each of which can be deployed and scaled independently.

[0065] Instance: A service instance can correspond to multiple container instances. Each instance represents a specific execution unit of the service and can run in one or more containers. Each instance contains the application and its dependencies, sharing a portion of the underlying host operating system, memory, and processor, but is isolated from each other.

[0066] Container: A lightweight virtualization technology used to package and run applications.

[0067] Container resource usage, such as central processing unit (CPU) utilization, memory utilization, network input / output (IO), queries per second (QPS), and disk input / output (IO), are key indicators for dynamically adjusting container environment resources.

[0068] When services in the target container environment require resource adjustment, the target container environment's operating scenario can be determined, and all services in the target container environment requiring resource adjustment can be identified as first target services (the number of first target services is M, where M is a positive integer greater than 1). An operating scenario refers to the resource allocation and workload of the entire container environment at a specific point in time. Operating scenarios include peak business hours, CPU-intensive scenarios, and memory-intensive scenarios. Within the target container environment, resources need to be dynamically adjusted based on load changes, depending on the application scenario. For example, during the "Double 11" shopping festival, when user traffic to an e-commerce platform surges, resulting in a significant increase in computing and storage resource consumption for services such as order processing and payment processing, the container environment can be identified as operating in a peak business hours scenario, and resource expansion of these services is required to cope with the transient high load. Similarly, when a video processing application needs to process large numbers of high-definition video files, the target container environment can be identified as operating in a CPU-intensive scenario, as the video encoding and decoding processes rely heavily on computing power. Therefore, more CPU resources need to be allocated to the processing tasks. Furthermore, when data analytics applications perform large-scale data processing, they require large amounts of memory for caching and processing. In these cases, the container environment can be identified as operating in a memory-intensive scenario and dynamically adjust memory resources as needed. By identifying these different scenarios, the container environment can intelligently optimize and adjust resources to ensure stable application operation.

[0069] Next, a series of metrics to be adjusted are identified for each primary target service. Each primary target service may involve multiple metrics to comprehensively reflect the service's operational status and performance. For example, an e-commerce platform's order processing service might require adjustments to metrics such as CPU utilization, memory utilization, network I / O, QPS, and disk I / O. After determining these metrics, the target container environment uses monitoring tools to obtain the current value of each metric in real time, enabling subsequent performance analysis and resource optimization.

[0070] Based on the operational scenario, the dynamic weight coefficient and target value for each metric to be adjusted are determined. The metric deviation is calculated by comparing the deviation between the current value and the target value. Because the resource requirements and optimization goals of the target container environment vary in different operational scenarios, the dynamic weight coefficient and target value of the metric to be adjusted will also vary in each scenario. For example, during peak business hours, the target container environment may need to increase the weight of queries per second (QPS) to handle a large number of requests. In CPU-intensive scenarios, the focus is on increasing the CPU weight to ensure efficient execution of computing tasks. In memory-intensive scenarios, the target container environment may prefer to increase the weight of memory to optimize data processing performance. During this process, metric deviation measures the deviation between the current value and the target value. The calculation formula is: metric deviation = current value / target value. Each dynamic weight coefficient corresponds to a metric deviation. For example, in a CPU-intensive scenario, the metrics to be adjusted for the first target service include CPU utilization, QPS, and memory utilization. The current CPU utilization is 85%, the dynamic weight coefficient is 0.5, and the target is 60%. The current QPS is 2500 requests / second, the dynamic weight coefficient is 0.3, and the target is 2000 requests / second. The current memory utilization is 80%, the dynamic weight coefficient is 0.2, and the target is 70%. Therefore, the CPU utilization metric deviation is 85% / 60% ≈ 1.4, which corresponds to a deviation of 0.5. The QPS metric deviation is 2500 / 2000 ≈ 1.3, which corresponds to a deviation of 0.3. The memory utilization metric deviation is 80% / 70% ≈ 1.2, which corresponds to a deviation of 0.2.

[0071] The required capacity expansion for each first target service is then calculated based on the deviations of the multiple metrics to be adjusted for each first target service and the dynamic weight coefficients corresponding to these deviations. For example, in a CPU-intensive scenario, the metrics to be adjusted for the first target service include CPU utilization, QPS, and memory utilization. The CPU utilization metric deviation is 1.4, and the dynamic weight coefficient corresponding to this deviation is 0.5; the QPS metric deviation is 1.3, and the dynamic weight coefficient corresponding to this deviation is 0.3; the memory utilization metric deviation is 1.2, and the dynamic weight coefficient corresponding to this deviation is 0.2. Based on this data, the required capacity expansion for the first target service can be calculated using the following formula: 0.5 × 1.4 + 0.3 × 1.3 + 0.2 × 1.2 = 1.33.

[0072] Finally, the impact of each first target service is calculated based on the level weight corresponding to the business level of each first target service, the load weight corresponding to the workload type, and the expansion capacity, and these services are sorted according to the size of the impact. Then, combined with the expansion capacity of each service, the resources of these services are expanded in order of size. For example, M is 2, and the number of first target services is 2. The first first target service has a level weight of 1.0, a load weight of 0.8, and a load weight of 3; the second first target service has a level weight of 0.4, a load weight of 0.6, and a load weight of 5. Then the impact of the first first target service = 3×1.0×0.8=2.4, and the impact of the second first target service = 5×0.4×0.6=1.2. The impact of the first first target service is greater than that of the second service, so the first first target service will be given priority for resource expansion.

[0073] Those skilled in the art will understand that Figure 1 The framework diagram shown is only an example in which the embodiments of the present application can be implemented. The scope of application of the embodiments of the present application is not limited by any aspect of the framework.

[0074] To facilitate understanding of the present application, a method for dynamically adjusting resources provided in an embodiment of the present application is described below with reference to the accompanying drawings.

[0075] See also Figure 2 As shown in FIG, this figure is a flow chart of an implementation method of a dynamic resource adjustment method provided in an embodiment of the present application, as shown in FIG. Figure 2 As shown, the method may include the following steps:

[0076] S201: When N services in a target container environment have resource adjustment requirements, determine an operation scenario of the target container environment, and determine all of the N services in the target container environment that have resource adjustment requirements as first target services.

[0077] When resource adjustment requirements arise for N services in the target container environment, the first thing to do is to determine the specific operating scenario of the target container environment. Different operating scenarios will directly affect the resource adjustment strategy and priority. For example, in business peak scenarios, more resources may be required to handle a large number of requests; in CPU-intensive scenarios, it may be necessary to optimize CPU allocation to improve computing efficiency; and in memory-intensive scenarios, memory configuration and allocation may become key factors. Based on different operating scenarios, the target container environment will uniformly regard the N services in the target container environment that have resource adjustment requirements as "first target services" so that appropriate resource expansion and optimization adjustments can be made based on the specific needs of these services. Here, N represents the number of services, which is a positive integer, meaning that at least one service has resource adjustment requirements.

[0078] In one possible implementation, an operation scenario refers to the working state of a container environment under specific conditions. Depending on different requirements and load types, the operation scenario may include, but is not limited to, any one of a business peak scenario, a CPU-intensive scenario, and a memory-intensive scenario.

[0079] Peak business scenarios typically occur when business demand surges, such as during e-commerce promotions or specific holidays. The target container environment needs to handle a large number of concurrent requests, increasing the demand for resources. CPU-intensive scenarios refer to when computing tasks in the target container environment require high CPU usage, such as large-scale data analysis, video processing, or scientific computing. In this case, CPU allocation and scheduling need to be optimized. Memory-intensive scenarios occur when the target container environment requires a large amount of memory to store and process data. For example, in tasks such as big data processing, caching large amounts of data, or image rendering, the configuration of memory resources is crucial. Different operating scenarios determine the strategy and focus of container resource adjustment, so adaptation and optimization are required based on specific scenarios.

[0080] S202: For each of the first target services, determine a plurality of indicators to be adjusted, and obtain a current value of each of the indicators to be adjusted.

[0081] For each container identified as the first target service, it is first necessary to identify its multiple indicators to be adjusted. These indicators usually include CPU utilization, memory utilization, network IO, QPS, and disk IO, which directly affect the performance and stability of the container. Each indicator to be adjusted represents a certain aspect of the container's resource usage requirements. For example, CPU utilization reflects the load of the computing task, and memory usage reveals the container's needs in data storage or processing. Next, the target container environment will obtain the current value of each indicator to be adjusted in real time, and obtain the latest status of these indicators through the data collection function of the monitoring system. Understanding the current values ​​of these indicators is the basis for subsequent resource optimization and adjustment, and can help the target container environment make accurate expansion or resource allocation decisions to ensure that the service can achieve optimal performance during operation.

[0082] S203: Determine a dynamic weight coefficient and a target value of each indicator to be adjusted based on the operation scenario, and calculate the indicator deviation of the indicator to be adjusted based on the target value of the indicator to be adjusted and the current value of the indicator to be adjusted.

[0083] In order to make effective resource adjustments for different operating scenarios, the dynamic weight coefficient and target value of each indicator to be adjusted can also be determined based on the specific operating scenario. The dynamic weight coefficient represents the importance of different indicators in a specific scenario, while the target value is the optimal state that the expected indicator should achieve. For example, in a CPU-intensive scenario, the target value for CPU utilization may be higher, while the target value for memory usage may be relatively low. The target container environment then calculates the deviation of the indicator based on the difference between the current value and the target value of each indicator to be adjusted. The deviation is calculated as follows: Indicator deviation = current value / target value. This calculation helps to quantify the gap between current resource usage and expected targets, and then evaluate the rationality of resource allocation.

[0084] Among them, there is a one-to-one correspondence between the indicator deviation and the dynamic weight coefficient, which means that the deviation of each indicator and its corresponding weight together affect the adjustment decision.

[0085] It should be noted that the one-to-one correspondence between indicator deviation and dynamic weight coefficient is derived from the target value. Specifically, there is a correspondence between the dynamic weight coefficient and the target value of each indicator to be adjusted. This means that in different operating scenarios, the target value and corresponding dynamic weight coefficient of each indicator are pre-set. Therefore, the indicator deviation calculated from the target value also has a corresponding relationship with the dynamic weight coefficient.

[0086] For example, assume the following metrics and their associated parameters: CPU utilization: target value = 80%, dynamic weight coefficient = 0.5, current value = 90%; memory utilization: target value = 70%, dynamic weight coefficient = 0.3, current value = 75%; QPS: target value = 1000 requests / second, dynamic weight coefficient = 0.2, current value = 1500 requests / second. Calculate metric deviations: CPU utilization metric deviation = 90% / 80% = 1.125; memory utilization metric deviation = 75% / 70% = 1.071; QPS metric deviation = 1512 / 1000 = 1.512. Therefore, a memory utilization metric deviation of 1.125 corresponds to a dynamic weight coefficient of 0.5, a memory utilization metric deviation of 1.071 corresponds to a dynamic weight coefficient of 0.3, and a QPS metric deviation of 1.512 corresponds to a dynamic weight coefficient of 0.2.

[0087] It's also important to note that the target container environment's resource requirements and optimization goals vary across different operating scenarios. Therefore, the dynamic weight coefficients and target values ​​for the metrics to be adjusted will also differ in each scenario. Each operating scenario corresponds to a set of dynamic weight coefficients, and the sum of these dynamic weight coefficients always equals 1. This weight configuration ensures rational resource allocation.

[0088] For example, during peak business hours, the target container environment needs to handle a higher number of requests, making QPS the most important optimization metric. In this scenario, the weight of QPS is increased, while the weights of other metrics may be reduced. For example, the QPS weight can be set to 0.6, while the CPU and memory weights can be set to 0.2 and 0.2, respectively. In this case, the goal is to optimize the target container environment's responsiveness and concurrency to ensure efficient processing of more requests.

[0089] CPU-intensive scenarios: In CPU-intensive tasks, CPU resources become the focus of optimization. For example, if a computing task requires more computing power, the dynamic weight coefficient of CPU might be set to 0.7, while the weights of QPS and memory might be set to 0.15 and 0.15, respectively. In this case, the goal is to optimize computing performance and ensure that the target container environment can handle high-load computing tasks.

[0090] Memory-intensive scenarios: In memory-intensive applications, memory becomes a bottleneck, requiring additional memory resources to ensure stable operation of the target container environment. For example, in this scenario, the memory weight can be set to 0.6, and the QPS and CPU weights to 0.2 and 0.2, respectively. This prioritizes memory expansion in the target container environment to avoid performance degradation or crashes caused by insufficient memory.

[0091] S204: Calculate the expansion capacity of each first target service based on the indicator deviations of the plurality of indicators to be adjusted corresponding to each first target service and the dynamic weight coefficients corresponding to the indicator deviations.

[0092] Based on the indicator deviations of multiple indicators to be adjusted corresponding to each first target service, the performance deficiencies of the target container environment can be evaluated by analyzing the degree of deviation of these indicators. The deviation of each indicator reflects the gap between the current actual value and the target value, which in turn affects the optimization direction of each service. At the same time, for each indicator deviation, a corresponding dynamic weight coefficient is set in advance. These weights determine the proportion of each indicator in the optimization process. By combining the deviation of each indicator and its corresponding dynamic weight coefficient, the expansion capacity of each first target service can be calculated. This expansion capacity represents the amount of resources that need to be increased in order to achieve the target optimization effect under the current circumstances. In this way, the target container environment can dynamically adjust resources based on the deviation of the indicators and the weight distribution to ensure that each indicator is effectively optimized, thereby achieving overall performance improvement.

[0093] In a possible implementation, the expansion capacity of each first target service can be calculated by multiplying the indicator deviation of each to-be-adjusted indicator corresponding to each first target service by the dynamic weight coefficient corresponding to the indicator deviation, and then adding the results.

[0094] For example, assume that there are three first target services in the target container environment: Service A, Service B, and Service C. The metrics to be adjusted for Services A, B, and C are CPU utilization, QPS, and memory utilization. The target container environment operates in a CPU-intensive scenario, corresponding to a set of dynamic weighting coefficients: CPU utilization weighting of 0.5, QPS weighting of 0.3, and memory utilization weighting of 0.2. For Service A, the CPU utilization metric deviation is 1.4, and the dynamic weighting coefficient corresponding to the CPU utilization metric deviation is 0.5. The QPS metric deviation is 1.33, and the dynamic weighting coefficient corresponding to the QPS metric deviation is 0.3. The memory utilization metric deviation is 1.2, and the dynamic weighting coefficient corresponding to the memory utilization metric deviation is 0.2. Therefore, the expansion capacity of Service A = 0.5 × 1.4 + 0.3 × 1.33 + 0.2 × 1.2 = 1.339. In service B, the CPU utilization indicator deviation is 1.5, and the corresponding dynamic weight coefficient is 0.5. The QPS rate indicator deviation is 1.12, and the corresponding dynamic weight coefficient is 0.3. The memory utilization indicator deviation is 1.15, and the corresponding dynamic weight coefficient is 0.2. Therefore, the expansion capacity of service B = 0.5 × 1.5 + 0.3 × 1.12 + 0.2 × 1.15 = 1.316. In service C, the CPU utilization indicator deviation is 1.32, and the corresponding dynamic weight coefficient is 0.5. The QPS rate indicator deviation is 1.44, and the corresponding dynamic weight coefficient is 0.3. The memory utilization indicator deviation is 1.24, and the corresponding dynamic weight coefficient is 0.2. Therefore, the expansion capacity of service C = 0.5 × 1.32 + 0.3 × 1.44 + 0.2 × 1.24 = 1.34.

[0095] S2051: When N is greater than 1, the impact of each first target service is calculated in combination with the expansion capacity of each first target service, and based on the size of the impact of each first target service, the resources of each first target service are expanded in sequence in combination with the expansion capacity of each first target service.

[0096] When N is greater than 1, the impact of each target service must be calculated based on its capacity expansion. The impact reflects the contribution of each target service to the overall performance or resource requirements of the target container environment, while the capacity expansion represents the resource expansion capacity allocated to each target service by the target container environment. By ranking each target service's impact and combining it with its capacity expansion, resource expansion can be performed on these target services in order.

[0097] For example, assume we have three primary target services, A, B, and C, with expansion capacities a, b, and c, respectively. First, calculate the impact of each service, IA, IB, and IC, based on the expansion capacity. Then, sort the services by impact: IB > IA > IC. Finally, follow this order and scale resources for B, A, and C based on their corresponding expansion capacities, b, a, and c.

[0098] Through such calculation and sorting, an efficient resource expansion process can be achieved, so that the target container environment can prioritize target services with higher performance requirements, thereby improving the overall efficiency and stability of the target container environment.

[0099] S2052: When N is equal to 1, expand the resources of the first target service based on the expansion capacity of the first target service.

[0100] When N equals 1, this means that only one target service in the target container environment requires resource expansion. In this case, resource expansion can be based on the expansion capacity of this target service. In other words, when N equals 1, there's no need to consider resource competition or ranking issues among multiple target services; all resource expansion decisions are focused on this single target service. Therefore, the required resources can be directly allocated to this service based on its expansion capacity, optimizing the overall performance of the target container environment.

[0101] Based on the description of steps S201-S2051 and S2052, in an embodiment of the present application, when one or more services in the target container environment need to adjust resources, the operation scenario is first determined, and the service with adjustment requirements is used as the target service. Then, for each target service, multiple indicators that need to be adjusted are determined, and the current values ​​of these indicators are obtained. Next, based on the operation scenario, the dynamic weight coefficient and target value of each indicator are determined, and the indicator deviation (the ratio of the current value to the target value) is calculated. Each indicator deviation corresponds to a dynamic weight coefficient, and the expansion requirements of each target service are calculated based on these indicator deviations and weights. If the number of target services is greater than 1, the services are expanded in order according to the impact size and the expansion requirements of each service; if there is only one service, it is adjusted directly according to its expansion requirements. The present application can realize flexible and efficient resource scheduling in a containerized environment to cope with dynamic demand changes and avoid business interruptions and unstable container environment performance caused by static scheduling strategies.

[0102] In a possible implementation, the present application embodiment also provides a method for calculating the influence. Figure 3 As shown, Figure 3A flowchart of an implementation method of an influence calculation method provided in an embodiment of the present application is provided. Accordingly, in step S2051, the influence of each first target service is calculated in combination with the expansion capacity of each first target service. Specifically, steps S301-S303 can be implemented:

[0103] S301: For each first target service, determine the service level and workload type of the first target service in the target container environment.

[0104] In the process of calculating the service impact, for each first target service, it is first necessary to determine its business level and workload type in the target container environment. The business level reflects the importance of the tasks undertaken by the service in the target container environment. It is usually divided into four types according to the degree of impact of the tasks on the overall business operation: core business, important business, ordinary business, and background tasks. Each type of task has different resource requirements. Core business usually requires higher priority resource allocation, while background tasks have fewer resource requirements. Workload types are classified according to the resource consumption characteristics of the service. Common types include CPU intensive, memory intensive, IO intensive, and regular. Different workload types determine the intensity of the service's demand for different types of resources, thereby affecting resource scheduling and optimization strategies.

[0105] It should be noted that the core business, important business, ordinary business and background tasks in the service business level are classified according to the resource requirements of the task in the target container environment and its importance to the business.

[0106] Core tasks: In a container environment, core tasks are those that directly impact business objectives or the normal operation of the container environment. These tasks are typically prioritized and allocated more resources to ensure high availability and responsiveness of the container environment. For example, in an e-commerce application, payment processing and order confirmation may be core tasks.

[0107] Important tasks: Although not directly impacting system operations, these tasks still significantly impact the overall performance and user experience of the container environment. These tasks are prioritized, but in some cases can tolerate moderate delays. Examples include user recommendation algorithms and search services.

[0108] Normal tasks: These tasks do not directly impact the core functionality of the container environment and have relatively low performance requirements. These tasks can be performed when the container environment is highly loaded or scheduled during off-peak hours. Examples include background statistical analysis and logging.

[0109] Background tasks: These tasks typically run for a long time and consume relatively stable or low amounts of container environment resources. They do not impact the system's real-time performance during execution. Background tasks are typically executed asynchronously. Examples include regular system backups and cache cleanups.

[0110] It should also be noted that the CPU-intensive, memory-intensive, IO-intensive, and regular types of service workloads are classified according to the characteristics of the task's consumption of container environment resources.

[0111] CPU-intensive tasks are those that require significant computation and rely on the CPU's computing power. These tasks typically require executing complex calculations and algorithms or processing large amounts of data. Examples include big data analysis, video rendering, and encryption and decryption.

[0112] Memory-intensive tasks: Memory-intensive tasks are those that require high memory requirements, typically processing large amounts of data or performing extensive data caching operations. These tasks use a lot of memory but don't require a lot of computing resources. Examples include data caching, real-time data stream processing, and large-scale database queries.

[0113] I / O-intensive tasks primarily rely on input / output operations, such as disk read / write operations and network communications. The bottleneck for these tasks is often data transfer and storage, rather than computation. Examples include file uploads and downloads, database disk read / write operations, and network requests.

[0114] Regular tasks have a relatively balanced demand for CPU, memory, and I / O. Typically, these tasks have a balanced resource consumption and are not extremely dependent on any one resource. Examples include lightweight applications and daily operations such as small database queries and network requests.

[0115] Through these classifications, the container environment can reasonably allocate and optimize resources according to the characteristics and importance of the tasks, ensuring the efficient operation of the system.

[0116] S302: Determine the level weight corresponding to the service level and the load weight corresponding to the workload type of each of the first target services.

[0117] In order to allocate resources reasonably and optimize the performance of the target container environment, it is also necessary to determine the weights of the business level and workload type of each first target service. Each business level corresponds to a preset level weight, which indicates the importance or priority of the business in the system. For example, core business may have a higher weight, while ordinary business may have a lower weight. Similarly, each workload type (such as CPU intensive, memory intensive, etc.) also has a corresponding preset load weight to reflect the resource consumption requirements of the load type.

[0118] In one possible implementation, the preset level weight of core business is 1.0, the preset level weight of important business is 0.8, the preset level weight of ordinary business is 0.6, and the preset level weight of background business is 0.4.

[0119] In a possible implementation, the CPU-intensive preset load weight is 0.8, the memory-intensive preset load weight is 0.7, the IO-intensive preset load weight is 0.6, and the general preset load weight is 0.5.

[0120] S303: For each first target service, calculate the impact of the first target service based on the level weight corresponding to its business level, the load weight corresponding to the workload type, and the expansion capacity.

[0121] For each primary target service, the impact of that service is calculated by comprehensively considering the level weight corresponding to its service level, the load weight corresponding to its workload type, and the expansion capacity. Specifically, the service level of each service is first determined and assigned a corresponding level weight. Furthermore, a load weight is assigned based on its workload type. These weights are then combined with the expansion capacity to calculate a comprehensive impact value.

[0122] For example, assume there are two primary target services, Service A and Service B. Service A has a level weight of 1.0, a load weight of 0.8, and an expansion capacity of 3. Service B has a level weight of 0.4, a load weight of 0.6, and an expansion capacity of 5. Therefore, Service A's influence = 3 × 1.0 × 0.8 = 2.4, and Service B's influence = 5 × 0.4 × 0.6 = 1.2. Service A has a greater influence than Service B, so Service A is prioritized for resource expansion.

[0123] Through steps S301-S303, resource scheduling can be further optimized to ensure that high-priority, high-load services obtain the required resources first, so as to maintain the overall balance and efficiency of the target container environment.

[0124] In a possible implementation, the present application embodiment also provides a resource reservation method. Figure 4 As shown, Figure 4 A flowchart of an implementation method of a resource reservation method provided in an embodiment of the present application can be implemented through steps S401-S405:

[0125] S401: When any service in the target container environment has no resource adjustment requirement, for any service in the target container environment, determine the service as a second target service, and obtain a first historical data set of the second target service.

[0126] When there is no need for resource adjustment for any service in the target container environment, the target container environment will automatically select these services as "second target services". Then, the target container environment will obtain the first historical data set related to these "second target services". This data set contains multiple subsets, and each subset contains multiple historical resource usage indicators. The resource usage indicators in each subset belong to the same indicator category (for example, all indicators are CPU utilization), while the indicator categories in different subsets are different (for example, one subset contains CPU utilization, and another subset contains memory utilization), covering the container's CPU utilization, QPS, memory utilization, disk IO and other multi-dimensional resource usage in different time periods. By organizing and analyzing these historical data, the target container environment can make effective predictions and optimization adjustments to future resource needs.

[0127] S402: Predicting a predicted resource usage set of the second target service at the next moment based on the first historical data set.

[0128] Based on the first historical data set, by analyzing the historical resource usage, the resource usage of the second target service at the next moment can be predicted. The prediction result will form a predicted resource usage set, which includes three different prediction sets: a short-term prediction set (i.e., the first prediction set), a medium-term prediction set (i.e., the second prediction set), and a long-term prediction set (i.e., the third prediction set). Each prediction set contains multiple prediction values, which correspond to different resource usage indicators (such as CPU utilization, QPS, memory utilization, and disk IO, etc.). Within the same prediction set, the indicator categories corresponding to these prediction values ​​are different, thereby ensuring the comprehensiveness and accuracy of the prediction results. By analyzing each prediction set, more accurate predictions can be provided for system resource management, and resource allocation and scheduling can be optimized.

[0129] It should be noted that the first prediction set, the second prediction set and the third prediction set are obtained by predicting resource usage of the first historical data set through different models.

[0130] S403: Determine a preset accuracy rate corresponding to each predicted value in the predicted resource usage.

[0131] After obtaining the predicted resource usage set, you need to determine the preset accuracy rate for each predicted value in the predicted resource usage. This method can be used to determine the credibility and reliability of each predicted value. A higher accuracy rate indicates a more accurate prediction result. This accuracy assessment provides an important basis for subsequent resource usage predictions, thereby increasing the accuracy of resource usage predictions.

[0132] S404: For each indicator category, based on the prediction values ​​corresponding to the indicator category in the first prediction set, the second prediction set, and the third prediction set and the accuracy rates corresponding to the prediction values, calculate the predicted resource usage of the indicator category.

[0133] When calculating predicted resource usage, for each metric category, corresponding predicted values ​​are extracted from the first, second, and third prediction sets. These predicted values ​​represent estimates of resource usage for that metric category under different prediction models. The accuracy of each predicted value is also considered, with higher accuracy values ​​receiving greater weight in the calculation. By combining these predicted values ​​and accuracy, a comprehensive estimate of predicted resource usage for each metric category can be derived, allowing for a more accurate prediction of resource requirements for that category in the future. This calculation method ensures that the prediction results fully account for the reliability of each prediction, thereby improving the accuracy of resource allocation.

[0134] S405: Reserve resources for the second target service based on all the predicted resource usages.

[0135] Finally, based on these predictions, appropriate resources can be allocated to each secondary target service, ensuring that it will receive sufficient resources in the future. This process, through accurate prediction and reasonable resource planning, avoids resource waste or shortages and ensures efficient system operation.

[0136] Steps S401-S405, by combining historical data and prediction algorithms, can effectively reserve resources in advance, thereby ensuring that services in the target container environment can run stably in the future and avoiding resource waste or shortage.

[0137] In a possible implementation, predicting a predicted resource usage set of the second target service at the next moment based on the first historical data set includes:

[0138] Each of the first subsets is used as input respectively, and the Autoregressive Integrated Moving Average (ARIMA) model is used to predict the predicted resource usage of the second target service at the next moment to obtain the first prediction set; each of the first subsets is used as input respectively, and the Long Short-Term Memory Network (LSTM) model is used to predict the predicted resource usage of the second target service at the next moment to obtain the second prediction set; each of the first subsets is used as input respectively, and the Prophet Model is used to predict the predicted resource usage of the second target service at the next moment to obtain the third prediction set.

[0139] Specifically, the first forecast set (short-term forecast set) uses the ARIMA model (autoregressive integrated moving average) to analyze each first subset and predict the resource usage of the second target service in the short term (next moment). The ARIMA model is suitable for time series data and can capture seasonal and trend changes in the data, thus providing accurate results for short-term forecasts.

[0140] The second prediction set (medium-term prediction set) uses the LSTM model (Long Short-Term Memory Network) to process each of the first subsets to predict medium-term resource usage. LSTM models excel at capturing long-term dependencies in time series data and can therefore be used for medium-term dynamic forecasting.

[0141] The third forecast set (long-term forecast set) uses the Prophet model (a time series forecasting tool developed by Facebook) to forecast each of the first subsets to obtain long-term forecast results. The Prophet model is suitable for predicting long-term trends.

[0142] Through these different models, we can make multi-dimensional predictions on the resource usage of the second target service at different time scales, namely short-term, medium-term and long-term, thus providing a more comprehensive and accurate resource management solution for the target container environment.

[0143] In a possible implementation, the present application embodiment also provides a method for predicting resource usage. Figure 5 As shown, Figure 5 A flowchart of an implementation method of a resource usage prediction method provided in an embodiment of the present application. Accordingly, step S404 calculates the predicted resource usage of each indicator category based on the predicted value corresponding to the indicator category in the first prediction set, the second prediction set, and the third prediction set and the accuracy corresponding to each predicted value. Specifically, steps S501-S503 can be implemented:

[0144] S501: For each indicator category, obtain prediction values ​​belonging to the indicator category in the first prediction set, the second prediction set, and the third prediction set to obtain a first calculated value, a second calculated value, and a third calculated value.

[0145] For each indicator category, the prediction data related to the category can be extracted from three different prediction sets (i.e., the first prediction set, the second prediction set, and the third prediction set). The data in each prediction set represents the prediction results of the indicator under different conditions. Therefore, by obtaining the prediction value belonging to the indicator category from each prediction set, the first calculated value, the second calculated value, and the third calculated value are obtained respectively. These three calculated values ​​represent the prediction performance of the indicator category in different prediction sets. The purpose of this is to improve the comprehensiveness and accuracy of the prediction through the data of multiple prediction sets.

[0146] S502: Normalize the accuracy rates corresponding to the first calculated value, the second calculated value, and the third calculated value to obtain calculation weights corresponding to the respective calculated values.

[0147] After obtaining the accuracy rates corresponding to the first, second, and third calculated values, the accuracy rates corresponding to the first, second, and third calculated values ​​can be normalized. The purpose of normalization is to convert the accuracy rates of different calculated values ​​into a unified standard range, making the accuracy rates of each calculated value comparable. After normalization, each calculated value will be assigned a corresponding calculation weight, which reflects the relative importance of the predicted value in the overall prediction. These calculation weights will be used in subsequent weighted calculations to obtain more accurate prediction results.

[0148] S503: For each indicator category, based on the corresponding first calculated value, the second calculated value, the third calculated value, and the calculation weights corresponding to the respective calculated values, calculate the predicted resource usage of the indicator category.

[0149] Finally, a weighted calculation is performed on the first, second, and third calculated values ​​corresponding to each indicator category, combined with the calculated weights obtained from the previous normalization process. Specifically, each calculated value is multiplied by its corresponding calculation weight and then the weighted results are summed to obtain the comprehensive predicted resource usage for that indicator category. This weighted calculation comprehensively considers the impact of each prediction result based on the accuracy and weight of different calculated values, thereby improving the accuracy of the overall resource usage prediction. Ultimately, the resulting predicted resource usage provides data support for resource allocation and optimization.

[0150] For example, assuming that for the QPS indicator category, in the first prediction set, the QPS value is 10,000 QPS and the QPS accuracy is 0.8; in the second prediction set, the QPS value is 12,000 QPS and the QPS accuracy is 0.9; in the third prediction set, the QPS value is 12,000 QPS and the QPS accuracy is 0.7. Then, the accuracy rates of 0.8, 0.7, and 0.9 can be normalized to obtain calculation weights of 0.33, 0.38, and 0.29. Therefore, for the QPS indicator category, its predicted resource usage = 10,000 × 0.33 + 12,000 × 0.38 + 11,000 × 0.29 = 11,070 QPS.

[0151] Through steps S501-S503, accurate resource usage predictions for each indicator category can be obtained, thereby providing data support for resource allocation and reservation. This method utilizes multiple sets of predictions and corresponding accuracy rates, enhancing the reliability and accuracy of the predictions.

[0152] In a possible implementation, the present application embodiment also provides a resource reservation method. Figure 6 As shown, Figure 6 A flowchart of another implementation method of a resource reservation method provided in an embodiment of the present application is provided. Accordingly, S405 reserves resources for the second target service based on all the predicted resource usage, which can be specifically implemented through steps S601-S603:

[0153] S601: For each indicator category, determine a preset prediction confidence adjustment factor and a basic buffer ratio for the indicator category.

[0154] When reserving resources, for each metric category, we first need to determine the pre-set prediction confidence adjustment factor and base buffer ratio for that category. This is because the prediction accuracy and uncertainty of different metrics may vary. The prediction confidence adjustment factor reflects the reliability of the prediction results for each metric category. A higher confidence level indicates a more accurate prediction result, which can reduce the need to reserve additional resources; a lower confidence level indicates greater uncertainty in the prediction result, requiring increased resource reservation to ensure stable system operation when resource demand fluctuates. The base buffer ratio is designed to provide a certain amount of resource redundancy in uncertain situations, ensuring that the target container environment remains stable even in the event of prediction errors or unexpected events. Therefore, by appropriately setting the prediction confidence adjustment factor and base buffer ratio for each metric category, we can more accurately reserve resources and avoid excessive or insufficient resources.

[0155] In a possible implementation, the basic buffer ratio may be, but is not limited to, 20%. This application does not impose any specific restrictions on the size of the basic buffer ratio, and the user may adjust the size of the basic buffer ratio according to actual needs.

[0156] S602: For each indicator category, the reserved resources are calculated based on the predicted resource usage, basic buffer ratio, and prediction confidence adjustment factor of the indicator category.

[0157] For each indicator category, reserved resources are calculated by comprehensively considering the category's resource demand (i.e., predicted resource usage), the basic buffer ratio, and the forecast confidence adjustment factor. First, the predicted resource usage for the indicator category provides the expected resource demand, reflecting the amount of resources required for the category under normal circumstances. However, since the forecast results may have a certain degree of error, a basic buffer ratio is introduced to ensure that demand can still be met within the forecast error range. At the same time, the forecast confidence adjustment factor is adjusted based on the reliability of the forecast results for each category. Categories with low confidence require higher reserved resources to cope with uncertainty. Therefore, by combining the influence of these three factors, the appropriate amount of reserved resources can be scientifically calculated to ensure the rational use of resources while effectively responding to future uncertainties and emergencies.

[0158] In a possible implementation, reserved resources=predicted resource usage×(1+basic buffer ratio)×prediction confidence adjustment factor.

[0159] S603: Reserving resources based on the reserved resources corresponding to each indicator category.

[0160] Finally, specific resource reservations can be made based on the reserved resources corresponding to each metric category. The core of this process is to avoid excessive resource waste while ensuring the stable operation of the target container environment. First, the reserved resource amount for each metric category is calculated based on the predicted resource usage, the basic buffer ratio, and the prediction confidence adjustment factor. Next, based on these calculations, the corresponding resource reservations can be made for each metric category. This ensures that in actual use, even in the presence of prediction errors or unpredictable fluctuations, the target container environment can still maintain stable operation through reserved resources. Ultimately, through accurate resource reservation, not only is resource utilization efficiency improved, but the risks caused by insufficient or over-allocation of resources are also effectively reduced.

[0161] Steps S601-S603 determine the prediction confidence adjustment factor and basic buffer ratio for each indicator category, calculate reserved resources based on the predicted resource usage, and finally reserve resources based on the calculation results, thereby achieving a more flexible and accurate resource management strategy.

[0162] In a possible implementation, the present application embodiment also provides a preset method for accuracy and prediction confidence. Figure 7 As shown, Figure 7 This is a flowchart of an implementation method for presetting an accuracy rate and prediction confidence provided in an embodiment of the present application, which can be implemented through steps S701-S703:

[0163] S701: Construct a second historical data set for each indicator category.

[0164] For each metric category, a new historical dataset, the second historical dataset, is first constructed. This dataset contains multiple historical metrics related to resource usage. For example, for the CPU utilization metric category, the historical dataset contains CPU utilization data at various points in time over a period of time. These metrics can reflect changes in resource usage over different time periods. A second historical dataset is constructed for each metric category.

[0165] S702: For each indicator category, use the ARIMA model, the LSTM prediction model and the Prophet model to predict the resource usage of the second historical data set to obtain the first future resource usage, the second future resource usage and the third future resource usage of the indicator category.

[0166] For each indicator category, resource usage is predicted using the constructed second historical dataset using the ARIMA model, LSTM forecasting model, and Prophet model. Each model generates corresponding future resource usage forecasts based on the characteristics and trends of the historical data. Specifically, for any indicator category, the ARIMA model provides the first future resource usage for that indicator category, the LSTM forecasting model provides the second future resource usage for that indicator category, and the Prophet model provides the third future resource usage for that indicator category.

[0167] S703: For each indicator category, statistical analysis is performed on the first future resource usage, the second future resource usage, the third future resource usage, and the actual resource usage corresponding to each future resource usage of the indicator category, and the accuracy of the indicator category in the ARIMA model, the LSTM prediction model, and the Prophet model and the prediction confidence adjustment factor of the indicator category are obtained respectively.

[0168] For each metric category, a detailed statistical analysis is performed on the first, second, and third future resource usage for that category, as well as the actual resource usage corresponding to each forecast result. By comparing the differences between the predicted and actual values, the forecast confidence adjustment factor for each model for that metric category is calculated. Furthermore, based on these analysis results, the forecast accuracy of the ARIMA, LSTM, and Prophet models can be further evaluated, thereby identifying the performance of each model in different scenarios and ensuring the accuracy and reliability of resource usage forecasts.

[0169] Each indicator category corresponds to an independent prediction confidence adjustment factor, which is used to reflect the prediction accuracy of that category. Specifically, in the first prediction set, the accuracy of each prediction value represents the prediction accuracy of that indicator category in the ARIMA model; in the second prediction set, the accuracy of each prediction value reflects the prediction performance of that indicator category in the LSTM prediction model; and in the third prediction set, the accuracy of each prediction value represents the prediction accuracy of that indicator category in the Prophet model.

[0170] For example, assume there are three metric categories: CPU utilization, QPS, and memory utilization. ARIMA, LSTM, and Prophet models are used for prediction, respectively. Each metric category has different accuracy rates for different prediction models. For CPU utilization, the ARIMA model has an accuracy of 85%, the LSTM model has an accuracy of 90%, and the Prophet model has an accuracy of 80%.

[0171] Based on the above accuracy, the CPU utilization prediction values ​​in the first prediction set will use the accuracy of the ARIMA model, which has a prediction accuracy of 85%. The CPU utilization prediction values ​​in the second prediction set will use the accuracy of the LSTM model, which has a prediction accuracy of 90%. The CPU utilization prediction values ​​in the third prediction set will use the accuracy of the Prophet model, which has a prediction accuracy of 80%.

[0172] The confidence adjustment factors for these predictions are adjusted based on the accuracy of the corresponding model. For example, the CPU utilization predicted by the LSTM model may receive a higher confidence adjustment due to its high accuracy (90%), while the prediction results of the Prophet model may receive a lower confidence adjustment due to its lower accuracy (80%).

[0173] Each metric category has different prediction accuracy rates across different prediction models, and these accuracy rates influence the confidence level of the prediction results. The confidence adjustment factor for the prediction value is adjusted based on these accuracy rates. For example, if a model has a high accuracy rate, the confidence level of the prediction result will be increased; otherwise, the confidence level will be appropriately reduced.

[0174] Through steps S701-S703, the prediction confidence adjustment factor of each indicator category and its accuracy in different models can be determined, thereby further improving the accuracy and reliability of the resource reservation strategy.

[0175] Based on the dynamic resource adjustment method provided in the above method embodiment, the embodiment of the present application also provides a dynamic resource adjustment system, which will be described below in conjunction with the accompanying drawings.

[0176] See also Figure 8 As shown in FIG, this figure is a structural diagram of a dynamic adjustment system of resources provided by an embodiment of the present application. Figure 8 As shown, the dynamic resource adjustment system includes a resource monitor 801, a performance analyzer 802, a state evaluator 803, and a progressive scheduler 804 connected in sequence:

[0177] The resource monitor 801 is configured to determine an operating scenario of the target container environment when N services in the target container environment have resource adjustment requirements, and to determine all of the N services in the target container environment that have resource adjustment requirements as first target services; N is a positive integer;

[0178] The performance analyzer 802 is configured to determine, for each of the first target services, a plurality of indicators to be adjusted, and obtain a current value of each of the indicators to be adjusted;

[0179] The state evaluator 803 is configured to obtain the current value of each of the indicators to be adjusted, and determine a dynamic weight coefficient and a target value for each of the indicators to be adjusted based on the operating scenario, so as to calculate an indicator deviation of the indicator to be adjusted based on the target value of the indicator to be adjusted and the current value of the indicator to be adjusted; the indicator deviation = current value / target value; the indicator deviation has a one-to-one correspondence with the dynamic weight coefficient;

[0180] The state evaluator 803 is further configured to calculate the expansion capacity of each first target service based on the indicator deviations of the plurality of indicators to be adjusted corresponding to each first target service and the dynamic weight coefficients corresponding to the indicator deviations;

[0181] The progressive scheduler 804 is used to calculate the impact of each first target service in combination with the expansion capacity of each first target service when N is greater than 1, and based on the size of the impact of each first target service, expand the resources of each first target service in sequence in combination with the expansion capacity of each first target service; when N is equal to 1, expand the resources of the first target service based on the expansion capacity of the first target service.

[0182] In a possible implementation, the progressive scheduler 804 is specifically configured to:

[0183] For each first target service, determining a service level and a workload type of the first target service in the target container environment; the service level includes any one of core services, important services, ordinary services, and background tasks; and the workload type includes any one of central processing unit (CPU) intensive, memory intensive, input / output (IO) intensive, and regular.

[0184] Determining a grade weight corresponding to a service grade of each first target service and a load weight corresponding to a workload type; each service grade is preset with a corresponding grade weight; each workload type is preset with a corresponding load weight;

[0185] For each of the first target services, the impact of the first target service is calculated based on the level weight corresponding to its business level, the load weight corresponding to the workload type, and the expansion capacity.

[0186] In a possible implementation, the system further includes a prediction analysis module 805, which is connected to the resource monitor 801; the prediction analysis module 805 is configured to:

[0187] When no service in the target container environment has a resource adjustment requirement, the system is used to determine, for any service in the target container environment, the service as a second target service, and obtain a first historical data set of the second target service; the first historical data set includes multiple first subsets, each of the first subsets includes multiple first historical resource usage indicators, the first historical resource usage indicators in the same first subset have the same indicator category, and the first historical resource usage indicators in different first subsets have different indicator categories;

[0188] Predicting a set of predicted resource usage of the second target service at the next moment based on the first historical data set; the predicted resource usage includes a first prediction set, a second prediction set, and a third prediction set, each prediction set includes multiple prediction values, and the indicator categories of the respective prediction values ​​in the same prediction set are different;

[0189] Determining a preset accuracy rate corresponding to each predicted value in the predicted resource usage;

[0190] For each indicator category, based on the corresponding predicted values ​​of the indicator category in the first prediction set, the second prediction set, and the third prediction set and the accuracy rates of the predicted values, calculate the predicted resource usage of the indicator category;

[0191] Resources are reserved for the second target service based on all the predicted resource usages.

[0192] In a possible implementation, the first resource usage prediction unit specifically includes:

[0193] A first input unit is configured to take each of the first subsets as input, and use an autoregressive integrated moving average model (ARIMA) model to predict the predicted resource usage of the second target service at the next moment to obtain the first prediction set;

[0194] A second input unit is configured to take each of the first subsets as input, and use a long short-term memory network model (LSTM) to predict the predicted resource usage of the second target service at the next moment to obtain the second prediction set;

[0195] The third input unit is used to take each of the first subsets as input, and use the Prophet model to predict the predicted resource usage of the second target service at the next moment to obtain the third prediction set.

[0196] In a possible implementation, the prediction analysis module 805 is specifically configured to:

[0197] For each indicator category, obtaining prediction values ​​belonging to the indicator category in the first prediction set, the second prediction set, and the third prediction set to obtain a first calculated value, a second calculated value, and a third calculated value;

[0198] Normalizing the accuracy rates corresponding to the first calculated value, the second calculated value, and the third calculated value to obtain calculation weights corresponding to the respective calculated values;

[0199] For each indicator category, the predicted resource usage of the indicator category is calculated based on the corresponding first calculated value, the second calculated value, the third calculated value and the calculation weights corresponding to the respective calculated values.

[0200] In a possible implementation, the prediction analysis module 805 is further configured to:

[0201] For each indicator category, determine the preset prediction confidence adjustment factor and basic buffer ratio for the indicator category;

[0202] For each indicator category, the reserved resources are calculated based on the predicted resource usage, basic buffer ratio, and prediction confidence adjustment factor of the indicator category;

[0203] Resource reservation is performed based on the reserved resources corresponding to each indicator category.

[0204] In a possible implementation, the prediction analysis module 805 is further configured to:

[0205] For each indicator category, construct a second historical data set; the second historical data set includes a plurality of second historical resource usage indicators;

[0206] For each indicator category, use the ARIMA model, the LSTM prediction model, and the Prophet model to predict resource usage of the second historical data set, respectively, to obtain a first future resource usage, a second future resource usage, and a third future resource usage for the indicator category;

[0207] For each indicator category, statistical analysis is performed on the first future resource usage, the second future resource usage, the third future resource usage, and the actual resource usage corresponding to each future resource usage for the indicator category, to obtain the accuracy of the indicator category in the ARIMA model, the LSTM prediction model, and the Prophet model, as well as the prediction confidence adjustment factor for the indicator category;

[0208] Among them, one indicator category corresponds to one prediction confidence adjustment factor; the accuracy of each predicted value in the first prediction set is the accuracy of the indicator category to which it belongs in the ARIMA model; the accuracy of each predicted value in the second prediction set is the accuracy of the indicator category to which it belongs in the LSTM prediction model; the accuracy of each predicted value in the third prediction set is the accuracy of the indicator category to which it belongs in the Prophet model.

[0209] In addition, an embodiment of the present application further provides a computer-readable storage medium, characterized in that the computer-readable storage medium stores instructions, and when the instructions are executed on a terminal device, the terminal device executes the dynamic resource adjustment method as described above.

[0210] In addition, an embodiment of the present application further provides a processor for running a computer program, which executes the above-mentioned method for dynamically adjusting resources when the program is running.

[0211] In an embodiment of the present application, when N services in a target container environment require resource adjustment, the operating scenario of the environment is first determined, and the services with resource adjustment requirements are marked as first target services. For each first target service, its multiple indicators to be adjusted are determined and the current values ​​of these indicators are obtained. Based on the current operating scenario, the dynamic weight coefficient and target value of each indicator to be adjusted are determined, and the deviation of the indicator to be adjusted is calculated (indicator deviation = current value / target value). The dynamic weight coefficient and indicator deviation have a one-to-one correspondence. Then, based on the multiple indicator deviations and corresponding dynamic weight coefficients of each first target service, its expansion capacity is calculated. When N is greater than 1, the impact of each first target service is calculated, and based on the impact size and the expansion capacity of each first target service, resource expansion is performed in sequence; when N is equal to 1, resource expansion is performed directly on the only first target service based on the calculated expansion capacity. This application calculates the resource requirements of each service in real time and performs precise resource adjustment based on the operating status and real-time requirements of the target container environment. At the same time, a resource expansion strategy sorted by impact is adopted to ensure that resource adjustment can be carried out in steps. Prioritize adjusting services that have a greater impact on the target container environment to reduce interference with other containers and the overall environment, thereby effectively ensuring the stability of the container environment and the continuous operation of the business.

[0212] It should be noted that the various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. Reference can be made to the common and similar parts between the various embodiments. For the systems or systems disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple, and the relevant parts can be referred to the method description.

[0213] It should be understood that in this application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following items" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.

[0214] It should also be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or device comprising the element.

Claims

1. A method for dynamic resource adjustment, characterized in that: The method comprises: When N services in the target container environment have resource adjustment requirements, determining an operating scenario of the target container environment, and determining all of the N services in the target container environment that have resource adjustment requirements as first target services; N is a positive integer; For each of the first target services, determining a plurality of indicators to be adjusted, and obtaining a current value of each of the indicators to be adjusted; Determining a dynamic weight coefficient and a target value for each of the indicators to be adjusted based on the operating scenario, and calculating an indicator deviation of the indicator to be adjusted based on the target value of the indicator to be adjusted and the current value of the indicator to be adjusted; the indicator deviation = current value / target value; the indicator deviation has a one-to-one correspondence with the dynamic weight coefficient; Calculating the expansion capacity of each first target service based on the indicator deviations of the plurality of indicators to be adjusted corresponding to each first target service and the dynamic weight coefficients corresponding to the indicator deviations; When N is greater than 1, the impact of each first target service is calculated in combination with the expansion capacity of each first target service, and based on the size of the impact of each first target service, the resources of each first target service are expanded in sequence in combination with the expansion capacity of each first target service; when N is equal to 1, the resources of the first target service are expanded based on the expansion capacity of the first target service.

2. The method according to claim 1, characterized in that The calculating the impact of each of the first target services in combination with the expansion capacity of each of the first target services includes: For each first target service, determining a service level and a workload type of the first target service in the target container environment; the service level includes any one of core services, important services, ordinary services, and background tasks; and the workload type includes any one of central processing unit (CPU) intensive, memory intensive, input / output (IO) intensive, and regular. Determining a grade weight corresponding to a service grade of each first target service and a load weight corresponding to a workload type; each service grade is preset with a corresponding grade weight; each workload type is preset with a corresponding load weight; For each of the first target services, the impact of the first target service is calculated based on the level weight corresponding to its business level, the load weight corresponding to the workload type, and the expansion capacity.

3. The method according to claim 1, characterized in that The method further comprises: When no service in the target container environment has a resource adjustment requirement, for any service in the target container environment, the service is determined as a second target service, and a first historical data set of the second target service is obtained; the first historical data set includes multiple first subsets, each of the first subsets includes multiple first historical resource usage indicators, the first historical resource usage indicators in the same first subset have the same indicator category, and the first historical resource usage indicators in different first subsets have different indicator categories; Predicting a set of predicted resource usage of the second target service at the next moment based on the first historical data set; the predicted resource usage includes a first prediction set, a second prediction set, and a third prediction set, each prediction set includes multiple prediction values, and the indicator categories of the respective prediction values ​​in the same prediction set are different; Determining a preset accuracy rate corresponding to each predicted value in the predicted resource usage; For each indicator category, based on the corresponding predicted values ​​of the indicator category in the first prediction set, the second prediction set, and the third prediction set and the accuracy rates of the predicted values, calculate the predicted resource usage of the indicator category; Resources are reserved for the second target service based on all the predicted resource usages.

4. The method according to claim 3, characterized in that The predicting a predicted resource usage set of the second target service at the next moment based on the first historical data set includes: Taking each of the first subsets as input, respectively, and using an autoregressive integrated moving average model (ARIMA) model to predict resource usage of the second target service at the next moment to obtain the first prediction set; Taking each of the first subsets as input, respectively, and using a long short-term memory network model (LSTM) model to predict the predicted resource usage of the second target service at the next moment to obtain the second prediction set; Each of the first subsets is taken as input respectively, and the Prophet model is used to predict the predicted resource usage of the second target service at the next moment to obtain the third prediction set.

5. The method according to claim 3, characterized in that The step of calculating, for each indicator category, predicted resource usage of the indicator category based on the predicted values ​​corresponding to the indicator category in the first prediction set, the second prediction set, and the third prediction set and the accuracy rates corresponding to the predicted values, includes: For each indicator category, obtaining prediction values ​​belonging to the indicator category in the first prediction set, the second prediction set, and the third prediction set to obtain a first calculated value, a second calculated value, and a third calculated value; Normalizing the accuracy rates corresponding to the first calculated value, the second calculated value, and the third calculated value to obtain calculation weights corresponding to the respective calculated values; For each indicator category, the predicted resource usage of the indicator category is calculated based on the corresponding first calculated value, the second calculated value, the third calculated value and the calculation weights corresponding to the respective calculated values.

6. The method according to claim 3, characterized in that The reserving resources for the second target service based on all the predicted resource usages includes: For each indicator category, determine the preset prediction confidence adjustment factor and basic buffer ratio for the indicator category; For each indicator category, the reserved resources are calculated based on the predicted resource usage, basic buffer ratio, and prediction confidence adjustment factor of the indicator category; Resource reservation is performed based on the reserved resources corresponding to each indicator category.

7. The method according to claim 4, characterized in that The preset process of the accuracy rate and prediction confidence adjustment factor includes: For each indicator category, construct a second historical data set; the second historical data set includes a plurality of second historical resource usage indicators; For each indicator category, use the ARIMA model, the LSTM prediction model, and the Prophet model to predict resource usage of the second historical data set, respectively, to obtain a first future resource usage, a second future resource usage, and a third future resource usage for the indicator category; For each indicator category, statistical analysis is performed on the first future resource usage, the second future resource usage, the third future resource usage, and the actual resource usage corresponding to each future resource usage for the indicator category, to obtain the accuracy of the indicator category in the ARIMA model, the LSTM prediction model, and the Prophet model, as well as the prediction confidence adjustment factor for the indicator category; Among them, one indicator category corresponds to one prediction confidence adjustment factor; the accuracy of each predicted value in the first prediction set is the accuracy of the indicator category to which it belongs in the ARIMA model; the accuracy of each predicted value in the second prediction set is the accuracy of the indicator category to which it belongs in the LSTM prediction model; the accuracy of each predicted value in the third prediction set is the accuracy of the indicator category to which it belongs in the Prophet model.

8. A dynamic resource adjustment system, characterized in that: The system includes a resource monitor, a performance analyzer, a state evaluator, and a progressive scheduler connected in sequence; The resource monitor is configured to, when N services in the target container environment have resource adjustment requirements, determine an operating scenario of the target container environment and determine all of the N services in the target container environment that have resource adjustment requirements as first target services; N is a positive integer; The performance analyzer is configured to determine, for each of the first target services, a plurality of indicators to be adjusted, and obtain a current value of each of the indicators to be adjusted; The state evaluator is configured to obtain a current value of each of the indicators to be adjusted, and determine a dynamic weight coefficient and a target value for each of the indicators to be adjusted based on the operating scenario, so as to calculate an indicator deviation of the indicator to be adjusted based on the target value of the indicator to be adjusted and the current value of the indicator to be adjusted; the indicator deviation = current value / target value; the indicator deviation has a one-to-one correspondence with the dynamic weight coefficient; The state evaluator is further configured to calculate the expansion capacity of each first target service based on the indicator deviations of the plurality of indicators to be adjusted corresponding to each first target service and the dynamic weight coefficients corresponding to the indicator deviations; The progressive scheduler is configured to, when N is greater than 1, calculate the impact of each first target service in combination with the expansion capacity of each first target service, and sequentially expand resources for each first target service based on the impact of each first target service and in combination with the expansion capacity of each first target service; When N is equal to 1, resources of the first target service are expanded based on the expansion capacity of the first target service.

9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores instructions, and when the instructions are executed on a terminal device, the terminal device executes the method for dynamically adjusting resources according to any one of claims 1 to 7.

10. A processor, characterized in that: Used to run a computer program, which, when running, executes the dynamic resource adjustment method according to any one of claims 1 to 7.