Capacity prediction method, device and storage medium based on artificial intelligence

By obtaining the initial TPS value on the CPU, establishing a utilization prediction model, conducting stress tests and calibrating the environment, the uninterpretation and iterative problems of capacity planning in the prior art are solved, and more accurate resource allocation and cost optimization are achieved.

CN113742069BActive Publication Date: 2025-08-19SHENZHEN PING AN SMART HEALTHCARE TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111011678.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-08-31
Publication Date
2025-08-19
Estimated Expiration
2041-08-31

AI Technical Summary

Technical Problem

The existing capacity planning methods are unexplainable, cannot be calibrated and iterated, resulting in unreasonable resource allocation and affect utilization and cost.

Method used

By obtaining the initial TPS value of the CPU at the preset time point, establishing a pre-trained utilization prediction model, performing stress testing, calibrating the stress testing environment, adjusting the CPU resource allocation, data volume and the proportion of new and old users based on the gap value, and iterating capacity prediction.

Benefits of technology

It improves the accuracy and applicability of capacity forecasts, can adapt to business changes, reduce the problem of unreasonable resource allocation, and reduce overall costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113742069B_ABST
    Figure CN113742069B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of artificial intelligence and discloses an artificial intelligence-based capacity prediction method, comprising: obtaining the initial TPS values of all running services of a CPU at a preset time point; increasing the initial TPS values of all running services by a preset amplitude to obtain a TPS data set corresponding to each running service; obtaining predicted utilization rates corresponding to each TPS value in the TPS data set based on a pre-trained utilization prediction model, and determining a target predicted utilization range based on the predicted utilization rates; performing a stress test on TPS values within the target predicted utilization range and determining the corresponding stress test utilization rates; determining a gap value between the predicted utilization rates and the stress test utilization rates, and calibrating the stress test environment of the CPU based on the gap value; and predicting the target CPU capacity based on the calibrated stress test environment. The present invention can improve the convenience and accuracy of CPU capacity prediction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a method, device, electronic device, and computer-readable storage medium for capacity prediction based on artificial intelligence. Background Art

[0002] Currently, in the internet industry, capacity planning is often required to determine the configuration and quantity of hardware resources for software services. Existing capacity planning solutions mainly include empirical analysis, model creation, and stress testing. Among them, empirical analysis mainly relies entirely on personal past experience to provide approximate configurations and quantities, and its results are unexplainable. Modeling is based on data on small capacity and hardware resource usage, and hardware resources are predicted based on the model. Although this solution is explainable, it can only be verified through past data. If the software service functions are updated or modified, it cannot be calibrated and iterated. Finally, stress testing mainly involves writing stress test scripts for all business functions, using a large number of concurrent threads for stress testing, and obtaining reasonable values for the corresponding test scenarios. Although this method is explainable and iterative, it cannot be calibrated, and the test scenarios may not be consistent with the actual situation. After the test scenario changes, it is easy to lead to unreasonable resource allocation, affecting resource utilization and overall cost. Summary of the Invention

[0003] The present invention provides an artificial intelligence-based capacity prediction method, device, electronic device, and computer-readable storage medium, the main purpose of which is to improve the accuracy and applicability of capacity prediction.

[0004] To achieve the above objectives, the present invention provides a capacity prediction method based on artificial intelligence, comprising:

[0005] Get the initial TPS values of all running services on the CPU at a preset time point;

[0006] Increasing the initial TPS values of all running services by a preset amount to obtain TPS data sets corresponding to the running services respectively;

[0007] Based on a pre-trained utilization prediction model, obtain predicted utilization rates corresponding to each TPS value in the TPS data set, and determine a range of target predicted utilization rates based on the predicted utilization rates;

[0008] Perform a stress test on the TPS value within the target predicted utilization range and determine the corresponding stress test utilization;

[0009] Determining a gap value between the predicted utilization and the stress test utilization, and calibrating the stress test environment of the CPU based on the gap value;

[0010] Predict target CPU capacity based on a calibrated stress test environment.

[0011] In addition, an optional technical solution is that the step of increasing the initial TPS values of all running services according to a preset range to obtain TPS data sets corresponding to the running services includes:

[0012] While ensuring that the ratio between the TPS values of all running services remains unchanged, increase the initial TPS values of all running services by a preset amount;

[0013] The TPS data set is determined based on the increased TPS values of all running services.

[0014] In addition, an optional technical solution is that the pre-training process of the utilization prediction model includes:

[0015] Obtain the TPS values and corresponding CPU utilization of all services in the CPU in a real environment to form training data;

[0016] The constructed neural network model is trained based on the training data until the weight parameters of each layer of the neural network model are determined to form the utilization prediction model.

[0017] In addition, an optional technical solution is that the step of determining the range of the target predicted utilization rate based on the predicted utilization rate includes:

[0018] Obtain the predicted utilization rate corresponding to each TPS value in the TPS data set according to the principle of increasing from small to large;

[0019] The predicted utilization rate is judged based on a preset threshold, and the range of the target predicted utilization rate is determined based on the judgment result.

[0020] In addition, an optional technical solution is that the step of performing a stress test on the TPS value within the range of the target predicted utilization rate and determining the corresponding stress test utilization rate includes:

[0021] Determining, based on the range of the target predicted utilization rate, a first ranked list between predicted utilization rates and TPS values within the range;

[0022] Based on each TPS value in the first sorted list, a stress test is performed on the corresponding running service, and a corresponding stress test utilization is determined.

[0023] In addition, an optional technical solution is that the step of determining the gap value between the predicted utilization and the stress test utilization, and calibrating the stress test environment of the CPU based on the gap value includes:

[0024] Determine a second sorted list between the stress test utilization and the TPS value based on the first sorted list and the stress test utilization;

[0025] Acquire a corresponding first utilization curve based on the first sorted list, and acquire a second utilization curve based on the second sorted list;

