Resource allocation method and device, equipment and medium
By dynamically adjusting the resource allocation strategy, combining resource prediction and performance evaluation data, the problem of resource waste and insufficient under the static allocation strategy is solved, and efficient resource management and application performance guarantee is achieved.
Patent Information
- Application Number
- CN202510920823.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-04
- Publication Date
- 2025-08-01
- Estimated Expiration
- 2045-07-04
AI Technical Summary
The existing static resource allocation strategy cannot adapt to the dynamic changes in application resource requirements, resulting in waste or insufficient resources, affecting system performance and application performance.
Through time period task triggering, combining the resource prediction value of the current period and the historical resource usage value, priority weights and performance evaluation data are introduced to form a dynamic feedback adjustment loop and dynamically adjust the resource allocation strategy.
It improves the accuracy of resource allocation, improves resource utilization, ensures the performance stability of applications, and reduces the risk of service interruption caused by resource waste and insufficient resources.
Smart Images

Figure CN120407214A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular, to a resource allocation method, a resource allocation device, an electronic device, a computer-readable storage medium, and a program product. Background Art
[0002] With the deep integration of big data and cloud computing technologies, enterprises' high-performance computing requirements for big data processing are increasing continuously. The demand of each application program for system resources has increased explosively. In this context, building an efficient resource management and allocation mechanism has become the key to improving resource utilization and avoiding waste.
[0003] Currently, static or fixed resource allocation strategies are usually adopted. This management mode is difficult to match the dynamic changes in the resource requirements of application programs, resulting in prominent resource contention problems among application programs: on the one hand, over-allocation of resources causes idle waste, and on the other hand, key application programs experience performance bottlenecks due to insufficient resource quotas, and in severe cases, even trigger service interruptions, restricting the release of the overall system efficiency. Summary of the Invention
[0004] In view of the above problems, this application provides a resource allocation method, a resource allocation device, an electronic device, a computer-readable storage medium, and a computer program product.
[0005] According to one aspect of this application, a resource allocation method is provided, including: in response to a triggered time-period task, determining a basic resource allocation value based on the resource prediction value of a target application program in the current period and the historical resource usage values of at least one historical period; determining a feedback adjustment value based on the priority weight of the target application program, and the performance evaluation data, historical resource prediction value, and target historical resource usage value in a target historical period, where the target historical period is a historical period adjacent to the current period; determining the target resource allocation value of the target application program in the current period based on the feedback adjustment value and the basic resource allocation value.
[0006] Another aspect of this application provides a resource allocation device, including: a first determination module, configured to determine a basic resource allocation value in response to a triggered time-period task, based on the resource prediction value of a target application program in the current period and the historical resource usage values of at least one historical period; a second determination module, configured to determine a feedback adjustment value based on the priority weight of the target application program, and the performance evaluation data, historical resource prediction value, and target historical resource usage value in a target historical period, where the target historical period is a historical period adjacent to the current period; a third determination module, configured to determine the target resource allocation value of the target application program in the current period based on the feedback adjustment value and the basic resource allocation value.
[0007] Another aspect of the present application provides an electronic device, including: one or more processors; a memory for storing one or more computer programs, wherein the one or more processors execute the one or more computer programs to implement the steps of the above-mentioned resource allocation method.
[0008] Another aspect of the present application further provides a computer-readable storage medium, on which a computer program or instruction is stored, and when the computer program or instruction is executed by a processor, the steps of the above-mentioned resource allocation method are implemented.
[0009] Another aspect of the present application further provides a computer program product, including a computer program or instruction, and when the computer program or instruction is executed by a processor, the steps of the above-mentioned resource allocation method are implemented.
[0010] According to the resource allocation method of the present application, it is triggered by a time-period task, and the basic resource allocation value is determined by integrating the resource prediction value of the current period and the historical resource usage value. At the same time, the priority weight, the performance evaluation data of the target historical period, and the historical prediction error are introduced as feedback factors to form a dynamic correction of the basic resource allocation value. Since the key application resources are ensured through the priority weight, and a feedback adjustment loop is formed by the performance evaluation data and the historical error data to dynamically adjust the basic resource allocation value, at least partially solving the technical problems of resource waste or resource shortage in the related art, realizing the dynamic adjustment of the resource allocation strategy according to the actual operation state, improving the accuracy of resource allocation and the resource utilization rate, and ensuring the stability of application performance. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] Through the following description of the embodiments of the present application with reference to the accompanying drawings, the above content and other objects, features, and advantages of the present application will become clearer.
[0012] Figure 1 The application scenario diagram of the resource allocation method, device, equipment, medium, and program product according to the embodiment of the present application is shown.
[0013] Figure 2 The flowchart of the resource allocation method according to the embodiment of the present application is shown.
[0014] Figure 3 The data flow diagram for determining the feedback adjustment value according to the embodiment of the present application is shown.
[0015] Figure 4 The data flow diagram for resource configuration according to the embodiment of the present application is shown.
[0016] Figure 5 The structural block diagram of the resource allocation device according to the embodiment of the present application is shown.
[0017] Figure 6 A block diagram of an electronic device suitable for implementing a resource allocation method according to an embodiment of the present application is shown. Detailed implementation manners
[0018] Hereinafter, embodiments of the present application will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are merely exemplary and are not intended to limit the scope of the present application. In the following detailed description, for the sake of explanation, many specific details are set forth to provide a thorough understanding of the embodiments of the present application. However, it is obvious that one or more embodiments can be implemented without these specific details. In addition, in the following description, descriptions of well-known structures and technologies are omitted to avoid unnecessarily obscuring the concepts of the present application.
[0019] The terms used herein are merely for describing specific embodiments and are not intended to limit the present application. The terms "including", "comprising", etc. used herein indicate the presence of the described features, steps, operations, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, or components.
[0020] All terms used herein (including technical and scientific terms) have the meanings commonly understood by those of ordinary skill in the art, unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification and should not be interpreted in an idealized or overly rigid manner.
[0021] In the case of using expressions such as "at least one of A, B, and C", generally, it should be interpreted according to the meaning commonly understood by those of ordinary skill in the art (for example, "a system having at least one of A, B, and C" should include but not be limited to a system having only A, only B, only C, having A and B, having A and C, having B and C, and / or having A, B, and C).
[0022] It has been found in the research process that in traditional resource management systems, the allocation of central processing unit (CPU) resources and memory resources is static or based on fixed rules, and the system cannot dynamically adjust resource allocation according to the actual load conditions of application programs, resulting in resource waste or resource shortage. Moreover, in a multi-tenant or multi-application environment, different application programs will compete for limited CPU resources and memory resources, resulting in performance degradation or even service interruption of some application programs due to resource shortage.
[0023] In view of this, an embodiment of the present application provides a resource allocation method, including: in response to a triggered time-period task, determining a basic resource allocation value based on a resource prediction value of a target application in the current period and historical resource usage values in at least one historical period; determining a feedback adjustment value based on the priority weight of the target application, as well as performance evaluation data, historical resource prediction values, and target historical resource usage values in a target historical period, where the target historical period is a historical period adjacent to the current period; and determining a target resource allocation value of the target application in the current period based on the feedback adjustment value and the basic resource allocation value.
[0024] Figure 1 FIG. shows an application scenario diagram of a resource allocation method, apparatus, device, medium, and program product according to an embodiment of the present application.
[0025] As Figure 1 shown, the application scenario 100 according to this embodiment may include a first terminal device 101, a second terminal device 102, a third terminal device 103, a network 104, and a server 105. The network 104 is used to provide a medium for communication links between the first terminal device 101, the second terminal device 102, the third terminal device 103, and the server 105. The network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, etc.
[0026] Users may use the first terminal device 101, the second terminal device 102, and the third terminal device 103 to interact with the server 105 through the network 104 to receive or send messages, etc. Various communication client applications may be installed on the first terminal device 101, the second terminal device 102, and the third terminal device 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only for example).
[0027] The first terminal device 101, the second terminal device 102, and the third terminal device 103 may be various electronic devices with a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, and desktop computers, etc.
[0028] The server 105 may be a server providing various services, such as a background management server that supports websites browsed by users using the first terminal device 101, the second terminal device 102, and the third terminal device 103 (only for example). The background management server may analyze and process data such as received user requests, and feedback the processing results (such as web pages, information, or data obtained or generated according to user requests) to the terminal device.
[0029] It should be noted that the resource allocation method provided in the embodiment of the present application can generally be executed by the server 105. Accordingly, the resource allocation device provided in the embodiment of the present application can generally be set in the server 105. The resource allocation method provided in the embodiment of the present application can also be executed by a server or server cluster that is different from the server 105 and can communicate with the first terminal device 101, the second terminal device 102, the third terminal device 103 and / or the server 105. Accordingly, the resource allocation device provided in the embodiment of the present application can also be set in a server or server cluster that is different from the server 105 and can communicate with the first terminal device 101, the second terminal device 102, the third terminal device 103 and / or the server 105.
[0030] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is merely illustrative. Any number of terminal devices, networks and servers may be provided as required.
[0031] The following will be based on Figure 1 The scene described by Figures 2 to 4 The resource allocation method of the embodiment of the application is described in detail.
[0032] Figure 2 A flow chart of a resource allocation method according to an embodiment of the present application is shown.
[0033] like Figure 2 As shown, the method includes operations S210 to S230.
[0034] In operation S210 , in response to a triggered time period task, a basic resource allocation value is determined based on a resource prediction value of a target application in a current period and a historical resource usage value of at least one historical period.
[0035] In operation S220 , a feedback adjustment value is determined based on the priority weight of the target application, and performance evaluation data, historical resource prediction values, and target historical resource usage values in a target historical period, which is a historical period adjacent to the current period.
[0036] In operation S230 , a target resource allocation value of the target application program in the current period is determined based on the feedback adjustment value and the basic resource allocation value.
[0037] When the trigger period of a time-periodic task is reached, the resource allocation method can be executed. There is no limit on the trigger period of a time-periodic task, and different trigger periods can be set as needed. For example, during periods with intensive task processing, such as during the day, the trigger period can be shorter; during periods with less task processing, such as at night, the trigger period can be longer.
[0038] Applications in the same server can share the server's resources, and the target application can be one of multiple applications in the server.
[0039] There is no limitation on the resources, which can be CPU resources, memory resources, etc.
[0040] The predicted resource value and the historical predicted resource value can be predicted by a resource prediction model; the historical resource usage value and the target resource usage value can be the actual usage values of the resources in the historical period.
[0041] There is no limitation on the specific forms of the predicted resource value and the resource usage value. For example, the resource usage value can be the resource utilization rate, such as the CPU utilization rate and the memory occupancy rate; it can also be the resource usage amount, such as the CPU usage amount and the memory occupancy amount, etc.
[0042] The target historical period can be the historical period closest to the current period among at least one historical period, or can be a period with a relatively high correlation with the current period.
[0043] In the case where a time-period task has been triggered, the basic resource allocation value can be jointly determined based on the predicted resource value of the target application in the current period and the historical resource usage values of at least one historical period, so that the basic resource allocation value includes forward prediction and historical information, ensuring the effectiveness of the basic resource allocation value.
[0044] The feedback adjustment value can be obtained through the performance evaluation data of the target historical period, and the historical predicted resource value combined with the target historical resource usage value and the priority weight, and the basic resource allocation value can be adjusted in real time through the feedback adjustment value, so as to obtain the target resource allocation value of the target application in the current period, that is, the dynamic adjustment of the resource allocation of the target application according to the actual operation situation is realized.
[0045] According to the embodiments of the present application, it is triggered by a time-period task, and the basic resource allocation value is determined by integrating the predicted resource value in the current period and the historical resource usage value. At the same time, the priority weight, the performance evaluation data of the target historical period and the historical prediction error are introduced as feedback factors to form a dynamic correction of the basic resource allocation value. Since the key application resources are ensured through the priority weight, and the feedback adjustment loop is formed by the performance evaluation data and the historical error data to dynamically adjust the basic resource allocation value, at least partially solving the technical problems of resource waste or resource shortage existing in the related art, realizing the dynamic adjustment of the resource allocation strategy according to the actual operation state, improving the accuracy of resource allocation and the resource utilization rate, and ensuring the stability of application performance.
[0046] According to an embodiment of the present application, determining a feedback adjustment value based on the priority weight of a target application, as well as performance evaluation data, historical resource prediction values, and target historical resource usage values in a target historical period may include the following operations.
[0047] Based on the performance evaluation data, determine the performance score of the target application in the target historical period; in the case where it is determined that the performance score is within a preset resource adjustment range, determine a first sub-adjustment value corresponding to the preset resource adjustment range; based on the difference between the historical resource prediction value and the target historical resource usage value in the target historical period, as well as the priority weight, determine a second sub-adjustment value; based on the first sub-adjustment value and the second sub-adjustment value, determine the feedback adjustment value.
[0048] There is no limitation on the performance evaluation data, and it can be any data that can reflect the running situation of the target application in the target historical period. For example, the performance evaluation data may include at least one of the following evaluation indicators: average response time, resource utilization rate, average error rate, etc.
[0049] The performance situation of the target application in the target historical period can be quantified through the performance evaluation data, and the performance score can be obtained. The preset resource adjustment range where the performance score is located can be determined, and the first sub-adjustment value corresponding to the preset resource adjustment range can be determined from the database.
[0050] The database may include multiple preset resource adjustment ranges and preset sub-adjustment values corresponding to the multiple preset resource adjustment ranges respectively. For example: in the case where the preset resource adjustment range is [95, 100], it can be considered that the resources are significantly excessive. Therefore, the first resource adjustment value can be to reduce CPU resources and / or memory resources; in the case where the preset resource adjustment range is [7, 90], it can be considered that the performance is slightly unqualified. Therefore, the resource adjustment value can be to increase CPU resources and / or memory resources. The preset sub-adjustment value can be determined through multiple experiments.
[0051] And the second sub-adjustment value can be determined based on the product of the difference between the historical resource prediction value and the target historical resource usage value in the target historical period, and adjustable parameters such as a preset adjustment coefficient and a priority weight. Thus, when allocating resources, considering the priorities of different applications, appropriate resource inclination can be made for target applications with high priorities.
[0052] In some embodiments, the available resources of each target application with a higher priority can be dynamically checked. When the available resources of the target application are lower than the preset value within the target step length in the current period, the target resource allocation value for the target application can be dynamically increased.
[0053] The feedback adjustment value can be the sum of the first sub-adjustment value and the second sub-adjustment value.
[0054] According to an embodiment of the present application, by converting performance evaluation data into a quantitative score and mapping it to a preset range, the determination of the first sub-adjustment value based on the actual operating state is achieved. At the same time, by combining historical prediction deviations and priority weights to generate a dynamic correction factor, multi-dimensional feedback regulation is realized. Thus, the two-layer adjustment values cooperate with each other, and relatively accurate resource allocation can be achieved even when the load fluctuates greatly.
[0055] According to an embodiment of the present application, the performance evaluation data includes at least one of the following evaluation indicators: average response time, resource utilization rate; based on the performance evaluation data, determining the performance score of the target application program in the target historical period may include the following operations.
[0056] Based on the application type of the target application program, determine the importance weight for at least one evaluation indicator; based on at least one importance weight and at least one evaluation indicator, obtain the performance score.
[0057] Since application programs of different application types may have different focuses, the same evaluation indicator for different application types may also have different importance weights. For example: for an application program for batch processing, the importance of its resource utilization rate may be greater than that of the response time. For an application program for real-time interaction, the importance of its response time is greater than that of the resource utilization rate. The indicator types of each evaluation indicator may be different.
[0058] The average response time can be determined by the following formula (1), and the resource utilization rate can be determined by the following formula (2).
[0059] ; (1)
[0060] (2)
[0061] Wherein, is the average response time, is the response time of the i-th request, n is the number of requests; RU is the resource utilization rate, is the actual average CPU resource usage of the i-th application program; is the actual average memory resource usage of the i-th application program, is the upper limit value of CPU resource allocation allowed by the system, is the upper limit value of memory resources allowed by the system.
[0062] According to an embodiment of the present application, in the process of obtaining a performance score based on at least one importance weight and at least one evaluation metric, for each evaluation metric, multiple historical evaluation metrics corresponding to the metric type can be determined according to the metric type of the evaluation metric; and based on the multiple historical evaluation metrics, the metric benchmark for each metric type can be determined; based on the metric benchmark of each metric type, at least one evaluation metric is standardized to obtain the standardized evaluation metric; and based on at least one importance weight, at least one standardized evaluation metric is weighted and summed to determine the performance score.
[0063] For example: for the evaluation metric: average response time x. The benchmark metric determined according to the historical average response time is: the historical minimum value of the average response time x is x min , and the historical maximum value is x max . By calculating the current difference between the average response time x and the historical minimum value of x min , and dividing the current difference by the target difference between the historical maximum value x max and the historical minimum value x min , the operation result is obtained. Since the smaller the value, the closer the response time is to the optimal, therefore, 1 minus the operation result can be used to obtain the standardized evaluation metric.
[0064] Similarly, for the resource utilization rate RU, the metric benchmark can be determined through the historical resource utilization rate data, such as: the reasonable utilization rate range; and through the reasonable utilization rate range, the mean and variance can be determined, and the standardized resource utilization rate can be determined based on the bell curve method, the mean and the variance.
[0065] According to an embodiment of the present application, the metric benchmark is dynamically determined based on the historical evaluation data of each metric type, rather than using a fixed threshold or a unified standard for standardization processing. It at least partially solves the defect that the traditional static standardization method cannot adapt to the dynamic characteristics of the metric. The benchmark data determined through historical data makes the standardization processing more in line with the actual distribution characteristics of the metric, and improves the determination accuracy of the subsequent performance score.
[0066] In addition, the combination of the metric type classification and the importance weight can more accurately reflect the differential impact of different metrics on the performance, improve the accuracy and business adaptability of the score. Through the dynamic benchmark collaborative weighted summation, it realizes the self-adaptation of the performance score to the change of the business load, provides a decision basis for resource allocation, and improves the resource scheduling efficiency.
[0067] According to an embodiment of the present application, by adaptively adjusting the importance weights of sub-evaluation indicators such as the average response time and resource utilization according to the type of the target application, the performance score can accurately reflect the core requirements of different types of applications. Thus, the risk of resource misallocation caused by evaluation deviation can be effectively reduced.
[0068] According to an embodiment of the present application, based on the resource prediction value of the target application in the current period and the historical resource usage values in at least one historical period, determining the basic resource allocation value may include the following operations.
[0069] Multiply a preset safety factor by the average value of the historical resource usage values in at least one historical period to obtain a historical resource reference value; perform weighted summation of the resource prediction value and the historical resource reference value to determine the basic resource allocation value.
[0070] The preset safety factor can avoid the situation of insufficient resource allocation. The preset safety factor is not limited and can be determined according to actual needs, such as: 1.2, etc.
[0071] The basic resource allocation value can be obtained by combining the resource prediction value of the prediction model and the historical resource reference value and assigning different weights.
[0072] According to an embodiment of the present application, through the preset safety factor, the amplification adjustment of the historical resource usage average value can be realized to form a conservative reference value, and it is weighted and fused with the resource prediction value, so as to not only introduce the forward-looking ability of the prediction model but also retain the stability of the historical usage data. And when the prediction model fails due to sudden traffic, the historical data can be used as a guarantee, thus avoiding the limitations of traditional single prediction or historical average allocation methods to a certain extent when facing business fluctuations.
[0073] Figure 3 A data flow diagram showing the determination of the feedback adjustment value according to an embodiment of the present application is shown.
[0074] As Figure 3 shown, multiple evaluation indicators can be calculated, including the average response time 301 and the resource utilization rate 302. Determine the importance weight A 303 of the average response time and the importance weight B 304 of the resource utilization rate corresponding to the application type of the target application from the database. And based on the importance weight A 303, the importance weight B 304, the average response time 301, and the resource utilization rate 302, determine the performance score 305 of the target application in the target historical period. And determine the first sub-adjustment value 307 corresponding to the preset resource adjustment range 306 where the performance score is located from the database.
[0075] In addition, a second sub-adjustment value 312 can be obtained based on the difference 310 between the predicted historical resource value 308 and the actual historical resource usage value 309 of the target application during the target historical period and the priority weight 311. Furthermore, by adding the first sub-adjustment value 307 and the second sub-adjustment value 312, a feedback adjustment value 313 can be obtained.
[0076] According to an embodiment of the present application, determining the target resource allocation value of the target application in the current period based on the feedback adjustment value and the basic resource allocation value may include the following operations.
[0077] Based on the basic resource allocation value and a preset stability coefficient, a stable resource allocation value is obtained; based on the feedback adjustment value, the basic resource allocation value is adjusted to obtain a dynamic resource allocation value; the larger value of the stable resource allocation value and the dynamic resource allocation value is used as the target resource allocation value.
[0078] The basic resource allocation value may include: a basic CPU resource allocation value and a basic memory resource allocation value. The first sub-adjustment value may include: a first CPU sub-adjustment value and a first memory sub-adjustment value. The second sub-adjustment value may include: a second CPU sub-adjustment value and a second memory sub-adjustment value.
[0079] Based on the feedback adjustment value, adjusting the basic resource allocation value may be as shown in the following formulas (3) to (4).
[0080] (3)
[0081] (4)
[0082] Wherein, is the CPU resource allocation value of the i-th application in the t-th period, is the memory resource allocation value of the i-th application in the t-th period, is the basic CPU resource allocation value in the t-th period, is the basic memory resource allocation value of the i-th application in the t-th period, is the first CPU sub-adjustment value of the i-th application in the t-th period, is the first memory sub-adjustment value of the i-th application in the t-th period, and is the first adjustment coefficient, is the second CPU sub-adjustment value of the i-th application in the t-th period, is the second memory sub-adjustment value of the i-th application in the t-th period, is the second adjustment coefficient, is the priority weight of the i-th application, is the difference between the predicted value of historical CPU resources and the target historical CPU resource usage value, and is the difference between the predicted value of historical memory resources and the target historical memory resource usage value.
[0083] and The calculation formulas can be as shown in the following Formulas (5) to (6).
[0084] (5)
[0085] (6)
[0086] Among them, is the target historical CPU resource usage value, is the target historical memory resource usage value, is the predicted value of historical CPU resources, is the predicted value of historical memory resources.
[0087] The preset stability maintenance coefficient can be used to ensure that when resources are tense or the dynamic resource allocation value is too small due to dynamically adjusting the basic resource allocation value, the target application can at least obtain the stability maintenance resource allocation value to ensure the normal progress of business processing in the target application.
[0088] There is no limit to the preset stability maintenance coefficient, and different values can be set according to actual needs, such as: 0.8.
[0089] In some embodiments, the target resource allocation value can be further adjusted, such as: further adjusting it using a load balancing algorithm.
[0090] According to the embodiments of the present application, a dual-path resource allocation decision mechanism combining stability maintenance and dynamic optimization is constructed through the stability maintenance resource allocation value and the dynamic resource allocation value. The basic guarantee value is generated through the preset stability maintenance coefficient, and at the same time, the dynamic value is generated based on the dynamic adjustment factor. Finally, the maximum value of the two is taken as the allocation result. That is, a bottom-line guarantee is provided through the stability maintenance coefficient. When the dynamic adjustment value is too low due to abnormal fluctuations, such as: prediction model deviation, it can still ensure that the application obtains the resource amount to maintain basic functions, reducing the risk of system crashes.
[0091] In addition, based on the real-time CPU and memory usage values, dynamic resource scheduling using a priority scheduling strategy can flexibly adjust the resource allocation ratio according to the actual needs of the application, make better use of existing resources. The dynamic adjustment mechanism not only improves resource utilization, but also can give priority to ensuring the operation of critical applications when resources are tense, reducing the risk of service interruption caused by insufficient resources, and improving the overall stability and response speed of the system.
[0092] According to an embodiment of the present application, the resource allocation method further includes the following operations.
[0093] Based on the target resource allocation value and the resource allocation upper limit value corresponding to the target application, determine the resource usage range of the target application; based on the resource usage range, update the resource configuration file of the virtual machine used to run the target application to obtain the resource configuration result of the target application, where the resource configuration file is used to limit the resource usage of the target application.
[0094] In the initial configuration stage of the target application, through virtualization technology or containerization technology, an independent resource space can be created for the application, thereby solving the problem of resource contention between multiple applications and ensuring that each application obtains an independent and controllable resource space. Virtualization technology can be, for example, Kernel-based Virtual Machine (KVM) technology.
[0095] By setting the resource configuration file of the virtual machine or container, define the amount of CPU and memory resources required for each application to obtain a configured virtualized environment.
[0096] In the application startup stage, an automated deployment tool can be used to batch create and start virtual machines or containers in the configured virtualized environment to obtain an initialized application running environment.
[0097] The control group mechanism, i.e., the cgroups mechanism, can be used to limit the resource usage of each virtual machine or container in the initialized application running environment. The cgroups mechanism can control the CPU usage amount and memory resource amount that each application can use based on the resource usage range in the resource configuration file.
[0098] In each time period task, after obtaining the target resource allocation value, the resource usage range of the target application can be determined according to the preset resource allocation upper limit value and updated in the resource configuration file of the virtual machine running the target application. The resource allocation upper limit value is the expected maximum resource amount, which can be determined according to the historical resource usage value of the target application.
[0099] The resource usage range can include the CPU resource usage range and the memory resource usage range, as shown in the following formulas (7) to (8). In specific use, according to the resource usage range, the smaller value between the target resource allocation value and the resource allocation upper limit value can be used as the actual maximum resource amount that the target application can use.
[0100] (7)
[0101] (8)
[0102] Among them, is the actual maximum CPU resource amount of the i-th application, is the actual maximum memory resource amount of the i-th application, is the upper limit value of CPU resource allocation for the i-th application, is the upper limit value of memory resource allocation for the i-th application.
[0103] The actual resource usage in the target application running environment can be continuously monitored and displayed by using a preset monitoring tool and a display tool, and at the same time, the situation of resource overrun is processed to obtain a stable running application environment.
[0104] According to the embodiments of the present application, by continuously collecting and displaying the real-time CPU usage value and memory occupancy value of the target application through a real-time monitoring tool, not only can potential problems be discovered in a timely manner, but also it can help relevant staff make quick responses and adjust resource configurations.
[0105] According to the embodiments of the present application, an elastic resource range is generated by dynamically comparing the target resource allocation value with the preset maximum allocation value, and this range is directly mapped to the resource configuration file of the virtual machine to achieve isolation of resource usage between applications and real-time update of the resource configuration file, ensuring the dynamicity and real-time nature of the resource allocation strategy.
[0106] According to the embodiments of the present application, the historical resource prediction value is predicted by a resource prediction model; the resource allocation method further includes the following operations.
[0107] In the case where the difference between the historical resource prediction value and the target historical resource usage value in the target historical period is continuously greater than a preset threshold for a predetermined number of times, based on the historical resource prediction value and the historical resource usage value in the target historical period, the parameters of the resource prediction model are adjusted to obtain an updated resource prediction model.
[0108] The implementation manner of the resource prediction model is not limited, and it can be a Long Short-Term Memory Network (LSTM), a Temporal Convolutional Network (TCN), etc.
[0109] In the case where it is determined that the historical resource prediction value and the target historical resource usage value are both greater than the preset threshold for a continuous multiple times, that is, when the resource prediction model has long-term inaccurate predictions, the historical resource prediction value and the historical resource usage value in the target historical period can be added to the dataset of the resource prediction model to adjust the parameters of the resource prediction model through it.
[0110] According to an embodiment of the present application, when it is determined that the resource prediction model has inaccurate long-term predictions, parameter adjustment is performed, which can avoid inaccurate model predictions caused by excessive fluctuations in the load or task processing of the target application in a short period of time.
[0111] During the training process of the resource prediction model, a data collection tool can be used to collect historical operation data of the target application to obtain a historical operation data set; and a machine learning algorithm can be used to process and analyze the historical operation data set to generate a training set and a test set for the resource prediction model, and then the training set is used to train the resource prediction model, and the test set is used to test the resource prediction model.
[0112] The process of using a data collection tool to collect historical operation data of multiple applications to obtain a historical operation data set may include the following steps.
[0113] Use a preset monitoring system to monitor each application in the application execution environment with virtualization technology configured, expand its data collection ability by setting an index collector in the preset monitoring system, and obtain the historical operation data of the application; use the preset query language in the preset monitoring system to process the historical operation data of the application, and calculate the average CPU usage value and average memory usage value of each application within a specific time period; use a data cleaning algorithm to clean the preliminarily processed historical operation data, remove outliers and incomplete data records, and obtain a historical operation data set.
[0114] The average CPU usage value can be the average CPU usage rate or the average CPU usage amount; the average memory usage value can be the average memory usage rate or the average memory usage amount.
[0115] According to an embodiment of the present application, by using a preset monitoring system and a preset query language to process the historical operation data of the application, not only can the resource usage value of each application be accurately calculated, but also outliers and incomplete data records can be effectively removed, ensuring the accuracy and integrity of the historical operation data set, providing a reliable data basis for subsequent steps, helping to improve the accuracy of the prediction model, and ultimately achieving more effective resource management.
[0116] The process of using a machine learning algorithm to process and analyze the historical operation data set to generate a training set for the resource prediction model may include the following steps.
[0117] Preprocess the historical operation dataset using a preset preprocessing tool; the preprocessing includes data standardization and normalization operations to bring all feature values within the same scale range and obtain the standardized dataset; use a time series segmentation method to divide the standardized dataset into a training set and a test set; the training set and the test set can be segmented according to the ratio of 70% of the data for training and 30% of the data for testing to obtain the training set and the test set.
[0118] During the process of training the initial resource prediction model using the training set, the loss can be minimized by adjusting the network parameters. The expression of the loss function can be as shown in the following formula (9).
[0119] (9)
[0120] where, is the loss value, m is the number of samples, is the resource usage value, is the resource prediction value.
[0121] The smaller the MSE value, the better the model prediction effect. And when the MSE value meets the iteration condition, the initially trained initial resource prediction model is obtained. The cross-validation technique can be used to evaluate the initially trained initial resource prediction model. By randomly dividing the training set and the test set multiple times and calculating the average loss value each time, the trained resource prediction model is obtained.
[0122] The historical resource usage values of at least one historical period can be input into the resource prediction model to obtain the resource prediction value of the current period. When the resource prediction model is an LSTM model, the resource prediction value is as shown in formulas (10) to (11).
[0123] (10)
[0124] (11)
[0125] where, LSTM() represents the resource prediction model, is the historical CPU resource usage value of the t’th period, is the historical memory resource usage value of the t’th period.
[0126] According to an embodiment of the present application, data preprocessing is performed through a preset preprocessing library, and an optimized resource prediction model is trained using a deep learning model such as an LSTM model, which can improve the accuracy of prediction. The resource prediction model can not only capture long-term dependencies in the data but also adapt to changing application load conditions, thereby providing strong support for dynamically adjusting strategies and ensuring that the system can maintain efficient and stable operation under high load conditions.
[0127] Figure 4 A data flow diagram for resource allocation according to an embodiment of the present application is shown.
[0128] As Figure 4 shown, in the case where the time-period task 401 has been triggered, a basic resource allocation value 404 can be determined based on the resource prediction value 402 of the target application in the current period and the historical resource usage values 403 of at least one historical period; and a feedback adjustment value 409 can be obtained based on the priority weight 405 of the target application, as well as the performance evaluation data 406, historical resource prediction value 407, and target historical resource usage value 408 in the target historical period.
[0129] Thus, the basic resource allocation value 402 is dynamically adjusted by the feedback adjustment value 409 to obtain the target resource allocation value 410.
[0130] A resource usage range 412 of the target application can be obtained based on the target resource allocation value 410 and the resource allocation upper limit value 411, and the resource configuration file 413 of the virtual machine running the target application is updated using it to obtain the resource configuration result 414 of the target application, so as to implement resource usage restrictions on the target application.
[0131] In addition, a preset monitoring system can be used to continuously monitor and calculate the actual running data of each application in the stable running application environment to obtain the performance evaluation data in the current period.
[0132] The obtained performance evaluation data is compared and analyzed with a preset index range using a comparative analysis method to obtain a performance analysis result. The performance comparison results include: performance bottleneck, resource waste, or normal state.
[0133] And in the case where the performance comparison result is a performance bottleneck or resource waste, a root cause analysis tool is used to perform root cause analysis on the performance analysis result to find out the root cause leading to the performance bottleneck or resource waste.
[0134] Furthermore, a feedback mechanism is used to feedback the root cause analysis report to relevant staff, and a corresponding improvement strategy is matched from the database according to the specific situation.
[0135] According to the embodiments of the present application, by adopting a performance evaluation method combined with a feedback mechanism to check the running effect of an application program and proposing improvement measures according to the evaluation results, the system performance can be continuously optimized. The closed-loop management method not only helps to identify performance bottlenecks and resource waste problems in the system, but also guides staff such as operation and maintenance personnel to optimize it specifically, thereby gradually improving the running efficiency and service quality of the system.
[0136] Based on the above resource allocation method, the present application further provides a resource allocation device. The following will be combined with Figure 5 to describe this device in detail.
[0137] Figure 5 The block diagram of the resource allocation device according to the embodiments of the present application is shown.
[0138] As Figure 5 shown, the resource allocation device 500 of this embodiment includes a first determination module 510, a second determination module 520, and a third determination module 530.
[0139] The first determination module 510 is configured to, in response to a triggered time-period task, determine a basic resource allocation value based on the resource prediction value of the target application program in the current time period and the historical resource usage values in at least one historical time period.
[0140] The second determination module 520 is configured to determine a feedback adjustment value based on the priority weight of the target application program, as well as the performance evaluation data, historical resource prediction values, and target historical resource usage values in the target historical time period, where the target historical time period is the historical time period adjacent to the current time period.
[0141] The third determination module 530 is configured to determine the target resource allocation value of the target application program in the current time period based on the feedback adjustment value and the basic resource allocation value.
[0142] According to the embodiments of the present application, the second determination module includes: a score determination sub-module, a first value determination sub-module, a second value determination sub-module, and a third value determination sub-module.
[0143] The score determination sub-module is configured to determine the performance score of the target application program in the target historical time period based on the performance evaluation data.
[0144] The first value determination sub-module is configured to determine a first sub-adjustment value corresponding to the preset resource adjustment range when it is determined that the performance score is within the preset resource adjustment range.
[0145] The second value determination sub-module is configured to determine a second sub-adjustment value based on the difference between the historical resource prediction value and the target historical resource usage value in the target historical time period, as well as the priority weight.
[0146] The third value determination submodule is configured to determine a feedback adjustment value based on the first sub-adjustment value and the second sub-adjustment value.
[0147] According to an embodiment of the present application, the performance evaluation data includes at least one of the following evaluation indicators: average response time, resource utilization. The score determination submodule includes: a weight determination unit and a weighted summation unit.
[0148] The weight determination unit is configured to determine an importance weight for at least one evaluation indicator based on an application type of the target application.
[0149] The weighted summation unit is used to perform weighted summation on at least one evaluation indicator based on at least one importance weight to obtain a performance score.
[0150] According to an embodiment of the present application, the third determination module includes: a stabilization value determination submodule, a dynamic value determination submodule and a target value determination submodule.
[0151] The stabilization value determination submodule is used to obtain the stabilization resource allocation value based on the basic resource allocation value and the preset stabilization coefficient.
[0152] The dynamic value determination submodule is used to adjust the basic resource allocation value based on the feedback adjustment value to obtain a dynamic resource allocation value.
[0153] The target value determination submodule is used to take the larger value of the stability maintenance resource allocation value and the dynamic resource allocation value as the target resource allocation value.
[0154] According to an embodiment of the present application, the first determination module includes: a reference value determination submodule and an allocation value determination submodule.
[0155] The reference value determination submodule is used to multiply a preset safety factor by an average of historical resource usage values of at least one historical period to obtain a historical resource reference value.
[0156] The allocation value determination submodule is used to perform weighted summation of the resource prediction value and the historical resource reference value to determine the basic resource allocation value.
[0157] According to an embodiment of the present application, the resource allocation apparatus 500 further includes: a range determination module and a file update module.
[0158] The scope determination module is used to determine the resource usage scope of the target application based on the target resource allocation value and the resource allocation upper limit value corresponding to the target application.
[0159] A file update module, configured to update a resource configuration file of a virtual machine for running a target application based on a resource usage range, so as to obtain a resource configuration result of the target application, where the resource configuration file is used to limit the resource usage of the target application.
[0160] According to an embodiment of the present application, the historical resource prediction value is predicted by a resource prediction model. The resource allocation device 500 further includes: a parameter adjustment module.
[0161] The parameter adjustment module is configured to, when the difference between the historical resource prediction value and the historical resource usage value in a target historical period is greater than a preset threshold for a continuous predetermined number of times, adjust the parameters of the resource prediction model based on the historical resource prediction value and the target historical resource usage value in the target historical period, so as to obtain an updated resource prediction model.
[0162] According to an embodiment of the present application, any multiple of the first determination module 510, the second determination module 520, and the third determination module 530 may be combined and implemented in one module, or any one of them may be split into multiple modules. Alternatively, at least part of the functions of one or more of these modules may be combined with at least part of the functions of other modules and implemented in one module. According to an embodiment of the present application, at least one of the first determination module 510, the second determination module 520, and the third determination module 530 may be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on chip, a system on substrate, a system on package, an application specific integrated circuit (ASIC), or any other reasonable way of integrating or packaging circuits, etc., implemented by hardware or firmware, or implemented in any one of the three implementation manners of software, hardware, and firmware, or in an appropriate combination of any several of them. Alternatively, at least one of the first determination module 510, the second determination module 520, and the third determination module 530 may be at least partially implemented as a computer program module, and when the computer program module runs, it can execute the corresponding functions.
[0163] Figure 6 The block diagram of an electronic device suitable for implementing the resource allocation method according to an embodiment of the present application is shown.
[0164] As Figure 6As shown, the electronic device 600 according to an embodiment of the present application includes a processor 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage section 608 into a random access memory (RAM) 603. The processor 601 may include, for example, a general-purpose microprocessor (e.g., CPU), an instruction set processor, and / or a related chipset, and / or a dedicated microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 601 may also include on-board memory for caching purposes. The processor 601 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present application.
[0165] In the RAM 603, various programs and data required for the operation of the electronic device 600 are stored. The processor 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. The processor 601 performs various operations of the method flow according to an embodiment of the present application by executing the program in the ROM 602 and / or the RAM 603. It should be noted that the program may also be stored in one or more memories other than the ROM 602 and the RAM 603. The processor 601 may also perform various operations of the method flow according to an embodiment of the present application by executing the program stored in the one or more memories.
[0166] According to an embodiment of the present application, the electronic device 600 may further include an input / output (I / O) interface 605, and the input / output (I / O) interface 605 is also connected to the bus 604. The electronic device 600 may further include one or more of the following components connected to the input / output (I / O) interface 605: an input section 606 including a keyboard, a mouse, etc.; an output section 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, a modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A driver 610 is also connected to the input / output (I / O) interface 605 as needed. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the driver 610 as needed, so that a computer program read from it can be installed into the storage section 608 as needed.
[0167] The present application also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or may exist independently without being assembled into the device / apparatus / system. The above computer-readable storage medium carries one or more programs, and when the above one or more programs are executed, the methods according to the embodiments of the present application are implemented.
[0168] According to an embodiment of the present application, the computer-readable storage medium may be a non-volatile computer-readable storage medium, for example, may include but not be limited to: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the above. In the present application, the computer-readable storage medium may be any tangible medium that contains or stores a program, and the program may be used by or in conjunction with an instruction execution system, apparatus, or device. For example, according to an embodiment of the present application, the computer-readable storage medium may include the above-described ROM 602 and / or RAM 603 and / or one or more memories other than ROM 602 and RAM 603.
[0169] Embodiments of the present application also include a computer program product, which includes a computer program that contains program code for executing the method shown in the flowchart. When the computer program product runs in a computer system, the program code is used to cause the computer system to implement the method provided by the embodiments of the present application.
[0170] When the computer program is executed by the processor 601, the above functions defined in the system / apparatus of the embodiments of the present application are executed. According to an embodiment of the present application, the above-described systems, apparatuses, modules, units, etc. may be implemented by computer program modules.
[0171] In one embodiment, the computer program may rely on tangible storage media such as optical storage devices and magnetic storage devices. In another embodiment, the computer program may also be transmitted and distributed in the form of a signal on a network medium, and be downloaded and installed through the communication part 609, and / or be installed from the removable medium 611. The program code included in the computer program may be transmitted using any suitable network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0172] In such an embodiment, the computer program can be downloaded and installed from a network through the communication section 609, and / or installed from the removable medium 611. When the computer program is executed by the processor 601, the above functions defined in the system of the embodiments of the present application are performed. According to the embodiments of the present application, the systems, devices, apparatuses, modules, units, etc. described above can be implemented by computer program modules.
[0173] According to the embodiments of the present application, the program code for executing the computer program provided by the embodiments of the present application can be written in any combination of one or more programming languages. Specifically, these computing programs can be implemented using high-level procedures and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages include, but are not limited to, such as Java, C++, Python, the "C" language, or similar programming languages. The program code can be executed entirely on the user computing device, partially on the user device, partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device can be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (for example, by connecting through an Internet service provider via the Internet).
[0174] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagram may represent a module, a program segment, or a part of code, and the above module, program segment, or part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than marked in the accompanying drawings. For example, two consecutive blocks shown may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram or flowchart, and the combination of blocks in the block diagram or flowchart, can be implemented by a dedicated hardware-based system for performing the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.
[0175] Those skilled in the art can understand that the features described in the various embodiments of the present application can be combined and / or combined in various ways, even if such combinations or combinations are not explicitly described in the present application. In particular, without departing from the spirit and teachings of the present application, the features described in the various embodiments of the present application can be combined and / or combined in various ways. All such combinations and / or combinations fall within the scope of the present application.
[0176] The embodiments of the present application have been described above. However, these embodiments are for illustrative purposes only and are not intended to limit the scope of the present application. Although the embodiments have been described separately above, this does not mean that the measures in each embodiment cannot be used advantageously in combination. Without departing from the scope of the present application, those skilled in the art can make various substitutions and modifications, and all such substitutions and modifications shall fall within the scope of the present application.
Claims
1. A resource allocation method, characterized in that, The method includes: In response to a triggered time - period task, determining a basic resource allocation value based on a resource prediction value of the target application in the current period and historical resource usage values in at least one historical period; Determining a feedback adjustment value based on the priority weight of the target application, and performance evaluation data, historical resource prediction values, and target historical resource usage values in a target historical period, where the target historical period is a historical period adjacent to the current period; Determining a target resource allocation value of the target application in the current period based on the feedback adjustment value and the basic resource allocation value.
2. The resource allocation method according to claim 1, wherein The determining a feedback adjustment value based on the priority weight of the target application, and performance evaluation data, historical resource prediction values, and target historical resource usage values in a target historical period includes: Determining a performance score of the target application in the target historical period based on the performance evaluation data; When it is determined that the performance score is within a preset resource adjustment range, determining a first sub - adjustment value corresponding to the preset resource adjustment range; Determining a second sub - adjustment value based on the difference between the historical resource prediction value and the target historical resource usage value in the target historical period, and the priority weight; Determining the feedback adjustment value based on the first sub - adjustment value and the second sub - adjustment value.
3. The resource allocation method according to claim 2, wherein The performance evaluation data includes at least one of the following evaluation metrics: average response time, resource utilization rate; the determining a performance score of the target application in the target historical period based on the performance evaluation data includes: Determining an importance weight for at least one of the evaluation metrics based on the application type of the target application; Obtaining the performance score based on at least one of the importance weights and at least one of the evaluation metrics.
4. The resource allocation method according to claim 1, wherein The determining a target resource allocation value of the target application in the current period based on the feedback adjustment value and the basic resource allocation value includes: Obtaining a stability - maintaining resource allocation value based on the basic resource allocation value and a preset stability - maintaining coefficient; Adjusting the basic resource allocation value based on the feedback adjustment value to obtain a dynamic resource allocation value; Taking the larger value of the stability - maintaining resource allocation value and the dynamic resource allocation value as the target resource allocation value.
5. The resource allocation method according to claim 1, characterized in that The determining a basic resource allocation value based on a resource prediction value of the target application in the current period and historical resource usage values in at least one historical period includes: Multiplying a preset safety coefficient by the average value of the historical resource usage values in at least one of the historical periods to obtain a historical resource reference value; Performing a weighted sum of the resource prediction value and the historical resource reference value to determine the basic resource allocation value.
6. The resource allocation method according to claim 1, wherein The resource allocation method further includes: Determining a resource usage range of the target application based on the target resource allocation value and a resource allocation upper limit value corresponding to the target application. Based on the resource usage scope, update the resource configuration file of the virtual machine used to run the target application to obtain the resource configuration result of the target application, where the resource configuration file is used to limit the resource usage of the target application.
7. The resource allocation method according to claim 1, wherein The historical resource prediction value is predicted by a resource prediction model; the resource allocation method further includes: When the difference between the historical resource prediction value in the target historical period and the target historical resource usage value is continuously greater than a preset threshold for a predetermined number of times, based on the historical resource prediction value and the historical resource usage value in the target historical period, adjust the parameters of the resource prediction model to obtain an updated resource prediction model.
8. A resource allocation device, characterized in that, The resource allocation device includes: A first determination module, configured to, in response to a triggered time-period task, determine a basic resource allocation value based on the resource prediction value of the target application in the current period and the historical resource usage values of at least one historical period; A second determination module, configured to determine a feedback adjustment value based on the priority weight of the target application, and the performance evaluation data, historical resource prediction value, and target historical resource usage value in the target historical period, where the target historical period is a historical period adjacent to the current period; A third determination module, configured to determine the target resource allocation value of the target application in the current period based on the feedback adjustment value and the basic resource allocation value.
9. An electronic device, comprising: One or more processors; A memory, configured to store one or more computer programs, wherein the one or more processors execute the one or more computer programs to implement the steps of the resource allocation method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program or instructions stored thereon, characterized in that, The computer program or instruction, when executed by the processor, implements the steps of the resource allocation method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Resource occupation method and device, equipment, storage medium and program product
CN118172142A
Hybrid NR service dynamic resource allocation method and system
CN118804317A
Server resource utilization rate improving method, system, device, medium and product
CN119292776A
Methods and apparatus for controlling prediction units
WO2024052634A1