Resource usage amount prediction method, device and equipment
By obtaining historical resource information in cloud service providers and determining multiple statistical cycles, using preset models to process resource usage average information and fluctuation information, the problem of poor accuracy of resource usage prediction in the prior art is solved, and higher prediction accuracy and noise immunity are achieved.
Patent Information
- Application Number
- CN202311493976.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-09
- Publication Date
- 2025-05-09
AI Technical Summary
When predicting the resource usage of cloud products, the historical time is too long to capture the sharp changes in recent resource usage. The historical time is too short to cause insufficient noise immunity, resulting in poor accuracy of the target resource usage.
By obtaining the historical resource information of the target object, multiple statistical cycles are determined, and processing is done based on the resource usage average information and resource usage fluctuation information corresponding to these statistical cycles, and the target resource usage is predicted using a preset model.
It improves the prediction accuracy of target resource usage and can better capture the volatility and change trends of resource usage, and has higher accuracy than the average prediction of resource usage within the historical period.
Smart Images

Figure CN119961108A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of big data processing, and in particular to a method, device and equipment for predicting resource usage. Background Art
[0002] When providing cloud products (e.g., virtual machines) to users, cloud service providers can predict the computing resources required by users to use cloud products, so as to flexibly call on computing resources and provide cloud product services to users.
[0003] In related technologies, multiple historical resource usages of a cloud product within a historical period can be determined, and the average of the multiple historical resource usages can be determined as the target resource usage of the cloud product. However, in the above method, the target resource usage is strongly correlated with the set historical period. When the historical period is long, the sharp change trend of actual resource usage in the recent period cannot be taken into account; when the historical period is short, it is easy to cause the noise resistance of the target resource usage to become weak.
[0004] It can be seen from the above that the accuracy of determining the target resource usage in the relevant method is poor. Summary of the invention
[0005] Multiple aspects of the present application provide a resource usage prediction method, device, and apparatus to improve the accuracy of determining target resource usage.
[0006] In a first aspect, an embodiment of the present application provides a method for predicting resource usage, including:
[0007] Acquire historical resource information of a target object, wherein the historical resource information includes a plurality of historical time periods and a historical resource amount of a target resource used by the target object in each historical time period;
[0008] Determine at least one statistical period, and determine the resource usage average information and resource usage fluctuation information corresponding to each statistical period according to the historical resource information, to obtain at least one resource usage average information and at least one resource usage fluctuation information;
[0009] The at least one resource usage average information and the at least one resource usage fluctuation information are processed through a preset model to obtain a target resource usage of the target resource by the target object in a target time period.
[0010] In a second aspect, an embodiment of the present application provides a method for predicting resource usage, including:
[0011] Acquire historical resource information of a target object, the historical resource information including multiple historical time periods and the historical resource amount of the target resource used by the target object in each historical time period, the target object is a virtual machine, and the target resource includes at least one of the following: processor resources, memory resources, and bandwidth resources;
[0012] Determine at least one statistical period, and determine the resource usage average information and resource usage fluctuation information corresponding to each statistical period according to the historical resource information, to obtain at least one resource usage average information and at least one resource usage fluctuation information;
[0013] The at least one resource usage average information and the at least one resource usage fluctuation information are processed through a preset model to obtain a target resource usage of the target resource by the target object in a target time period.
[0014] In a possible implementation manner, for any statistical period, determining the resource usage average information and resource usage fluctuation information corresponding to the statistical period according to the historical resource information includes:
[0015] According to the statistical period and the historical time periods corresponding to the historical resource quantities in the historical resource information, multiple historical resource quantities in the historical resource information are grouped to obtain at least one resource quantity set, wherein the historical time periods corresponding to the historical resource quantities in the resource quantity set are within the same statistical period;
[0016] The resource usage average information and the resource usage fluctuation information are determined according to the multiple resource quantity sets.
[0017] In a possible implementation, according to the statistical period and the historical time period corresponding to each historical resource amount in the historical resource information, multiple historical resource amounts in the historical resource information are grouped to obtain at least one resource amount set, including:
[0018] Determine an earliest time and a latest time according to multiple historical time periods corresponding to the multiple historical resource quantities, wherein the earliest time is the start time of the earliest historical time period among the multiple historical time periods, and the latest time is the end time of the latest historical time period among the multiple historical time periods;
[0019] According to the cycle duration of the statistical cycle, the period between the earliest time and the latest time is divided into at least one divided period, and the duration of the divided period is less than or equal to the cycle duration;
[0020] Determine, among the multiple historical resource quantities, at least one historical resource quantity corresponding to each divided time period, wherein the historical time period corresponding to the historical resource quantity is within the divided time period;
[0021] At least one historical resource amount corresponding to each divided time period is determined as a corresponding resource amount set to obtain the at least one resource amount set.
[0022] In a possible implementation manner, determining the resource usage average information according to the multiple resource amount sets includes:
[0023] For any resource quantity set, the average value of each historical resource quantity in the resource quantity set is determined as the average resource quantity corresponding to the resource quantity set;
[0024] Generate a resource mean sequence according to the average resource amount corresponding to each resource amount set, wherein the resource mean sequence includes the average resource amount corresponding to each resource amount set;
[0025] The resource mean value sequence is determined as the resource usage average information.
[0026] In a possible implementation, generating a resource mean sequence according to the average resource amount corresponding to each resource amount set includes:
[0027] For any resource quantity set, determining the historical period corresponding to the resource quantity set according to the historical period corresponding to each historical resource quantity in the resource quantity set;
[0028] Determining an arrangement order of the plurality of resource quantity sets according to an order from front to back of the historical time periods corresponding to each resource quantity set;
[0029] According to the arrangement order, the average resource quantities corresponding to the multiple resource quantity sets are subjected to sequence combination processing to obtain the resource mean sequence.
[0030] In a possible implementation manner, determining the resource usage fluctuation information according to the multiple resource quantity sets includes:
[0031] For any resource quantity set, determine the resource quantity difference corresponding to the resource quantity set according to the maximum resource quantity and the minimum resource quantity in the resource quantity set;
[0032] Generate a resource difference value sequence according to the resource difference value corresponding to each resource amount set, wherein the resource difference value sequence includes the resource difference value corresponding to each resource amount set;
[0033] Determining that the resource usage fluctuation information includes the resource difference sequence.
[0034] In a possible implementation, the method further includes:
[0035] For any resource quantity set, determining the resource quantity variance corresponding to the resource quantity set according to the historical resource quantities in the resource quantity set;
[0036] Generate a resource variance sequence according to the resource variance corresponding to each resource quantity set, wherein the resource variance sequence includes the resource variance corresponding to each resource quantity set;
[0037] Determining the resource usage fluctuation information also includes the resource variance sequence.
[0038] In a possible implementation, the method further includes:
[0039] Obtaining at least one historical resource estimate predicted for the target object by the preset model, and an actual resource usage corresponding to each historical resource estimate;
[0040] The confidence level of the resource usage prediction of the target object by the preset model is determined based on the at least one historical resource estimate and the actual resource usage corresponding to each historical resource estimate.
[0041] In a possible implementation, determining, according to the at least one historical resource estimate and the actual resource usage corresponding to each historical resource estimate, the confidence level of the resource usage prediction of the target object by the preset model includes:
[0042] Obtaining a plurality of estimated deviations according to the at least one historical resource estimated amount and the actual resource usage corresponding to each historical resource estimated amount;
[0043] The confidence level is determined according to the multiple estimated deviation amounts and the resource usage fluctuation information.
[0044] In a possible implementation manner, determining the confidence level according to the multiple estimated deviations and the resource usage fluctuation information includes:
[0045] Performing statistical processing on the resource usage fluctuation information to obtain a reference fluctuation value;
[0046] For any estimated deviation, determine a reference confidence level corresponding to the estimated deviation according to the estimated deviation and the reference fluctuation value;
[0047] The statistical value of the reference confidence level corresponding to each estimated deviation is determined as the confidence level.
[0048] In a third aspect, an embodiment of the present application provides a resource usage prediction device, the resource usage prediction device comprising: a first acquisition module, a first determination module and a processing module, wherein:
[0049] The first acquisition module is used to acquire historical resource information of the target object, wherein the historical resource information includes multiple historical time periods and the historical resource amount of the target resource used by the target object in each historical time period;
[0050] The first determination module is used to determine at least one statistical period, and determine the resource usage average information and resource usage fluctuation information corresponding to each statistical period according to the historical resource information, to obtain at least one resource usage average information and at least one resource usage fluctuation information;
[0051] The processing module is used to process the at least one resource usage average information and the at least one resource usage fluctuation information through a preset model to obtain a target resource usage of the target resource by the target object in a target time period.
[0052] In a possible implementation manner, for any statistical period, the first determining module is specifically configured to:
[0053] According to the statistical period and the historical time periods corresponding to the historical resource quantities in the historical resource information, multiple historical resource quantities in the historical resource information are grouped to obtain at least one resource quantity set, wherein the historical time periods corresponding to the historical resource quantities in the resource quantity set are within the same statistical period;
[0054] The resource usage average information and the resource usage fluctuation information are determined according to the multiple resource quantity sets.
[0055] In a possible implementation manner, the first determining module is specifically configured to:
[0056] Determine an earliest time and a latest time according to multiple historical time periods corresponding to the multiple historical resource quantities, wherein the earliest time is the start time of the earliest historical time period among the multiple historical time periods, and the latest time is the end time of the latest historical time period among the multiple historical time periods;
[0057] According to the cycle duration of the statistical cycle, the period between the earliest time and the latest time is divided into at least one divided period, and the duration of the divided period is less than or equal to the cycle duration;
[0058] Determine, among the multiple historical resource quantities, at least one historical resource quantity corresponding to each divided time period, wherein the historical time period corresponding to the historical resource quantity is within the divided time period;
[0059] At least one historical resource amount corresponding to each divided time period is determined as a corresponding resource amount set to obtain the at least one resource amount set.
[0060] In a possible implementation manner, the first determining module is specifically configured to:
[0061] For any resource quantity set, the average value of each historical resource quantity in the resource quantity set is determined as the average resource quantity corresponding to the resource quantity set;
[0062] Generate a resource mean sequence according to the average resource amount corresponding to each resource amount set, wherein the resource mean sequence includes the average resource amount corresponding to each resource amount set;
[0063] The resource mean value sequence is determined as the resource usage average information.
[0064] In a possible implementation manner, the first determining module is specifically configured to:
[0065] For any resource quantity set, determining the historical period corresponding to the resource quantity set according to the historical period corresponding to each historical resource quantity in the resource quantity set;
[0066] Determining an arrangement order of the plurality of resource quantity sets according to an order from front to back of the historical time periods corresponding to each resource quantity set;
[0067] According to the arrangement order, the average resource quantities corresponding to the multiple resource quantity sets are subjected to sequence combination processing to obtain the resource mean sequence.
[0068] In a possible implementation manner, the first determining module is specifically configured to:
[0069] For any resource quantity set, determine the resource quantity difference corresponding to the resource quantity set according to the maximum resource quantity and the minimum resource quantity in the resource quantity set;
[0070] Generate a resource difference value sequence according to the resource difference value corresponding to each resource amount set, wherein the resource difference value sequence includes the resource difference value corresponding to each resource amount set;
[0071] Determining that the resource usage fluctuation information includes the resource difference sequence.
[0072] In a possible implementation manner, the first determining module is further configured to:
[0073] For any resource quantity set, determining the resource quantity variance corresponding to the resource quantity set according to the historical resource quantities in the resource quantity set;
[0074] Generate a resource variance sequence according to the resource variance corresponding to each resource quantity set, wherein the resource variance sequence includes the resource variance corresponding to each resource quantity set;
[0075] Determining the resource usage fluctuation information also includes the resource variance sequence.
[0076] In a possible implementation manner, the resource usage prediction device further includes: a second acquisition module and a second determination module, wherein:
[0077] The second acquisition module is used to acquire at least one historical resource estimation amount predicted by the preset model for the target object, and the actual resource usage amount corresponding to each historical resource estimation amount;
[0078] The second determination module is used to determine the confidence level of the preset model in predicting the resource usage of the target object based on the at least one historical resource estimate and the actual resource usage corresponding to each historical resource estimate.
[0079] In a possible implementation manner, the second determining module is specifically configured to:
[0080] Obtaining a plurality of estimated deviations according to the at least one historical resource estimated amount and the actual resource usage corresponding to each historical resource estimated amount;
[0081] The confidence level is determined according to the multiple estimated deviation amounts and the resource usage fluctuation information.
[0082] In a possible implementation manner, the second determining module is specifically configured to:
[0083] Performing statistical processing on the resource usage fluctuation information to obtain a reference fluctuation value;
[0084] For any estimated deviation, determine a reference confidence level corresponding to the estimated deviation according to the estimated deviation and the reference fluctuation value;
[0085] The statistical value of the reference confidence level corresponding to each estimated deviation is determined as the confidence level.
[0086] In a fourth aspect, an embodiment of the present application provides an electronic device, including: a memory and a processor;
[0087] The memory stores computer-executable instructions;
[0088] The processor executes the computer-executable instructions stored in the memory, so that the processor performs the method according to any one of the first aspect or the second aspect.
[0089] In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the method described in any one of the first aspect or the second aspect.
[0090] In a sixth aspect, an embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the method shown in any one of the first aspect or the second aspect.
[0091] The embodiment of the present application provides a resource usage prediction method, device and equipment, the electronic device can obtain the historical resource information of the target object, can determine at least one statistical period, and determine the resource usage average information and resource usage fluctuation information corresponding to each statistical period according to the historical resource information, obtain at least one resource usage average information and at least one resource usage fluctuation information, and then process the at least one resource usage average information and at least one resource usage fluctuation information through a preset model to obtain the target resource usage of the target object in the target period. Since the target resource usage can be comprehensively predicted not only based on the resource usage average value corresponding to different statistical periods, but also based on the resource usage fluctuation information corresponding to different statistical periods, compared with directly determining the resource usage average value within the historical duration as the target resource usage, the accuracy of determining the target resource usage is improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0092] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0093] Figure 1 A schematic diagram of a scenario provided for an exemplary embodiment of the present application;
[0094] Figure 2 A flowchart of a method for predicting resource usage provided by an exemplary embodiment of the present application;
[0095] Figure 3 A flowchart of another resource usage prediction method provided for an exemplary embodiment of the present application;
[0096] Figure 4 A schematic diagram of a method for predicting resource usage provided in an embodiment of the present application;
[0097] Figure 5 A schematic diagram of the structure of a device for predicting resource usage is provided for an embodiment of the present application;
[0098] Figure 6 A schematic diagram of the structure of another resource usage prediction device provided in an embodiment of the present application;
[0099] Figure 7 A schematic structural diagram of an electronic device is provided for an exemplary embodiment of the present application. DETAILED DESCRIPTION
[0100] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0101] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described below in combination with the specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.
[0102] Figure 1 A schematic diagram of a scenario provided for an exemplary embodiment of the present application. Figure 1 For any target object, the historical resource information of the target object within the historical duration can be determined. The historical resource information can include multiple historical time periods and the historical resource amount corresponding to each historical time period. The target resource usage of the target object in the target time period can be predicted based on the historical resource information.
[0103] For example, if the target object is virtual machine 1, the historical duration is 2023.8.1-2023.9.30, and the target resource is CPU usage, the historical resource information of virtual machine 1 between 2023.8.1-2023.9.30 can be determined, and the historical resource information can include CPU usage 1 corresponding to historical period 1, CPU usage 2 corresponding to historical period 2, ..., CPU usage n corresponding to historical period n. If the target period is 2023.10.2, the CPU usage of virtual machine 1 on 2023.10.2 can be predicted based on the historical resource information.
[0104] In related technologies, multiple historical resource usages of a cloud product within a historical period can be determined, and the average of the multiple historical resource usages can be determined as the target resource usage of the cloud product. However, in the above method, the target resource usage is strongly correlated with the set historical period. When the historical period is long, the sharp change trend of actual resource usage in the recent period cannot be taken into account; when the historical period is short, it is easy to cause the noise resistance of the target resource usage to become weak.
[0105] In the embodiment of the present application, at least one statistical period can be determined, and the average resource usage information and resource usage fluctuation information corresponding to each statistical period can be determined based on the historical resource information of the target object, and then at least one of the average resource usage information and resource usage fluctuation information can be processed through a preset model to predict the target resource usage of the target object in the target period. Since the target resource usage can be comprehensively predicted based not only on the average resource usage corresponding to different statistical periods, but also on the resource usage fluctuation information corresponding to different statistical periods, the accuracy of determining the target resource usage is improved compared to directly determining the average resource usage within the historical duration as the target resource usage.
[0106] The technical solutions shown in the present application are described in detail below through specific embodiments. It should be noted that the following embodiments can exist independently or in combination with each other, and the same or similar contents will not be described repeatedly in different embodiments.
[0107] Figure 2 A flowchart of a resource usage prediction method provided by an exemplary embodiment of the present application. Figure 2 , the method may include:
[0108] S201. Obtain historical resource information of a target object.
[0109] The execution subject of the embodiment of the present application may be an electronic device, or a prediction device for resource usage set in the electronic device. The prediction device for resource usage may be implemented by software, or by a combination of software and hardware. The prediction device for resource usage may be a processor in the electronic device. For ease of understanding, the following description is made by taking the execution subject as an electronic device as an example.
[0110] The target object is a cloud product. For example, the target object can be a virtual machine.
[0111] The historical resource information includes multiple historical time periods and the historical resource amount of the target resource used by the target object in each historical time period.
[0112] The target resources may be processor resources, memory resources, bandwidth resources, and other resources required by the virtual machine when it is running.
[0113] The historical resource usage may be a maximum historical resource usage, an average historical resource usage, or a minimum historical resource usage of the target resource used by the target object in each historical period.
[0114] For example, if the target object is virtual machine 1, and if the historical duration is 2023.8.1-2023.9.30, which includes multiple historical periods, the multiple historical periods are 2023.8.1, 2023.8.2, ..., 2023.9.30. If the target resource is a processor (Central Processing Unit, CPU), the historical resource information may include the historical CPU usage of virtual machine 1 on 2023.8.1, 2023.8.2, ..., 2023.9.30, that is, 61 historical CPU usages, as shown in Table 1:
[0115] Table 1
[0116] 2023.8.1 2023.8.2 2023.8.3 …… 2023.9.30 Virtual Machine 1 80% 90% 70% …… 70%
[0117] The electronic device may collect historical resource usage of the target resource used by the target object in each historical period within the historical time period to obtain historical resource usage information.
[0118] S202. Determine at least one statistical period, and determine average resource usage information and resource usage fluctuation information corresponding to each statistical period based on historical resource information, to obtain at least one average resource usage information and at least one resource usage fluctuation information.
[0119] At least one statistical period may be preset manually. At least one statistical period corresponds to a different period length. For example, two statistical periods may be preset, the first statistical period may be 31 days, and the second statistical period may be 7 days.
[0120] In an optional embodiment, for any statistical period, the average resource usage information and resource usage fluctuation information corresponding to the statistical period can be determined based on the historical resource information in the following manner: according to the statistical period and the historical time periods corresponding to each historical resource quantity in the historical resource information, multiple historical resource quantities in the historical resource information are grouped and processed to obtain at least one resource quantity set; based on the multiple resource quantity sets, the average resource usage information and resource usage fluctuation information are determined.
[0121] For any statistical period, multiple statistical periods can be determined according to multiple historical time periods, and then multiple historical resource quantities can be grouped according to the multiple statistical periods, and the historical resource quantities corresponding to multiple historical time periods in any statistical period are divided into a resource quantity set to obtain multiple resource quantity sets. Each statistical period can correspond to a resource quantity set. The historical time periods corresponding to the historical resource quantities in the resource quantity set can be in the same statistical period.
[0122] For example, if the historical resource information is as shown in Table 1, including the historical CPU usage for each day from 2023.8.1 to 2023.9.30, if there are two statistical periods, namely a 7-day statistical period and a 30-day statistical period, then for the 7-day statistical period, 9 statistical periods can be determined based on multiple historical time periods, and each statistical period can include multiple historical time periods. The 7 historical CPU usages corresponding to the 7 historical time periods in each statistical period can be divided into a resource quantity set. Since there are 9 statistical periods, 9 resource quantity sets can be determined, namely resource quantity set 1-1, resource quantity set 1-2, ..., resource quantity set 1-9, wherein each resource quantity set in resource quantity set 1-1 to resource quantity set 1-8 can include 7 historical CPU usages, and resource quantity set 1-9 can include 5 historical CPU usages.
[0123] Similarly, for a 31-day statistical period, two statistical periods can be determined based on multiple historical periods, and statistical period 1 can include 31 historical periods between 2023.8.1 and 2023.8.31, and statistical period 2 can include 30 historical periods between 2023.9.1 and 2023.9.30. The 31 historical CPU usages corresponding to the 31 historical periods in statistical period 1 can be divided into resource amount set 2-1, and the 30 historical CPU usages corresponding to the 30 historical periods in statistical period 2 can be divided into resource amount set 2-2.
[0124] After determining multiple resource quantity sets, the average resource quantities corresponding to the multiple resource quantity sets can be determined to obtain multiple average resource quantities, and then the average resource usage information can be determined based on the multiple average resource quantities; the fluctuation information corresponding to the multiple resource quantity sets can be determined, and then the resource usage fluctuation information can be determined based on the multiple fluctuation information.
[0125] The average resource usage information and the resource usage fluctuation information can be represented by a one-dimensional vector.
[0126] The resource usage average information may include multiple average resource amounts.
[0127] The fluctuation information can be represented by a resource quantity difference value or a resource quantity variance. The resource usage fluctuation information can include multiple resource quantity differences or multiple resource quantity variances.
[0128] For example, if there are 9 resource quantity sets corresponding to a 7-day statistical period, the average resource quantities corresponding to the 9 resource quantity sets can be determined respectively to obtain 9 average resource quantities. Assuming that the 9 average resource quantities are 80%, 90%, 70%, 60%, 89%, 76%, 80%, 82%, and 85% respectively, the average resource usage information 1 corresponding to the 7-day statistical period can be determined as (80%, 90%, 70%, 60%, 89%, 76%, 80%, 82%, and 85%) based on the 9 average resource quantities; the resource quantity differences corresponding to the 9 resource quantity sets can be determined respectively to obtain 9 resource quantity differences. Assuming that the 9 resource quantity differences are 15%, 8%, 7%, 5%, 9%, 6%, 12%, 11%, and 10% respectively, the resource usage fluctuation information 1 corresponding to the 7-day statistical period can be determined as (15%, 8%, 7%, 5%, 9%, 6%, 12%, 11%, and 10%) based on the 9 resource quantity differences.
[0129] Similarly, for a 30-day statistical period, if there are two resource quantity sets corresponding to the 30-day statistical period, the average resource quantities corresponding to the two resource quantity sets can be determined respectively to obtain two average resource quantities. Assuming that the two average resource quantities are 82% and 90% respectively, the average resource usage information 2 corresponding to the 30-day statistical period can be determined as (82%, 90%) based on the two average resource quantities; the resource quantity differences corresponding to the two resource quantity sets can be determined respectively to obtain two resource quantity differences. Assuming that the two resource quantity differences are 7% and 5% respectively, the resource usage fluctuation information 2 corresponding to the 30-day statistical period can be determined as (7%, 5%).
[0130] S203: Process at least one resource usage average information and at least one resource usage fluctuation information through a preset model to obtain a target resource usage of the target object for the target resource in the target time period.
[0131] Optionally, the preset model may be a Light Gradient Boosting Machine (LightGBM) model.
[0132] For example, if the average resource usage information 1 is (80%, 90%, 70%, 60%, 89%, 76%, 80%, 82%, 85%), the resource usage fluctuation information 1 is (15%, 8%, 7%, 5%, 9%, 6%, 12%, 11%, 10%), the average resource usage information 2 is (82%, 90%), and the resource usage fluctuation information 2 is (7%, 5%), if the preset model is the LightGBM model and the target period is 2023.10.1, the average resource usage information 1, resource usage fluctuation information 1, average resource usage information 2, and resource usage fluctuation information 2 can be processed by the LightGBM model to determine the CPU usage of virtual machine 1 on 2023.10.1.
[0133] In an embodiment of the present application, the electronic device can obtain historical resource information of the target object, can determine at least one statistical period, and determine the average resource usage information and resource usage fluctuation information corresponding to each statistical period based on the historical resource information, and obtain at least one resource usage average information and at least one resource usage fluctuation information, and then process the at least one resource usage average information and at least one resource usage fluctuation information through a preset model to obtain the target resource usage of the target object in the target period. Since the target resource usage can be comprehensively predicted based not only on the average resource usage corresponding to different statistical periods, but also on the resource usage fluctuation information corresponding to different statistical periods, the accuracy of determining the target resource usage is improved compared to directly determining the average resource usage within the historical duration as the target resource usage.
[0134] Figure 3 A flowchart of another resource usage prediction method provided by an exemplary embodiment of the present application. Figure 3 , the method may include:
[0135] S301: Obtain historical resource information of a target object.
[0136] It should be noted that the execution process of step S301 can refer to step S201, which will not be described again here.
[0137] S302: Determine at least one statistical period.
[0138] For example, the electronic device may determine two statistical periods, the first statistical period may be 30 days, and the second statistical period may be 7 days.
[0139] S303: For any statistical period, multiple historical resource quantities in the historical resource information are grouped according to the statistical period and the historical time periods corresponding to each historical resource quantity in the historical resource information to obtain at least one resource quantity set.
[0140] The historical time periods corresponding to the historical resource quantities in the resource quantity set may be within the same statistical period.
[0141] Optionally, the following method can be used to group and process multiple historical resource quantities in the historical resource information according to the statistical period and the historical time periods corresponding to each historical resource quantity in the historical resource information to obtain at least one resource quantity set: determine the earliest time and the latest time according to the multiple historical time periods corresponding to the multiple historical resource quantities; divide the time period between the earliest time and the latest time into at least one divided time period according to the period length of the statistical period; determine at least one historical resource quantity corresponding to each divided time period among the multiple historical resource quantities, and the historical time period corresponding to the historical resource quantity is within the divided time period; determine the at least one historical resource quantity corresponding to each divided time period as a corresponding resource quantity set to obtain at least one resource quantity set.
[0142] The earliest time may be the start time of the earliest historical period among multiple historical periods, and the latest time may be the end time of the latest historical period among multiple historical periods. For example, if there are 61 historical periods, namely 2023.8.1, 2023.8.2, ..., 2023.9.30, the earliest time may be the start time 0:00 of the historical period 2023.8.1; the latest time may be the end time 24:00 of the historical period 2023.9.30.
[0143] The duration of the time period can be less than or equal to the cycle duration. For example, if the cycle duration of a 7-day statistical cycle is 7 days, the duration of the time period can be less than or equal to 7 days.
[0144] For example, if there are two statistical cycles, namely, a 7-day statistical cycle and a 30-day statistical cycle, and if the historical resource information is shown in Table 1, then the earliest time can be determined as the starting time 0:00 of the historical period 2023.8.1 and the latest time can be determined as the ending time 24:00 of the historical period 2023.9.30 according to the 7-day statistical cycle and the historical time periods corresponding to the historical CPU usage in the historical resource information. Then, according to the period length of the statistical cycle of 7 days, the time period between the earliest time and the latest time can be divided into 9 divided time periods, and then multiple historical resource quantities corresponding to each divided time period can be determined in the 61 historical CPU usages to obtain 9 resource quantity sets, as shown in Table 2:
[0145] Table 2
[0146]
[0147]
[0148] As shown in Table 2, each divided period includes multiple historical periods. For example, divided period 1-1 may include multiple historical periods, namely 2023.8.1, 2023.8.2, ..., 2023.8.7.
[0149] For any divided time period, the historical resource amounts corresponding to the multiple historical time periods in the divided time period can be divided into a resource amount set. As shown in Table 2, the divided time period 1-1 includes 7 historical time periods, namely 2023.8.1, 2023.8.2, ..., 2023.8.7, then the historical CPU usage amounts corresponding to the 7 historical time periods can be divided into resource amount set 1-1, and the resource amount set 1-1 can include the historical CPU usage amounts corresponding to the 7 historical time periods; similarly, the resource amount set 1-2 corresponding to the divided time period 1-2, ..., and the resource amount set 1-9 corresponding to the divided time period 1-9 can be determined respectively.
[0150] For a 30-day statistical cycle, the earliest time can be determined as the start time 0:00 of the historical period 2023.8.1 and the latest time can be determined as the end time 24:00 of the historical period 2023.9.30 according to the 30-day statistical cycle and the historical time periods corresponding to each CPU usage in the historical resource information. Then, the time period between the earliest time and the latest time can be divided according to the period length of the statistical cycle of 30 days to obtain two divided time periods, and then multiple historical resource quantities corresponding to each divided time period can be determined from the 61 historical CPU usages to obtain two resource quantity sets, as shown in Table 3:
[0151] Table 3
[0152]
[0153] As shown in Table 3, the partition period 2-1 may include 31 historical periods, and the partition period 2-2 may include 30 historical periods. For the partition period 2-1, the 31 historical CPU usages corresponding to the 31 historical periods included in the partition period may be divided into a resource amount set 2-1; for the partition period 2-2, the 30 historical CPU usages corresponding to the 30 historical periods included in the partition period may be divided into a resource amount set 2-2.
[0154] S304: Determine average resource usage information according to multiple resource quantity sets.
[0155] In an optional embodiment, average resource usage information can be determined based on multiple resource quantity sets in the following manner: for any resource quantity set, the average value of each historical resource quantity in the resource quantity set is determined as the average resource quantity corresponding to the resource quantity set; a resource mean sequence is generated based on the average resource quantity corresponding to each resource quantity set; and the resource mean sequence is determined as the average resource usage information.
[0156] For example, for a statistical period of 7 days, Table 2 includes 9 resource quantity sets, namely resource quantity set 1-1, resource quantity set 1-2, ..., resource quantity set 1-9. For resource quantity set 1-1, resource quantity set 1-1 includes 7 historical CPU usages, then the average value of the 7 historical CPU usages can be determined, and the average value is determined as the average resource quantity 1-1 corresponding to resource quantity set 1-1, assuming that the average resource quantity 1-1 is 80%; similarly, the average resource quantity 1-2 corresponding to resource quantity set 1-2, ..., and the average resource quantity 1-9 corresponding to resource quantity set 1-9 can be determined to obtain 9 average resource quantities. Assume that the 9 average resource quantities are 80%, 90%, 70%, 60%, 89%, 76%, 80%, 82%, and 85%, respectively.
[0157] In an optional embodiment, a resource mean sequence may be generated according to the average resource amount corresponding to each resource amount set in the following manner: for any resource amount set, the historical period corresponding to the resource amount set is determined according to the historical period corresponding to each historical resource amount in the resource amount set; the arrangement order of multiple resource amount sets is determined according to the order from front to back of the historical period corresponding to each resource amount set; and the average resource amounts corresponding to the multiple resource amount sets are sequence-combined according to the arrangement order to obtain a resource mean sequence. The resource mean sequence may include the average resource amount corresponding to each resource amount set.
[0158] Optionally, the earliest historical period or the latest historical period in the historical periods corresponding to each historical resource amount in the resource amount set can be determined as the historical period corresponding to the resource amount set. For example, resource amount set 1-1 includes historical CPU usage corresponding to 2023.8.1, 2023.8.2, ..., 2023.8.7, and the latest historical period is 2023.8.7, then 2023.8.7 can be determined as the historical period corresponding to resource amount set 1-1. Similarly, the historical periods corresponding to resource amount sets 1-2, ..., and resource amount sets 1-9 can be determined, as shown in Table 4:
[0159] Table 4
[0160] Resource collection Historical period corresponding to the resource volume set Resource Collection 1-1 2023.8.7 Resource Set 1-2 2023.8.14 Resource Set 1-3 2023.8.21 Resource Set 1-4 2023.8.28 Resource Set 1-5 2023.9.04 Resource Set 1-6 2023.9.11 Resource Set 1-7 2023.9.18 Resource Set 1-8 2023.9.25 Resource Set 1-9 2023.9.30
[0161] If the historical periods corresponding to the nine resource quantity sets are as shown in Table 4, the arrangement order of the multiple resource quantity sets can be determined from the front to the back of the historical periods corresponding to the nine resource quantity sets: resource quantity set 1-1, resource quantity set 1-2, ..., resource quantity set 1-9. If the average resource quantities corresponding to the nine resource quantity sets are 80%, 90%, 70%, 60%, 89%, 76%, 80%, 82%, 85%, respectively, the average resource quantities corresponding to the multiple resource quantity sets are processed by sequence combination according to the arrangement order, and the resource mean sequence 1 is obtained as (80%, 90%, 70%, 60%, 89%, 76%, 80%, 82%, 85%), and the resource mean sequence 1 can be determined as the resource usage average information 1, and the resource usage average information 1 corresponding to the 7-day statistical period is (80%, 90%, 70%, 60%, 89%, 76%, 80%, 82%, 85%).
[0162] Similarly, for a 30-day statistical period, two resource quantity sets may be included in Table 3, namely resource quantity set 2-1 and resource quantity set 1-2. The average value of the 31 historical CPU usages in resource quantity set 2-1 may be determined as the average resource quantity 2-1 of resource quantity set 2-1, and the average value of the 30 historical CPU usages in resource quantity set 2-2 may be determined as the average resource quantity 2-2 of resource quantity set 2-2. Assuming that the average resource quantity 2-1 and the average resource quantity 2-2 are 82% and 90% respectively. It can be determined that the historical period corresponding to resource quantity set 2-1 is 2023.8.31, and the historical period corresponding to resource quantity set 2-2 is 2023.9.30, then the arrangement order of the two resource quantity sets may be determined as: resource quantity set 2-1, resource quantity set 2-2. According to this arrangement order, the average resource quantity 2-1 and the average resource quantity 2-2 can be sequenced and combined to obtain the resource mean sequence 2 corresponding to the 30-day statistical period (82%, 90%). The resource mean sequence 2 can be used as the average resource usage information 2 corresponding to the 30-day statistical period.
[0163] S305: Determine resource usage fluctuation information according to multiple resource quantity sets.
[0164] Optionally, resource usage fluctuation information can be determined based on multiple resource quantity sets in the following manner: for any resource quantity set, determine the resource quantity difference corresponding to the resource quantity set based on the maximum resource quantity and the minimum resource quantity in the resource quantity set; generate a resource difference sequence based on the resource quantity difference corresponding to each resource quantity set, the resource difference sequence including the resource quantity difference corresponding to each resource quantity set; determine that the resource usage fluctuation information includes the resource difference sequence.
[0165] For example, for a 7-day statistical period, Table 2 includes 9 resource quantity sets. For resource quantity set 1-1, if the maximum historical CPU usage in resource quantity set 1-1 is 90% and the minimum historical CPU usage is 75%, then the resource quantity difference corresponding to resource quantity set 1-1 can be determined to be 15%; similarly, the resource quantity difference corresponding to resource quantity set 1-2, ..., and the historical resource quantity difference 1-9 corresponding to resource quantity sets 1-9 can be determined to obtain 9 resource quantity differences. Assume that the 9 resource quantity differences are 15%, 8%, 7%, 5%, 9%, 6%, 12%, 11%, and 10%, respectively. The resource quantity differences corresponding to the 9 resource quantity sets can be sequenced and combined according to the arrangement order of the 9 resource quantity sets, and the resource difference sequence 1 can be obtained as (15%, 8%, 7%, 5%, 9%, 6%, 12%, 11%, 10%). It can be determined that the resource usage fluctuation information 1 corresponding to the 7-day statistical period includes the resource difference sequence 1.
[0166] Optionally, for any resource quantity set, the resource quantity variance corresponding to the resource quantity set is determined based on the historical resource quantities in the resource quantity set; a resource variance sequence is generated based on the resource quantity variance corresponding to each resource quantity set, and the resource variance sequence includes the resource quantity variance corresponding to each resource quantity set; and determining the resource usage fluctuation information also includes the resource variance sequence.
[0167] For example, for a statistical period of 7 days, for resource quantity set 1-1, the variance of the 7 historical CPU usages in resource quantity set 1-1 can be determined as the resource quantity variance 1-1 corresponding to resource quantity set 1-1, assuming that resource quantity variance 1-1 is 2%; similarly, the resource quantity variance 1-2 corresponding to resource quantity set 1-2, ..., and the resource quantity variance 1-9 corresponding to resource quantity set 1-9 can be determined to obtain 9 resource quantity variances. Assume that the 9 resource quantity variances are 80%, 70%, 73%, 65%, 72%, 91%, 82%, 80%, and 83%, respectively. Then, the resource variance sequence 1 can be generated based on the 9 resource quantity variances as (80%, 70%, 73%, 65%, 72%, 91%, 82%, 80%, 83%). The resource usage fluctuation information 1 corresponding to the statistical period of 7 days also includes the resource variance sequence 1.
[0168] Similarly, for the 30-day statistical period, assuming that it can be determined that the resource difference 2-1 corresponding to the resource set 2-1 in Table 3 is 7%, and the resource difference 2-2 corresponding to the resource set 2-2 is 5%, then the resource difference sequence 2 corresponding to the 30-day statistical period can be generated as (7%, 5%) based on the resource differences corresponding to the two resource sets respectively, and it can be determined that the resource usage fluctuation information 2 corresponding to the 30-day statistical period includes the resource difference sequence 2; it can be determined that the resource variance 2-1 corresponding to the resource set 2-1 is 80%, and the resource variance 2-2 corresponding to the resource set 2-2 is 75%, then the resource variance sequence 2 can be determined to be (80%, 75%), and it can be determined that the resource usage fluctuation information 2 corresponding to the 30-day statistical period also includes the resource variance sequence 2.
[0169] Optionally, for any resource quantity set, the historical resource quantity in the resource quantity set can also be determined, the standard deviation of the resource quantity corresponding to the resource quantity set can be determined, and a standard deviation sequence can be generated based on the standard deviation of the resource quantity corresponding to each resource quantity set, the standard deviation sequence including the standard deviation of the resource quantity corresponding to each resource quantity set; determining the resource usage fluctuation information also includes the standard deviation sequence.
[0170] S306: Process at least one resource usage average information and at least one resource usage fluctuation information through a preset model to obtain a target resource usage of the target object for the target resource in the target time period.
[0171] For example, if the 7-day statistical period corresponds to the resource usage average information 1 of (80%, 90%, 70%, 60%, 89%, 76%, 80%, 82%, 85%), the resource usage fluctuation information 1 includes the resource difference sequence 1 of (15%, 8%, 7%, 5%, 9%, 6%, 12%, 11%, 10%), and the resource variance sequence 1 of (80%, 70%, 73%, 65%, 72%, 91%, 82%, 80%, 83%); the 30-day statistical period corresponds to the resource usage average information 1 of (80%, 90%, 70%, 60%, 89%, 76%, 80%, 82%, 85%), the resource usage fluctuation information 1 includes the resource difference sequence 1 of (15%, 8%, 7%, 5%, 9%, 6%, 12%, 11%, 10%), and the resource variance sequence 1 of (80%, 70%, 73%, 65%, 72%, 91%, 82%, 80%, 83%). Information 2 is (82%, 90%), and the resource usage fluctuation information 2 includes the resource difference sequence 2 of (7%, 5%), and the resource variance sequence 2 of (80%, 75%). If the preset model is the LightGBM model and the target period is 2023.10.1, the resource usage average information 1, resource usage fluctuation information 1, resource usage average information 2, and resource usage fluctuation information 2 can be processed by the LightGBM model to determine the CPU usage of virtual machine 1 on 2023.10.1.
[0172] S307: Obtain at least one historical resource estimate predicted for the target object by a preset model, and an actual resource usage corresponding to each historical resource estimate.
[0173] For example, the electronic device can obtain five historical CPU estimates corresponding to 2023.10.1-2023.10.5 predicted by the preset model for virtual machine 1, and can obtain the actual CPU usage corresponding to 2023.10.1-2023.10.5 of virtual machine 1, as shown in Table 5:
[0174] Table 5
[0175]
[0176]
[0177] S308: Determine the confidence level of the preset model in predicting resource usage of the target object based on at least one historical resource estimate and the actual resource usage corresponding to each historical resource estimate.
[0178] In an optional embodiment, the confidence level of a preset model's prediction of resource usage for a target object may be determined in the following manner: a plurality of estimated deviations are obtained based on at least one historical resource estimate and the actual resource usage corresponding to each historical resource estimate; and the confidence level is determined based on the plurality of estimated deviations and resource usage fluctuation information.
[0179] Optionally, the estimated deviation may be an absolute value of a difference between a historical resource estimated amount and a corresponding actual resource usage amount, or a ratio of a historical resource estimated amount to a corresponding actual resource usage amount.
[0180] For example, if at least one historical resource estimate and the actual resource usage corresponding to each historical resource estimate are as shown in Table 5, and if the estimated deviation is the absolute value of the difference, it can be determined that the estimated deviation 1 is 0, the estimated deviation 2 is 5%, the estimated deviation 3 is 3%, the estimated deviation 4 is 0, and the estimated deviation 5 is 0.
[0181] Optionally, the confidence level can be determined based on multiple estimated deviations and resource usage fluctuation information in the following manner: statistically process the resource usage fluctuation information to obtain a reference fluctuation value; for any estimated deviation, determine a reference confidence level corresponding to the estimated deviation based on the estimated deviation and the reference fluctuation value; determine the confidence level based on the reference confidence level corresponding to each estimated deviation.
[0182] Optionally, the reference fluctuation value may be an average value of a resource difference sequence corresponding to at least one statistical period, or an average value of a resource variance sequence corresponding to at least one statistical period. For example, if the resource difference sequence 1 corresponding to a 7-day statistical period is (15%, 8%, 7%, 5%, 9%, 6%, 12%, 11%, 10%), and the resource difference sequence 2 corresponding to a 30-day statistical period is (7%, 5%), then the average value of the resource difference sequences corresponding to the two statistical periods may be determined to be 8.6%, and 8.6% may be determined as the reference fluctuation value.
[0183] For any estimated deviation, the ratio of the estimated deviation to the reference fluctuation value can be determined as the fluctuation ratio, and then the reference confidence level corresponding to the fluctuation ratio can be determined based on the fluctuation ratio and the preset mapping relationship, and the reference confidence level can be determined as the reference confidence level corresponding to the estimated deviation.
[0184] Optionally, the preset mapping relationship may be a preset mapping algorithm or a preset mapping table. The fluctuation ratio is calculated and processed by the preset mapping algorithm to obtain a reference confidence level corresponding to the fluctuation ratio; the preset mapping table may include multiple fluctuation ratios and a reference confidence level corresponding to each fluctuation ratio, and the reference confidence level corresponding to the fluctuation ratio may be determined in the preset mapping table.
[0185] For example, if the estimated deviation 2 is 5% and the reference fluctuation value is 8.6%, the fluctuation ratio can be determined to be 5% / 8.6%=0.06. Assuming that the preset mapping relationship is a preset mapping table, the reference confidence level corresponding to the fluctuation ratio of 0.06 can be determined in the preset mapping table, assuming that the reference confidence level is 80%. Similarly, the reference confidence levels corresponding to the other four estimated deviations can be determined. Assume that the reference confidence level 1 corresponding to the estimated deviation 1 is 90%, the reference confidence level 1 corresponding to the estimated deviation 2 is 81%, the reference confidence level 3 corresponding to the estimated deviation 3 is 83%, the reference confidence level 4 corresponding to the estimated deviation 4 is 90%, and the reference confidence level 5 corresponding to the estimated deviation 5 is 90%.
[0186] Optionally, the confidence of the preset model in predicting the resource usage of the target object can be determined according to the statistical value of the reference confidence corresponding to each estimated deviation. Optionally, the statistical value can be an average value, a maximum value, a minimum value, or a variance.
[0187] For example, if there are five reference confidence levels of 90%, 81%, 83%, 90% and 90% respectively, the average of the five reference confidence levels can be determined to be 86.8%, and 86.8% can be determined as the confidence level of the preset model in predicting resource usage for the target object.
[0188] Optionally, a confidence threshold corresponding to the confidence level may be determined. When the confidence level is greater than or equal to the confidence threshold, it indicates that the preset model predicts the target resource usage of the target object with greater accuracy; when the confidence level is less than the confidence threshold, it indicates that the preset model predicts the target resource usage of the target object with less accuracy.
[0189] In an embodiment of the present application, the electronic device can obtain historical resource information of the target object and determine at least one statistical period. For any statistical period, multiple historical resource quantities in the historical resource information can be grouped and processed according to the statistical period and the historical time period corresponding to each historical resource quantity in the historical resource information to obtain at least one resource quantity set, and then according to the at least one resource quantity set, the average resource usage information and the resource usage fluctuation information can be determined. The electronic device can process at least one resource usage average information and at least one resource usage fluctuation information through a preset model to obtain the target resource usage of the target object in the target time period. The electronic device can also obtain at least one historical resource estimated amount predicted by the preset model for the target object, and the actual resource usage corresponding to each historical resource estimated amount, and determine the confidence of the preset model in predicting the resource usage of the target object according to at least one historical resource estimated amount and the actual resource usage corresponding to each historical resource estimated amount. Since the target resource usage can be comprehensively predicted not only based on the average resource usage corresponding to different statistical periods, but also based on the resource usage fluctuation information corresponding to different statistical periods, the accuracy of determining the target resource usage is improved compared to directly determining the average resource usage within the historical period as the target resource usage; and the confidence calculation rule takes into account the volatility of resource usage in multiple historical time periods, and to a certain extent adapts to the data distribution of different time series, thereby improving the quality of the confidence of the target resource estimate.
[0190] Next, based on any of the above embodiments, Figure 4 , the above resource usage prediction method is further explained through specific examples.
[0191] Figure 4 A schematic diagram of a method for predicting resource usage provided in an embodiment of the present application. Figure 4 The electronic device can obtain the historical resource information of the target object within the historical period, and the historical resource information can include 61 historical time periods and the historical resource usage corresponding to each historical time period.
[0192] The electronic device can determine two statistical periods, and can group multiple historical resource quantities in the historical resource information according to the first statistical period and the historical time periods corresponding to each historical resource quantity in the historical resource information to obtain 9 resource quantity sets.
[0193] For any resource quantity set, the electronic device can determine the average resource quantity, resource quantity difference, and resource quantity variance corresponding to the resource quantity set based on multiple historical resource quantities included in the resource quantity set. The electronic device can obtain 9 average resource quantities, 9 resource quantity differences, and 9 resource quantity variances, and then determine the arrangement order of the 9 resource quantity sets according to the historical time periods corresponding to the 9 resource quantity sets, and then arrange the order, and perform sequence combination processing on the 9 average resource quantities to generate a resource mean sequence 1; similarly, the 9 resource quantity differences can be processed in sequence combination to generate a resource difference sequence 1; the 9 resource quantity variances can be processed in sequence combination to generate a resource variance sequence 1. The resource mean sequence 1 can be used as the resource usage average information 1 corresponding to the first statistical period, and the resource usage fluctuation information 1 can include the resource difference sequence 1 and the resource variance sequence 1.
[0194] For the second statistical period, multiple historical resource quantities in the historical resource information can be grouped according to the second statistical period and the historical time periods corresponding to each historical resource quantity in the historical resource information to obtain two resource quantity sets.
[0195] For any resource quantity set, the electronic device can determine the average resource quantity, resource quantity difference, and resource quantity variance corresponding to the resource quantity set based on multiple historical resource quantities included in the resource quantity set. The electronic device can obtain 2 average resource quantities, 2 resource quantity differences, and 2 resource quantity variances, and then determine the arrangement order of the 2 resource quantity sets according to the historical time periods corresponding to the 2 resource quantity sets, and then perform sequence combination processing on the 2 average resource quantities according to the arrangement order to generate a resource mean sequence 2; similarly, the 2 resource quantity differences can be sequence combined to generate a resource difference sequence 2; the 2 resource quantity variances can be sequence combined to generate a resource variance sequence 2. The resource mean sequence 2 can be used as the resource usage average information 2 corresponding to the second statistical period, and the resource usage fluctuation information 2 can include a resource difference sequence 2 and a resource variance sequence 2.
[0196] The electronic device can process the resource usage average information 1, the resource usage fluctuation information 1, the resource usage average information 2, and the resource usage fluctuation information 2 through a preset model to obtain the target resource usage of the target object for the target resource in the target time period.
[0197] Optionally, the electronic device may also obtain at least one historical resource estimate predicted by a preset model for the target object, and the actual resource usage corresponding to each historical resource estimate. The electronic device may perform statistical processing on the resource usage fluctuation information to obtain a reference fluctuation value; and determine a reference confidence level corresponding to each estimated deviation based on each estimated deviation and the reference fluctuation value, and then determine a confidence level based on the reference confidence level corresponding to each estimated deviation. The confidence level may be used to measure the accuracy of the preset model's prediction of the resource usage of the target object.
[0198] In an embodiment of the present application, the electronic device can obtain historical resource information of the target object and determine at least one statistical period. For any statistical period, multiple historical resource quantities in the historical resource information can be grouped and processed according to the statistical period and the historical time period corresponding to each historical resource quantity in the historical resource information to obtain at least one resource quantity set, and then the resource usage average information and resource usage fluctuation information can be determined according to the multiple resource quantity sets. The electronic device can process at least one resource usage average information and at least one resource usage fluctuation information through a preset model to obtain the target resource usage of the target object in the target period. The electronic device can also obtain at least one historical resource estimated amount predicted by the preset model for the target object, and the actual resource usage corresponding to each historical resource estimated amount, and determine the confidence of the preset model in predicting the resource usage of the target object according to at least one historical resource estimated amount and the actual resource usage corresponding to each historical resource estimated amount. Since the target resource usage can be comprehensively predicted not only based on the average resource usage corresponding to different statistical periods, but also based on the resource usage fluctuation information corresponding to different statistical periods, the accuracy of determining the target resource usage is improved compared to directly determining the average resource usage within the historical period as the target resource usage; and the confidence calculation rule takes into account the volatility of resource usage in multiple historical time periods, and to a certain extent adapts to the data distribution of different time series, thereby improving the quality of the confidence of the target resource estimate.
[0199] Figure 5 The present invention provides a schematic diagram of a resource usage prediction device. Figure 5 The resource usage prediction device 10 includes: a first acquisition module 11, a first determination module 12 and a processing module 13, wherein:
[0200] The first acquisition module 11 is used to acquire historical resource information of the target object, wherein the historical resource information includes multiple historical time periods and the historical resource amount of the target resource used by the target object in each historical time period;
[0201] The first determination module 12 is used to determine at least one statistical period, and determine the resource usage average information and resource usage fluctuation information corresponding to each statistical period according to the historical resource information, to obtain at least one resource usage average information and at least one resource usage fluctuation information;
[0202] The processing module 13 is used to process the at least one resource usage average information and the at least one resource usage fluctuation information through a preset model to obtain a target resource usage of the target resource by the target object in a target time period.
[0203] The resource usage prediction device provided in the embodiment of the present application can execute the technical solution shown in the above method embodiment, and its implementation principle and beneficial effects are similar, which will not be repeated here.
[0204] In a possible implementation manner, for any statistical period, the first determining module 12 is specifically configured to:
[0205] According to the statistical period and the historical time periods corresponding to the historical resource quantities in the historical resource information, multiple historical resource quantities in the historical resource information are grouped to obtain at least one resource quantity set, wherein the historical time periods corresponding to the historical resource quantities in the resource quantity set are within the same statistical period;
[0206] The resource usage average information and the resource usage fluctuation information are determined according to the multiple resource quantity sets.
[0207] In a possible implementation manner, the first determining module 12 is specifically configured to:
[0208] Determine an earliest time and a latest time according to multiple historical time periods corresponding to the multiple historical resource quantities, wherein the earliest time is the start time of the earliest historical time period among the multiple historical time periods, and the latest time is the end time of the latest historical time period among the multiple historical time periods;
[0209] According to the cycle duration of the statistical cycle, the period between the earliest time and the latest time is divided into at least one divided period, and the duration of the divided period is less than or equal to the cycle duration;
[0210] Determine, among the multiple historical resource quantities, at least one historical resource quantity corresponding to each divided time period, wherein the historical time period corresponding to the historical resource quantity is within the divided time period;
[0211] At least one historical resource amount corresponding to each divided time period is determined as a corresponding resource amount set to obtain the at least one resource amount set.
[0212] In a possible implementation manner, the first determining module 12 is specifically configured to:
[0213] For any resource quantity set, the average value of each historical resource quantity in the resource quantity set is determined as the average resource quantity corresponding to the resource quantity set;
[0214] Generate a resource mean sequence according to the average resource amount corresponding to each resource amount set, wherein the resource mean sequence includes the average resource amount corresponding to each resource amount set;
[0215] The resource mean value sequence is determined as the resource usage average information.
[0216] In a possible implementation manner, the first determining module 12 is specifically configured to:
[0217] For any resource quantity set, determining the historical period corresponding to the resource quantity set according to the historical period corresponding to each historical resource quantity in the resource quantity set;
[0218] Determining an arrangement order of the plurality of resource quantity sets according to an order from front to back of the historical time periods corresponding to each resource quantity set;
[0219] According to the arrangement order, the average resource quantities corresponding to the multiple resource quantity sets are subjected to sequence combination processing to obtain the resource mean sequence.
[0220] In a possible implementation manner, the first determining module 12 is specifically configured to:
[0221] For any resource quantity set, determine the resource quantity difference corresponding to the resource quantity set according to the maximum resource quantity and the minimum resource quantity in the resource quantity set;
[0222] Generate a resource difference value sequence according to the resource difference value corresponding to each resource amount set, wherein the resource difference value sequence includes the resource difference value corresponding to each resource amount set;
[0223] Determining that the resource usage fluctuation information includes the resource difference sequence.
[0224] In a possible implementation manner, the first determining module 12 is further configured to:
[0225] For any resource quantity set, determining the resource quantity variance corresponding to the resource quantity set according to the historical resource quantities in the resource quantity set;
[0226] Generate a resource variance sequence according to the resource variance corresponding to each resource quantity set, wherein the resource variance sequence includes the resource variance corresponding to each resource quantity set;
[0227] Determining the resource usage fluctuation information also includes the resource variance sequence.
[0228] The resource usage prediction device provided in the embodiment of the present application can execute the technical solution shown in the above method embodiment, and its implementation principle and beneficial effects are similar, which will not be repeated here.
[0229] Figure 6 This is a schematic diagram of the structure of another resource usage prediction device provided in an embodiment of the present application. Figure 6 ,exist Figure 5 Based on the embodiment shown, the resource usage prediction device 10 further includes a second acquisition module 14 and a second determination module 15, wherein:
[0230] The second acquisition module 14 is used to acquire at least one historical resource estimation amount predicted by the preset model for the target object, and the actual resource usage amount corresponding to each historical resource estimation amount;
[0231] The second determination module 15 is used to determine the confidence level of the preset model in predicting the resource usage of the target object according to the at least one historical resource estimate and the actual resource usage corresponding to each historical resource estimate.
[0232] In a possible implementation manner, the second determining module 14 is specifically configured to:
[0233] Obtaining a plurality of estimated deviations according to the at least one historical resource estimated amount and the actual resource usage corresponding to each historical resource estimated amount;
[0234] The confidence level is determined according to the multiple estimated deviation amounts and the resource usage fluctuation information.
[0235] In a possible implementation manner, the second determining module 15 is specifically configured to:
[0236] Performing statistical processing on the resource usage fluctuation information to obtain a reference fluctuation value;
[0237] For any estimated deviation, determine a reference confidence level corresponding to the estimated deviation according to the estimated deviation and the reference fluctuation value;
[0238] The statistical value of the reference confidence level corresponding to each estimated deviation is determined as the confidence level.
[0239] The resource usage prediction device provided in the embodiment of the present application can execute the technical solution shown in the above method embodiment, and its implementation principle and beneficial effects are similar, which will not be repeated here.
[0240] The exemplary embodiment of the present application provides a structural diagram of an electronic device, see Figure 7 The electronic device 20 may include a processor 21 and a memory 22. Exemplarily, the processor 21 and the memory 22 are interconnected via a bus 23.
[0241] The memory 22 stores computer-executable instructions;
[0242] The processor 21 executes the computer-executable instructions stored in the memory 22, so that the processor 21 executes the resource usage prediction method shown in the above method embodiment.
[0243] Accordingly, an embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the resource usage prediction method described in the above method embodiment.
[0244] Accordingly, an embodiment of the present application may also provide a computer program product, including a computer program, which, when executed by a processor, can implement the resource usage prediction method shown in the above method embodiment.
[0245] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0246] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0247] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0248] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0249] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0250] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0251] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0252] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0253] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.
Claims
1. A method for predicting resource usage, characterized in that: include: Acquire historical resource information of a target object, wherein the historical resource information includes a plurality of historical time periods and a historical resource amount of a target resource used by the target object in each historical time period; Determine at least one statistical period, and determine the resource usage average information and resource usage fluctuation information corresponding to each statistical period according to the historical resource information, to obtain at least one resource usage average information and at least one resource usage fluctuation information; The at least one resource usage average information and the at least one resource usage fluctuation information are processed through a preset model to obtain a target resource usage of the target resource by the target object in a target time period.
2. A method for predicting resource usage, characterized in that: include: Acquire historical resource information of a target object, the historical resource information including multiple historical time periods and the historical resource amount of the target resource used by the target object in each historical time period, the target object is a virtual machine, and the target resource includes at least one of the following: processor resources, memory resources, and bandwidth resources; Determine at least one statistical period, and determine the resource usage average information and resource usage fluctuation information corresponding to each statistical period according to the historical resource information, to obtain at least one resource usage average information and at least one resource usage fluctuation information; The at least one resource usage average information and the at least one resource usage fluctuation information are processed through a preset model to obtain a target resource usage of the target resource by the target object in a target time period.
3. The method according to claim 1 or 2, characterized in that: For any statistical period; according to the historical resource information, determining the average resource usage information and resource usage fluctuation information corresponding to the statistical period includes: According to the statistical period and the historical time periods corresponding to the historical resource quantities in the historical resource information, multiple historical resource quantities in the historical resource information are grouped to obtain at least one resource quantity set, wherein the historical time periods corresponding to the historical resource quantities in the resource quantity set are within the same statistical period; The resource usage average information and the resource usage fluctuation information are determined according to the multiple resource quantity sets.
4. The method according to claim 3, characterized in that According to the statistical period and the historical time period corresponding to each historical resource quantity in the historical resource information, multiple historical resource quantities in the historical resource information are grouped and processed to obtain at least one resource quantity set, including: Determine an earliest time and a latest time according to multiple historical time periods corresponding to the multiple historical resource quantities, wherein the earliest time is the start time of the earliest historical time period among the multiple historical time periods, and the latest time is the end time of the latest historical time period among the multiple historical time periods; According to the cycle duration of the statistical cycle, the period between the earliest time and the latest time is divided into at least one divided period, and the duration of the divided period is less than or equal to the cycle duration; Determine, among the multiple historical resource quantities, at least one historical resource quantity corresponding to each divided time period, wherein the historical time period corresponding to the historical resource quantity is within the divided time period; At least one historical resource amount corresponding to each divided time period is determined as a corresponding resource amount set to obtain the at least one resource amount set.
5. The method according to claim 4, characterized in that Determining the resource usage average information according to the multiple resource amount sets includes: For any resource quantity set, the average value of each historical resource quantity in the resource quantity set is determined as the average resource quantity corresponding to the resource quantity set; Generate a resource mean sequence according to the average resource amount corresponding to each resource amount set, wherein the resource mean sequence includes the average resource amount corresponding to each resource amount set; The resource mean value sequence is determined as the resource usage average information.
6. The method according to claim 5, characterized in that According to the average resource quantity corresponding to each resource quantity set, a resource mean sequence is generated, including: For any resource quantity set, determining the historical period corresponding to the resource quantity set according to the historical period corresponding to each historical resource quantity in the resource quantity set; Determining an arrangement order of the plurality of resource quantity sets according to an order from front to back of the historical time periods corresponding to each resource quantity set; According to the arrangement order, the average resource quantities corresponding to the multiple resource quantity sets are subjected to sequence combination processing to obtain the resource mean sequence.
7. The method according to any one of claims 3 to 6, characterized in that: Determining the resource usage fluctuation information according to the multiple resource quantity sets includes: For any resource quantity set, determine the resource quantity difference corresponding to the resource quantity set according to the maximum resource quantity and the minimum resource quantity in the resource quantity set; Generate a resource difference value sequence according to the resource difference value corresponding to each resource amount set, wherein the resource difference value sequence includes the resource difference value corresponding to each resource amount set; Determining that the resource usage fluctuation information includes the resource difference sequence.
8. The method according to claim 7, characterized in that The method further comprises: For any resource quantity set, determining the resource quantity variance corresponding to the resource quantity set according to the historical resource quantities in the resource quantity set; Generate a resource variance sequence according to the resource variance corresponding to each resource quantity set, wherein the resource variance sequence includes the resource variance corresponding to each resource quantity set; Determining the resource usage fluctuation information also includes the resource variance sequence.
9. The method according to any one of claims 1 to 8, characterized in that: The method further comprises: Obtaining at least one historical resource estimate predicted for the target object by the preset model, and an actual resource usage corresponding to each historical resource estimate; The confidence level of the resource usage prediction of the target object by the preset model is determined based on the at least one historical resource estimate and the actual resource usage corresponding to each historical resource estimate.
10. The method according to claim 9, characterized in that Determining, according to the at least one historical resource estimate and the actual resource usage corresponding to each historical resource estimate, the confidence level of the resource usage prediction of the target object by the preset model, including: Obtaining a plurality of estimated deviations according to the at least one historical resource estimated amount and the actual resource usage corresponding to each historical resource estimated amount; The confidence level is determined according to the multiple estimated deviation amounts and the resource usage fluctuation information.
11. The method according to claim 10, characterized in that Determining the confidence level according to the multiple estimated deviations and the resource usage fluctuation information includes: Performing statistical processing on the resource usage fluctuation information to obtain a reference fluctuation value; For any estimated deviation, determine a reference confidence level corresponding to the estimated deviation according to the estimated deviation and the reference fluctuation value; The statistical value of the reference confidence level corresponding to each estimated deviation is determined as the confidence level.
12. A resource usage prediction device, characterized in that: include: Acquisition module, determination module and processing module, wherein, The acquisition module is used to acquire historical resource information of the target object, wherein the historical resource information includes multiple historical time periods and the historical resource amount of the target resource used by the target object in each historical time period; The determination module is used to determine at least one statistical period, and determine the resource usage average information and resource usage fluctuation information corresponding to each statistical period according to the historical resource information, to obtain at least one resource usage average information and at least one resource usage fluctuation information; The processing module is used to process the at least one resource usage average information and the at least one resource usage fluctuation information through a preset model to obtain a target resource usage of the target resource by the target object in a target time period.
13. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively coupled to the at least one processor; The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the electronic device to perform the method described in any one of claims 1-11.
14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when the processor executes the computer-executable instructions, the method according to any one of claims 1 to 11 is implemented.
15. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 11 is implemented.