[0026] Determining whether the first utilization curve and the second utilization curve have a consistent change pattern, and when the change patterns are inconsistent, obtaining a correlation coefficient between the predicted utilization and the stress test utilization as the gap value;

[0027] The stress test environment of the CPU is calibrated based on the gap value.

[0028] In addition, an optional technical solution is to calibrate the stress test environment of the CPU based on the gap value, including:

[0029] Adjusting the CPU resource allocation of the stress test environment based on the gap value; or,

[0030] Adjust the amount of data in the test environment based on the gap value; or,

[0031] The ratio between the new user data and the old user data in the test environment is adjusted based on the gap value.

[0032] In order to solve the above problems, the present invention further provides a capacity prediction device based on artificial intelligence, the device comprising:

[0033] An initial TPS value acquisition unit is used to obtain the initial TPS values of all running services of the CPU at a preset time point;

[0034] A TPS data set acquisition unit, configured to increase the initial TPS values of all the running services by a preset amount to acquire TPS data sets corresponding to the running services respectively;

[0035] a target predicted utilization rate determination unit, configured to obtain predicted utilization rates corresponding to respective TPS values in the TPS data set based on a pre-trained utilization rate prediction model, and determine a range of target predicted utilization rates based on the predicted utilization rates;

[0036] a stress test utilization determination unit, configured to perform a stress test on a TPS value within the range of the target predicted utilization and determine a corresponding stress test utilization;

[0037] a test environment calibration unit, configured to determine a gap value between the predicted utilization and the stress test utilization, and calibrate the stress test environment of the CPU based on the gap value;

[0038] The CPU capacity prediction unit is used to predict the target CPU capacity based on the calibrated stress test environment.

[0039] In order to solve the above problem, the present invention further provides an electronic device, comprising:

[0040] a memory storing at least one instruction; and

[0041] The processor executes the instructions stored in the memory to implement the above-mentioned artificial intelligence-based capacity prediction method.

[0042] In order to solve the above problems, the present invention also provides a computer-readable storage medium, in which at least one instruction is stored. The at least one instruction is executed by a processor in an electronic device to implement the above-mentioned artificial intelligence-based capacity prediction method.

[0043] An embodiment of the present invention obtains the initial TPS values of all running services of the CPU at a preset time point, and then increases each initial TPS value according to a preset amplitude to obtain a corresponding TPS data set; and based on a pre-trained utilization prediction model, obtains a range of target predicted utilization corresponding to each TPS value in the TPS data set, then performs a stress test on the TPS values within the range of the target predicted utilization, and determines the corresponding stress test utilization; finally, based on the difference between the predicted utilization and the stress test utilization, calibrates the stress test environment of the CPU; when a new service is added or the business logic of the original service is modified, the stress test environment can be updated and stress tested again; the data indicators during the stress test are output to the model for re-learning, and the stress test iteration of the capacity prediction model can be completed to achieve good prediction results. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] Figure 1 A schematic diagram of a flow chart of a capacity prediction method based on artificial intelligence provided by one embodiment of the present invention;

[0045] Figure 2 A schematic diagram of modules of a capacity prediction device based on artificial intelligence provided by one embodiment of the present invention;

[0046] Figure 3 A schematic diagram of the internal structure of an electronic device for implementing an artificial intelligence-based capacity prediction method provided by one embodiment of the present invention;

[0047] The purpose, features and advantages of the present invention will be further described with reference to the accompanying drawings and in conjunction with the embodiments. DETAILED DESCRIPTION

[0048] It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.

[0049] To address the problems of existing capacity planning, such as unexplainable results, inability to calibrate and iterate, resulting in poor applicability and low prediction accuracy, the present invention provides an artificial intelligence-based capacity prediction method. By performing stress testing on specific scenarios, indicator data such as TPS and CPU utilization of each service under high load are obtained. The capacity prediction model is iterated based on this data. When new services are added or the business logic of the original service is modified, the method can better adapt to stress testing in the new environment, with high prediction accuracy and a wide range of applicability.

[0050] Embodiments of the present invention can acquire and process relevant data based on artificial intelligence technology. Artificial Intelligence (AI) refers to the theories, methods, technologies, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results.

[0051] Fundamental AI technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interaction systems, and mechatronics. AI software technologies primarily encompass computer vision, robotics, biometrics, speech processing, natural language processing, and machine learning / deep learning.

[0052] The present invention provides a capacity prediction method based on artificial intelligence. Figure 1 FIG2 is a flow chart of a capacity prediction method based on artificial intelligence according to an embodiment of the present invention. The method can be executed by a device, which can be implemented by software and / or hardware.

[0053] In this embodiment, the capacity prediction method based on artificial intelligence includes:

[0054] S100: Obtaining the initial TPS values of all running services of the CPU at a preset time point.

[0055] Among them, the TPS (Transactions Per Second, the number of transactions transmitted per second, that is, the number of transactions processed by the server per second) value can be obtained by monitoring the corresponding logs. The preset time point can be selected at any time point during the business peak period as the preset time point, and then the TPS values of all running services at that time point are obtained as the initial TPS value.

[0056] In addition, the initial TPS value can also be collected in the most recent period, for example, the average TPS value at any time point during the peak period in the last week, month or several months. That is, according to the number of peak periods, the TPS values at any time point during all peak periods in a time period are collected, and then the average value is calculated as the initial TPS.

[0057] S200: Increasing the initial TPS values of all running services according to a preset range to obtain TPS data sets corresponding to the running services respectively.

[0058] Among them, the initial TPS value of all running services is gradually increased according to the preset range, mainly to continuously improve the CPU utilization. When the utilization reaches the critical value, the corresponding TPS value is obtained, and then it is input into the corresponding model for prediction to obtain the corresponding predicted utilization information.

[0059] Specifically, the step of increasing the initial TPS values of all running services according to a preset range to obtain TPS data sets corresponding to the running services respectively includes:

[0060] S210: While ensuring that the ratio between the TPS values of all running services remains unchanged, increase the initial TPS values of all running services by a preset amount;

[0061] S220: Determine the TPS data set based on the increased TPS values of all running services.

[0062] Among them, the proportional relationship between the TPS values under each running service can also be called a "snapshot". When it is inconvenient to maintain the ratio, the TPS value of each running service can be continuously increased, and then a set of corresponding TPS data can be obtained under each running service. The TPS data of all running services can form the above-mentioned TPS data set.

[0063] S300: Based on the pre-trained utilization prediction model, obtain the predicted utilization corresponding to each TPS value in the TPS data set, and determine the range of the target predicted utilization based on the predicted utilization.

[0064] During the operation of each service, the TPS value and CPU utilization of each service are recorded in the log. Based on this log data, artificial intelligence technology can be used to build a prediction model that uses the TPS value of each service to predict the corresponding CPU utilization. Based on this model, when the TPS value of each service is input, the CPU utilization of the service can be automatically predicted.

[0065] As a specific example, the pre-training process of the utilization prediction model includes:

[0066] S310: Obtain TPS values and corresponding CPU utilization of all services in the CPU in a real environment to form training data;

[0067] S320: Training the constructed neural network model based on the training data until the weight parameters of each layer of the neural network model are determined to form the utilization prediction model.

[0068] Specifically, during the training process, the service's own TPS value, the dependent service's (user service's) TPS value, and the CPU utilization are used as output data and input into the input layer of the neural network model. Then, neurons are introduced through the hidden layer, and each input is multiplied by a certain weight w and summed. The summation result is then added to the external bias b to obtain the final total result, which is then input into an activation function for conversion to obtain the final predicted utilization.

[0069] In the above training process, based on the error between the predicted utilization and the actual utilization, the neural network model is continuously iteratively trained until the loss function converges to a preset range, thereby forming the utilization prediction model, which includes a neural network composed of multiple neurons, and specifically may include an input layer, two hidden layers and an output layer.

[0070] In addition, the process of obtaining the predicted utilization rates corresponding to the respective TPS values in the TPS data set and determining the range of the target predicted utilization rates based on the predicted utilization rates may further include:

[0071] S340: Obtaining predicted utilization rates corresponding to respective TPS values in the TPS data set in ascending order;

[0072] S350: judging the predicted utilization rate based on a preset threshold, and determining a range of the target predicted utilization rate based on the judgment result.

[0073] In the above process, the size of the predicted utilization rate can be judged based on a preset threshold, and when the predicted utilization rate corresponding to the TPS value under any running service reaches the preset threshold, the prediction processing of all TPS values after sorting the current TPS value is stopped. If the predicted utilization rate meets the preset threshold requirements, the range of the target predicted utilization rate can be formed.

[0074] It should be noted that the preset amplitude in the previous step can be set according to the specific application scenario. For example, the reasonable size of the preset amplitude can be determined by the binary method. First, a larger amplitude is selected to gradually increase the initial TPS value. If the predicted utilization rate corresponding to the TPS value exceeds the preset threshold, the current amplitude can be binary processed, and the preset amplitude can be reduced before the utilization rate is predicted. Then, accurate prediction results can be obtained while reducing the number of times.

[0075] As a specific example, each TPS value in the TPS data set is input into the preset utilization prediction model one by one in order from small to large, and the corresponding predicted utilization is obtained through the utilization prediction model. When the predicted utilization of any running service reaches or exceeds the preset threshold, it indicates that the running service will reach the maximum capacity that the overall service can carry under the current TPS value, and the subsequent TPS value prediction is meaningless. A target predicted utilization with reference value can be determined based on the current TPS value and the previous prediction results.

[0076] S400: Performing a stress test on a TPS value within the range of the target predicted utilization rate, and determining a corresponding stress test utilization rate.

[0077] Specifically, the steps of performing a stress test on a TPS value within the range of the target predicted utilization rate and determining the corresponding stress test utilization rate include:

[0078] S410: Determine, based on the range of the target predicted utilization, a first sorted list between predicted utilizations and TPS values within the range.

[0079] Among them, the first sorting list includes mutually corresponding running service numbers, initial TPS values, TPS values of the current input utilization prediction model, and predicted utilization. In the first sorting list, the running services are sorted in descending order according to the predicted utilization. As an example, the following Table 1 shows the specific structure of the first sorting list.

[0080] No. Service Name Initial TPS value TPS of the input model Predicted CPU utilization 1 Serves 1 88 222 94.6% 2 Serves 2 110 286 88.34% 3 Serves 3 55 129 86.33% 4 Serves 4 230 561 81.51% 5 Serves 5 21 48 80.23% 6 Serves 6 62 149 71.14% 7 Serves 7 89 223 67.45%

[0081] Table 1

[0082] It should be noted that the above preset threshold can be set to 90% or 95%, etc., and can be flexibly set according to application requirements and scenarios. In the example of the first sorted list above, the preset threshold is set to 90%. When the current predicted utilization rate of running service 1 is 94 / 6%, which exceeds the preset threshold, the prediction of the TPS value of other running services is stopped, and the first sorted list of high-risk services is formed in descending order of predicted utilization rate.

[0083] S420: Perform a stress test on the corresponding running service based on each TPS value in the first sorted list, and determine the corresponding stress test utilization.

[0084] Specifically, stress testing is to continuously apply pressure to the software, forcing it to run under extreme conditions, observing the extent to which it can run, and thus discovering performance defects. It is achieved by building a test environment similar to the actual environment, and using the test program to send the expected number of transaction requests to the system at the same time or over a certain period of time, testing the system's efficiency under different stress conditions, and the stress conditions that the system can withstand.

[0085] S500: Determine a gap value between the predicted utilization and the stress test utilization, and calibrate the stress test environment of the CPU based on the gap value.

[0086] Wherein, a second sorting list between the stress test utilization and the TPS value can be determined based on the stress test utilization, and the second sorting list includes the corresponding running service numbers, initial TPS values, TPS values in the first sorting list, and corresponding stress test utilization. As an example, the second sorting list can be shown in Table 2 below:

[0087] No. Service Name Peak TPS during peak hours TPS of stress test CPU utilization during stress testing 1 Serves 1 88 222 78.67% 2 Serves 2 110 286 81.45% 3 Serves 3 55 129 87.66% 4 Serves 4 230 561 82.67% 5 Serves 5 21 48 81.45% 6 Serves 6 62 149 72.34% 7 Serves 7 89 223 95.45%

[0088] Table 2

[0089] It can be seen that after the first sorting table and the second sorting table are determined, the stress testing scenario can be calibrated and adjusted by comparing the predicted utilization rate with the stress testing utilization rate.

[0090] As a specific example, the above step S500 may further include:

[0091] S510: Determine a second sorted list between the stress test utilization and the TPS value based on the first sorted list and the stress test utilization;

[0092] S520: Acquire a corresponding first utilization curve based on the first sorted list, and acquire a second utilization curve based on the second sorted list;

[0093] The first utilization curve and the second utilization curve are located in the same coordinate system. The horizontal axis of the coordinate system represents your TPS value, and the vertical axis represents the predicted utilization and stress test utilization respectively.

[0094] S530: Determine whether the first utilization curve and the second utilization curve have the same change pattern, and if the change patterns are inconsistent, obtain a correlation coefficient between the predicted utilization and the stress test utilization as the gap value;

[0095] The variation patterns of the first utilization curve and the second utilization curve can be visually inspected. If the variation patterns of the two are roughly consistent, this indicates that the test environment during the stress test is also roughly consistent, and the test accuracy is relatively high. Otherwise, if the variation patterns of the first utilization curve and the second utilization curve are significantly different, or if there is a significant difference, the Pearson correlation coefficient between the set of predicted utilizations and the set of stress-tested utilizations in the first sorted list and the second sorted list can be further obtained as the gap value. If the absolute value of the Pearson correlation coefficient is less than 0.5, it can be considered that the gap between the two is too large, and there may be problems with the corresponding stress test process. In this case, it is necessary to adjust the relevant parameters of the CPU test environment accordingly.

[0096] S540: Calibrate the stress test environment of the CPU based on the gap value.

[0097] The calibration of the stress test environment in this step can further include the following situations:

[0098] The first method is to modify the CPU resource allocation during the stress test. In this case, try to keep the stress test environment consistent with the actual production environment. For example, if there are 10 services in the database under the CPU, if only 3 services are configured in the stress test environment, the test environment will be inconsistent with the actual environment, and the corresponding stress test results will be inaccurate.

[0099] The second method is to modify the data volume of the test environment. In this case, the data volume of the test environment needs to be adjusted according to the business data volume and user data volume of the real environment, so that the two are as consistent as possible.

[0100] The third option is to modify the ratio of new and old users. In this case, if the ratio of new and old users is different in the actual production environment, due to the difference in their corresponding activity levels, during the stress test, the ratio of new and old users in the test environment needs to be adjusted according to the actual production environment to improve the accuracy of the stress test.

[0101] S600: Predicting target CPU capacity based on the calibrated stress test environment.

[0102] It should be noted that after the above-mentioned step S500 is executed, it also includes: based on the calibrated stress test environment, stress testing the TPS value within the range of the target predicted utilization again, and obtaining the corresponding stress test utilization, and then repeating steps S400 and S500 until the gap value between the predicted utilization and the stress test utilization meets the preset requirements, that is, the iterative calibration of the stress test environment is completed, and then step S600 can be executed to stress test the CPU capacity through the calibrated stress test environment. At this time, the utilization stress test will be more accurate, and we can say goodbye to the drawbacks of upgrading the system capacity when a capacity failure occurs in production. By calibrating and iterating the capacity prediction model, the credibility and authenticity of the capacity prediction are guaranteed.

[0103] As we can see, current services are constantly iterating and developing, and new features are constantly being released. This means that service capacity is always changing. Changes in business scenarios can also cause changes in service capacity. For example, a major promotion event may cause a sudden increase in traffic to several local services. If a model is built based on the traffic characteristics of business scenarios during non-promotion periods to predict capacity, the prediction results will be roughly inaccurate.

[0104] The present invention performs stress testing on specific scenarios to obtain metrics such as TPS and CPU utilization for each service under high load, and uses this data to iterate the capacity prediction model. When a new service is added or the business logic of the original service is modified, the stress test environment can be updated and the stress test can be repeated. The data metrics during the stress test are output to the model for relearning, thus completing the iteration of the capacity prediction model through stress testing. After the service is launched, the model can be calibrated several times based on real online data to achieve good prediction results.

[0105] like Figure 3 , which is a functional module diagram of the capacity prediction device based on artificial intelligence of the present invention.

[0106] The AI-based capacity prediction device 200 described in the present invention can be installed in an electronic device. Depending on the functionality implemented, the AI-based capacity prediction device may include: an initial TPS value acquisition unit 210, a TPS data set acquisition unit 220, a target predicted utilization determination unit 230, a stress test utilization determination unit 240, a test environment calibration unit 250, and a CPU capacity prediction unit 260. The modules described in the present invention, which may also be referred to as units, refer to a series of computer program segments that can be executed by an electronic device processor and can perform fixed functions, and are stored in the memory of the electronic device.

[0107] In this embodiment, the functions of each module / unit are as follows:

[0108] The initial TPS value obtaining unit 210 is configured to obtain the initial TPS values of all running services of the CPU at a preset time point.

[0109] Among them, the TPS (Transactions Per Second, the number of transactions transmitted per second, that is, the number of transactions processed by the server per second) value can be obtained by monitoring the corresponding logs. The preset time point can be selected at any time point during the business peak period as the preset time point, and then the TPS values of all running services at that time point are obtained as the initial TPS value.

[0110] In addition, the initial TPS value can also be collected in the most recent period, for example, the average TPS value at any time point during the peak period in the last week, month or several months. That is, according to the number of peak periods, the TPS values at any time point during all peak periods in a time period are collected, and then the average value is calculated as the initial TPS.

[0111] The TPS data set acquisition unit 220 is configured to increase the initial TPS values of all the running services according to a preset range to acquire TPS data sets corresponding to the running services respectively.

[0112] Among them, the initial TPS value of all running services is gradually increased according to the preset range, mainly to continuously improve the CPU utilization. When the utilization reaches the critical value, the corresponding TPS value is obtained, and then it is input into the corresponding model for prediction to obtain the corresponding predicted utilization information.

[0113] Specifically, increasing the initial TPS values of all running services according to a preset range to obtain TPS data sets corresponding to the running services respectively includes:

[0114] An amplitude increase module, configured to increase the initial TPS values of all running services by a preset amplitude while ensuring that the ratio between the TPS values of all running services remains unchanged;

[0115] The TPS data set determining module is configured to determine the TPS data set based on the increased TPS values of all running services.

[0116] Among them, the proportional relationship between the TPS values under each running service can also be called a "snapshot". When it is inconvenient to maintain the ratio, the TPS value of each running service can be continuously increased, and then a set of corresponding TPS data can be obtained under each running service. The TPS data of all running services can form the above-mentioned TPS data set.

[0117] The target predicted utilization determination unit 230 is configured to obtain predicted utilizations corresponding to respective TPS values in the TPS data set based on a pre-trained utilization prediction model, and determine a range of target predicted utilizations based on the predicted utilizations.

[0118] During the operation of each service, the TPS value and CPU utilization of each service are recorded in the log. Based on this log data, artificial intelligence technology can be used to build a prediction model that uses the TPS value of each service to predict the corresponding CPU utilization. Based on this model, when the TPS value of each service is input, the CPU utilization of the service can be automatically predicted.

[0119] As a specific example, the pre-training process of the utilization prediction model includes:

[0120] The training data formation module is used to obtain the TPS values and corresponding CPU utilization of all services in the CPU in a real environment to form training data;

[0121] The utilization prediction model forming module is used to train the constructed neural network model based on the training data until the weight parameters of each layer of the neural network model are determined to form the utilization prediction model.

[0122] Specifically, during the training process, the service's own TPS value, the dependent service's (user service's) TPS value, and the CPU utilization are used as output data and input into the input layer of the neural network model. Then, neurons are introduced through the hidden layer, and each input is multiplied by a certain weight w and summed. The summation result is then added to the external bias b to obtain the final total result, which is then input into an activation function for conversion to obtain the final predicted utilization.

[0123] In the above training process, based on the error between the predicted utilization and the actual utilization, the neural network model is continuously iteratively trained until the loss function converges to a preset range, thereby forming the utilization prediction model, which includes a neural network composed of multiple neurons, and specifically may include an input layer, two hidden layers and an output layer.

[0124] In addition, the above-mentioned obtaining the predicted utilization rate corresponding to each TPS value in the TPS data set and determining the range of the target predicted utilization rate based on the predicted utilization rate may further include:

[0125] A predicted utilization rate acquisition module is used to obtain the predicted utilization rate corresponding to each TPS value in the TPS data set according to the principle of ascending from small to large;

[0126] The target predicted utilization rate determination module is used to judge the predicted utilization rate based on a preset threshold value and determine the range of the target predicted utilization rate based on the judgment result.

[0127] In the above process, the size of the predicted utilization rate can be judged based on a preset threshold, and when the predicted utilization rate corresponding to the TPS value under any running service reaches the preset threshold, the prediction processing of all TPS values after sorting the current TPS value is stopped. If the predicted utilization rate meets the preset threshold requirements, the range of the target predicted utilization rate can be formed.

[0128] It should be noted that the preset amplitude in the previous step can be set according to the specific application scenario. For example, the reasonable size of the preset amplitude can be determined by the binary method. First, a larger amplitude is selected to gradually increase the initial TPS value. If the predicted utilization rate corresponding to the TPS value exceeds the preset threshold, the current amplitude can be binary processed, and the preset amplitude can be reduced before the utilization rate is predicted. Then, accurate prediction results can be obtained while reducing the number of times.

[0129] As a specific example, each TPS value in the TPS data set is input into the preset utilization prediction model one by one in order from small to large, and the corresponding predicted utilization is obtained through the utilization prediction model. When the predicted utilization of any running service reaches or exceeds the preset threshold, it indicates that the running service will reach the maximum capacity that the overall service can carry under the current TPS value, and the subsequent TPS value prediction is meaningless. A target predicted utilization with reference value can be determined based on the current TPS value and the previous prediction results.

[0130] The stress test utilization determination unit 240 is configured to perform a stress test on a TPS value within the range of the target predicted utilization and determine a corresponding stress test utilization.

[0131] Specifically, the stress test utilization determination unit 240 performs a stress test on the TPS value within the range of the target predicted utilization and determines the corresponding stress test utilization, which may include:

[0132] The first ranking list determining module is configured to determine, based on a range of the target predicted utilization rate, a first ranking list between predicted utilization rates and TPS values within the range.

[0133] Among them, the first sorting list includes the corresponding running service numbers, initial TPS values, TPS values of the current input utilization prediction model, and predicted utilization. In the first sorting list, the running services are sorted in descending order according to the predicted utilization. As an example, the following Table 3 shows the specific structure of the first sorting list.

[0134] No. Service Name Initial TPS value TPS of the input model Predicted CPU utilization 1 Serves 1 88 222 94.6% 2 Serves 2 110 286 88.34% 3 Serves 3 55 129 86.33% 4 Serves 4 230 561 81.51% 5 Serves 5 21 48 80.23% 6 Serves 6 62 149 71.14% 7 Serves 7 89 223 67.45%

[0135] Table 3

[0136] It should be noted that the above preset threshold can be set to 90% or 95%, etc., and can be flexibly set according to application requirements and scenarios. In the example of the first sorted list above, the preset threshold is set to 90%. When the current predicted utilization rate of running service 1 is 94 / 6%, which exceeds the preset threshold, the prediction of the TPS value of other running services is stopped, and the first sorted list of high-risk services is formed in descending order of predicted utilization rate.

[0137] The stress test utilization determination module is used to perform stress testing on the corresponding running service based on each TPS value in the first sorted list, and determine the corresponding stress test utilization.

[0138] Specifically, stress testing is to continuously apply pressure to the software, forcing it to run under extreme conditions, observing the extent to which it can run, and thus discovering performance defects. It is achieved by building a test environment similar to the actual environment, and using the test program to send the expected number of transaction requests to the system at the same time or over a certain period of time, testing the system's efficiency under different stress conditions, and the stress conditions that the system can withstand.

[0139] The test environment calibration unit 250 is configured to determine a gap value between the predicted utilization and the stress test utilization, and calibrate the stress test environment of the CPU based on the gap value.

[0140] Wherein, a second sorting list between the stress test utilization and the TPS value can be determined based on the stress test utilization, and the second sorting list includes the corresponding running service numbers, initial TPS values, TPS values in the first sorting list, and corresponding stress test utilization. As an example, the second sorting list can be shown in Table 4 below:

[0141] No. Service Name Peak TPS during peak hours TPS of stress test CPU utilization during stress testing 1 Serves 1 88 222 78.67% 2 Serves 2 110 286 81.45% 3 Serves 3 55 129 87.66% 4 Serves 4 230 561 82.67% 5 Serves 5 21 48 81.45% 6 Serves 6 62 149 72.34% 7 Serves 7 89 223 95.45%

[0142] Table 4

[0143] It can be seen that after the first sorting table and the second sorting table are determined, the stress testing scenario can be calibrated and adjusted by comparing the predicted utilization rate with the stress testing utilization rate.

[0144] As a specific example, the test environment calibration unit 250 may further include:

[0145] A second sorting list determining module is configured to determine a second sorting list between the stress test utilization and the TPS value based on the first sorting list and the stress test utilization;

[0146] a second utilization curve acquisition module, configured to acquire a corresponding first utilization curve based on the first sorted list, and acquire a second utilization curve based on the second sorted list;

[0147] The first utilization curve and the second utilization curve are located in the same coordinate system. The horizontal axis of the coordinate system represents your TPS value, and the vertical axis represents the predicted utilization and stress test utilization respectively.

[0148] a gap value acquisition module, configured to determine whether the first utilization curve and the second utilization curve have a consistent change pattern, and if the change patterns are inconsistent, obtain a correlation coefficient between the predicted utilization and the stress test utilization as the gap value;

[0149] The variation patterns of the first utilization curve and the second utilization curve can be visually inspected. If the variation patterns of the two are roughly consistent, this indicates that the test environment during the stress test is also roughly consistent, and the test accuracy is relatively high. Otherwise, if the variation patterns of the first utilization curve and the second utilization curve are significantly different, or if there is a significant difference, the Pearson correlation coefficient between the set of predicted utilizations and the set of stress-tested utilizations in the first sorted list and the second sorted list can be further obtained as the gap value. If the absolute value of the Pearson correlation coefficient is less than 0.5, it can be considered that the gap between the two is too large, and there may be problems with the corresponding stress test process. In this case, it is necessary to adjust the relevant parameters of the CPU test environment accordingly.

[0150] A stress test environment calibration module is used to calibrate the stress test environment of the CPU based on the gap value.

[0151] The calibration of the pressure test environment in the pressure test environment calibration module may further include the following situations:

[0152] The first method is to modify the CPU resource allocation during the stress test. In this case, try to keep the stress test environment consistent with the actual production environment. For example, if there are 10 services in the database under the CPU, if only 3 services are configured in the stress test environment, the test environment will be inconsistent with the actual environment, and the corresponding stress test results will be inaccurate.

[0153] The second method is to modify the data volume of the test environment. In this case, the data volume of the test environment needs to be adjusted according to the business data volume and user data volume of the real environment, so that the two are as consistent as possible.

[0154] The third option is to modify the ratio of new and old users. In this case, if the ratio of new and old users is different in the actual production environment, due to the difference in their corresponding activity levels, during the stress test, the ratio of new and old users in the test environment needs to be adjusted according to the actual production environment to improve the accuracy of the stress test.

[0155] The CPU capacity prediction unit 260 is configured to predict the target CPU capacity based on the calibrated stress test environment.

[0156] It should be noted that after the above-mentioned test environment calibration unit 250 is executed, it also includes: based on the calibrated stress test environment, stress testing the TPS value within the range of the target predicted utilization rate again, and obtaining the corresponding stress test utilization rate, and then repeatedly executing the stress test utilization rate determination unit 240 and the test environment calibration unit 250 until the difference between the predicted utilization rate and the stress test utilization rate meets the preset requirements, that is, the iterative calibration of the stress test environment is completed, and then the test environment calibration unit 250 can be executed to stress test the CPU capacity through the calibrated stress test environment. At this time, the utilization stress test will be more accurate, and we can say goodbye to the drawbacks of upgrading the system capacity when a capacity failure occurs in production. By calibrating and iterating the capacity prediction model, the credibility and authenticity of the capacity prediction are guaranteed.

[0157] like Figure 3 , which is a schematic structural diagram of an electronic device for implementing the capacity prediction method based on artificial intelligence according to the present invention.

[0158] The electronic device 1 may include a processor 10 , a memory 11 , and a bus, and may further include a computer program stored in the memory 11 and executable on the processor 10 , such as an artificial intelligence-based capacity prediction program 12 .

[0159] The memory 11 includes at least one type of readable storage medium, and the readable storage medium includes a flash memory, a mobile hard disk, a multimedia card, a card-type memory (for example, an SD or DX memory, etc.), a magnetic memory, a magnetic disk, an optical disk, etc. In some embodiments, the memory 11 may be an internal storage unit of the electronic device 1, such as a mobile hard disk of the electronic device 1. In other embodiments, the memory 11 may also be an external storage device of the electronic device 1, such as a plug-in mobile hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device 1. Furthermore, the memory 11 may also include both an internal storage unit of the electronic device 1 and an external storage device. The memory 11 can not only be used to store application software and various types of data installed on the electronic device 1, such as the code of a capacity prediction program based on artificial intelligence, but can also be used to temporarily store data that has been output or is to be output.

[0160] In some embodiments, the processor 10 may be composed of an integrated circuit, such as a single packaged integrated circuit, or a plurality of packaged integrated circuits with the same or different functions, including one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and a combination of various control chips. The processor 10 is the control core (Control Unit) of the electronic device, connecting the various components of the entire electronic device using various interfaces and lines. It executes or executes programs or modules stored in the memory 11 (such as an artificial intelligence-based capacity prediction program) and calls data stored in the memory 11 to perform various functions of the electronic device 1 and process data.

[0161] The bus may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. The bus is configured to enable connection and communication between the memory 11 and at least one processor 10, etc.

[0162] Figure 3 Only the electronic device with components is shown, and it can be understood by those skilled in the art that Figure 2The structure shown does not constitute a limitation on the electronic device 1 , and may include fewer or more components than shown in the figure, or combine certain components, or arrange the components differently.

[0163] For example, although not shown, the electronic device 1 may further include a power source (such as a battery) for powering the various components. Preferably, the power source may be logically connected to the at least one processor 10 via a power management device, thereby implementing functions such as charging management, discharging management, and power consumption management through the power management device. The power source may further include any components such as one or more DC or AC power sources, a recharging device, a power failure detection circuit, a power converter or inverter, a power status indicator, etc. The electronic device 1 may further include various sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be described in detail here.

[0164] Furthermore, the electronic device 1 may also include a network interface. Optionally, the network interface may include a wired interface and / or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is generally used to establish a communication connection between the electronic device 1 and other electronic devices.

[0165] Optionally, the electronic device 1 may further include a user interface, which may be a display or an input unit (such as a keyboard). Optionally, the user interface may also be a standard wired interface or a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, or an OLED (Organic Light-Emitting Diode) touch device. The display may also be appropriately referred to as a display screen or a display unit, which is used to display information processed in the electronic device 1 and to display a visual user interface.

[0166] It should be understood that the embodiment is for illustration only and the scope of the patent application is not limited to this structure.

[0167] The artificial intelligence-based capacity prediction program 12 stored in the memory 11 of the electronic device 1 is a combination of multiple instructions. When running in the processor 10, it can achieve the following:

[0168] Get the initial TPS values of all running services on the CPU at a preset time point;

[0169] Increasing the initial TPS values of all running services by a preset amount to obtain TPS data sets corresponding to the running services respectively;

[0170] Based on a pre-trained utilization prediction model, obtain predicted utilization rates corresponding to each TPS value in the TPS data set, and determine a range of target predicted utilization rates based on the predicted utilization rates;

[0171] Perform a stress test on the TPS value within the target predicted utilization range and determine the corresponding stress test utilization;

[0172] Determining a gap value between the predicted utilization and the stress test utilization, and calibrating the stress test environment of the CPU based on the gap value;

[0173] Predict target CPU capacity based on a calibrated stress test environment.

[0174] In addition, an optional technical solution is that the step of increasing the initial TPS values of all running services according to a preset range to obtain TPS data sets corresponding to the running services includes:

[0175] While ensuring that the ratio between the TPS values of all running services remains unchanged, increase the initial TPS values of all running services by a preset amount;

[0176] The TPS data set is determined based on the increased TPS values of all running services.

[0177] In addition, an optional technical solution is that the pre-training process of the utilization prediction model includes:

[0178] Obtain the TPS values and corresponding CPU utilization of all services in the CPU in a real environment to form training data;

[0179] The constructed neural network model is trained based on the training data until the weight parameters of each layer of the neural network model are determined to form the utilization prediction model.

[0180] In addition, an optional technical solution is that the step of determining the range of the target predicted utilization rate based on the predicted utilization rate includes:

[0181] Obtain the predicted utilization rate corresponding to each TPS value in the TPS data set according to the principle of increasing from small to large;

[0182] The predicted utilization rate is judged based on a preset threshold, and the range of the target predicted utilization rate is determined based on the judgment result.

[0183] In addition, an optional technical solution is that the step of performing a stress test on the TPS value within the range of the target predicted utilization rate and determining the corresponding stress test utilization rate includes:

[0184] Determining, based on the range of the target predicted utilization rate, a first ranked list between predicted utilization rates and TPS values within the range;

[0185] Based on each TPS value in the first sorted list, a stress test is performed on the corresponding running service, and a corresponding stress test utilization is determined.

[0186] In addition, an optional technical solution is that the step of determining the gap value between the predicted utilization and the stress test utilization, and calibrating the stress test environment of the CPU based on the gap value includes:

[0187] Determine a second sorted list between the stress test utilization and the TPS value based on the first sorted list and the stress test utilization;

[0188] Acquire a corresponding first utilization curve based on the first sorted list, and acquire a second utilization curve based on the second sorted list;

[0189] Determining whether the first utilization curve and the second utilization curve have a consistent change pattern, and when the change patterns are inconsistent, obtaining a correlation coefficient between the predicted utilization and the stress test utilization as the gap value;

[0190] The stress test environment of the CPU is calibrated based on the gap value.

[0191] In addition, an optional technical solution is to calibrate the stress test environment of the CPU based on the gap value, including:

[0192] Adjusting the CPU resource allocation of the stress test environment based on the gap value; or,

[0193] Adjust the amount of data in the test environment based on the gap value; or,

[0194] The ratio between the new user data and the old user data in the test environment is adjusted based on the gap value.

[0195] Specifically, the specific implementation method of the processor 10 for the above instructions can refer to Figure 1 The description of the relevant steps in the corresponding embodiments will not be repeated here.

[0196] Furthermore, if the modules / units integrated in the electronic device 1 are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. The computer-readable medium may include any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a mobile hard drive, a magnetic disk, an optical disk, a computer memory, or a read-only memory (ROM).

[0197] In the several embodiments provided by the present invention, it should be understood that the disclosed devices, apparatuses, and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the module division is merely a logical function division, and other division methods may be used in actual implementation.

[0198] The modules described as separate components may or may not be physically separate, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed across multiple network elements. Some or all of the modules may be selected to achieve the purpose of the solution of this embodiment according to actual needs.

[0199] In addition, the functional modules in various embodiments of the present invention may be integrated into a single processing unit, each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or hardware plus software functional modules.

[0200] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention.

[0201] Therefore, the embodiments should be considered in all respects as illustrative and non-restrictive, and the scope of the invention is defined by the appended claims rather than the foregoing description, and all changes that come within the meaning and range of equivalents of the claims are intended to be embraced therein. Any reference to a figure in a claim should not be construed as limiting the claim to which it relates.

[0202] Furthermore, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices recited in a system claim may also be implemented by a single unit or device through software or hardware. Second-order terms are used to indicate names and do not imply any particular order.

[0203] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not limiting. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention.

Claims

1. A capacity prediction method based on artificial intelligence, characterized in that: The method comprises: Get the initial TPS values of all running services on the CPU at a preset time point; increasing the initial TPS values of all running services by a preset amount to obtain TPS data sets corresponding to the running services, the TPS data sets including TPS data of all running services increased by the preset amount; Based on a pre-trained utilization prediction model, obtain predicted utilization rates corresponding to each TPS value in the TPS data set, and determine a range of target predicted utilization rates based on the predicted utilization rates; Performing a stress test on a TPS value within the range of the target predicted utilization rate, and determining a stress test utilization rate corresponding to the TPS value within the range of the target predicted utilization rate; Determining a gap value between the predicted utilization and the stress test utilization, and calibrating the stress test environment of the CPU based on the gap value; Predict target CPU capacity based on a calibrated stress test environment.

2. The capacity prediction method based on artificial intelligence according to claim 1, characterized in that: The step of increasing the initial TPS values of all running services according to a preset range to obtain TPS data sets corresponding to the running services respectively includes: While ensuring that the ratio between the TPS values of all running services remains unchanged, increase the initial TPS values of all running services by a preset amount; The TPS data set is determined based on the increased TPS values of all running services.

3. The capacity prediction method based on artificial intelligence according to claim 1, characterized in that: The pre-training process of the utilization prediction model includes: Obtain the TPS values and corresponding CPU utilization of all services in the CPU in a real environment to form training data; The constructed neural network model is trained based on the training data until the weight parameters of each layer of the neural network model are determined to form the utilization prediction model.

4. The capacity prediction method based on artificial intelligence according to any one of claims 1 to 3, characterized in that: The step of determining the range of the target predicted utilization rate based on the predicted utilization rate includes: Obtain the predicted utilization rate corresponding to each TPS value in the TPS data set according to the principle of increasing from small to large; The predicted utilization rate is judged based on a preset threshold, and the range of the target predicted utilization rate is determined based on the judgment result.

5. The capacity prediction method based on artificial intelligence according to claim 1, characterized in that: The step of performing a stress test on the TPS value within the range of the target predicted utilization rate and determining the stress test utilization rate corresponding to the TPS value within the range of the target predicted utilization rate includes: Determining, based on the range of the target predicted utilization rate, a first ranked list between predicted utilization rates and TPS values within the range; Based on each TPS value in the first sorted list, a stress test is performed on the corresponding running service, and a stress test utilization corresponding to the running service is determined.

6. The capacity prediction method based on artificial intelligence according to claim 5, characterized in that: The step of determining a gap value between the predicted utilization and the stress test utilization, and calibrating the stress test environment of the CPU based on the gap value includes: Determine a second sorted list between the stress test utilization and the TPS value based on the first sorted list and the stress test utilization; Acquire a corresponding first utilization curve based on the first sorted list, and acquire a second utilization curve based on the second sorted list; Determining whether the first utilization curve and the second utilization curve have a consistent change pattern, and when the change patterns are inconsistent, obtaining a correlation coefficient between the predicted utilization and the stress test utilization as the gap value; The stress test environment of the CPU is calibrated based on the gap value.

7. The capacity prediction method based on artificial intelligence according to claim 1 or 6, characterized in that: Calibrating the stress test environment of the CPU based on the gap value includes: Adjusting the CPU resource allocation of the stress test environment based on the gap value; or, Adjust the amount of data in the test environment based on the gap value; or, The ratio between the new user data and the old user data in the test environment is adjusted based on the gap value.

8. A capacity prediction device based on artificial intelligence, characterized in that: The device comprises: An initial TPS value acquisition unit is used to obtain the initial TPS values of all running services of the CPU at a preset time point; a TPS data set acquisition unit, configured to increase the initial TPS values of all running services by a preset amount to acquire TPS data sets corresponding to the running services, the TPS data sets including the TPS data of all running services increased by the preset amount; a target predicted utilization rate determination unit, configured to obtain predicted utilization rates corresponding to respective TPS values in the TPS data set based on a pre-trained utilization rate prediction model, and determine a range of target predicted utilization rates based on the predicted utilization rates; a stress test utilization determination unit, configured to perform a stress test on a TPS value within the range of the target predicted utilization, and determine a stress test utilization corresponding to the TPS value within the range of the target predicted utilization; a test environment calibration unit, configured to determine a gap between the predicted utilization and the stress test utilization, and calibrate the stress test environment of the CPU based on the gap; The CPU capacity prediction unit is used to predict the target CPU capacity based on the calibrated stress test environment.

9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, 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 at least one processor to perform the steps in the artificial intelligence-based capacity prediction method as described in any one of claims 1 to 7.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the capacity prediction method based on artificial intelligence as claimed in any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Pressure testing method and system

    CN106708818A

  • Capacity resource prediction method and device

    CN110445939A