System capacity planning method and device
Through the prediction model based on historical data, the risk of insufficient system capacity is identified in advance, and intelligent current limiting or expansion is realized, which solves the problem of response time lag in the existing technology and improves the efficiency and safety of system capacity planning.
Patent Information
- Application Number
- CN202010544919.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-06-15
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2040-06-15
AI Technical Summary
Existing system capacity planning methods rely on monitoring and alarming, with delayed response times and inability to limit current or expand capacity before system problems occur, resulting in high costs and increased risks.
Through the method call amount and thread pool usage model based on the system's historical data, predictions are made, and the time series model and xgboost model are used to identify the risk of insufficient capacity in advance and realize intelligent current limiting or expansion of the system.
It achieves prediction and response before system problems occur, with fast response speed, low cost, high security, and reduces the number of manual intervention and monitoring alarms.
Smart Images

Figure CN113742158B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method and device for system capacity planning. Background Art
[0002] Capacity refers to the maximum ability that a system can handle and accommodate, which can be simply understood as the number of visits, or traffic. At present, in the early stages of system construction or before large traffic, the system will be stress-tested to understand the system's maximum processing capacity for requests when it is at maximum load or when a certain indicator reaches the maximum acceptable threshold. However, in the case of limited servers, traffic monitoring relies on reporting alarms such as response time, number of calls, abnormal monitoring, and caller monitoring, and then checking the system for risks of insufficient capacity. This monitoring method relies too much on monitoring alarms, and manual processing is required after the alarm, with a relatively slow response time, and it is impossible to limit or expand the system before problems occur. Summary of the invention
[0003] In view of this, an embodiment of the present invention provides a method and device for system capacity planning, which can intelligently plan the future capacity of the system based on the system's historical data, so as to limit or expand the system before problems occur, with fast response speed, low cost and high security.
[0004] To achieve the above object, according to one aspect of an embodiment of the present invention, a method for system capacity planning is provided, including:
[0005] Get the method call volume of the system in the first historical period;
[0006] Determine a predicted value of the method call volume of the system in a target period after the first historical period according to a pre-trained method call volume model and the method call volume;
[0007] Determine the predicted thread pool usage value of the system in the target time period according to the pre-trained thread pool usage model and the method call volume predicted value;
[0008] Among them, the method call volume model is trained using the method call volume observation values of the system in the second historical period; the thread pool usage model is trained using the method call volume observation values and thread pool usage observation values of the system in the second historical period.
[0009] Optionally, before determining the predicted value of the method call volume of the system in the target time period, the method further includes:
[0010] The method call volume model is obtained by training the method call volume model using a time series model according to the method call volume observation value of the system in the second historical period.
[0011] Optionally, the method call volume model includes: an online method call volume model and an MQ triggered method call volume model; the method call volume observation value includes: an online method call volume observation value and an MQ triggered method call volume observation value;
[0012] Using a time series model to train the method call volume model includes:
[0013] According to the online method call volume observation value of the system in the second historical period, the online method call volume model is obtained by training using a time series model;
[0014] The MQ trigger method call volume model is obtained by training using a time series model according to the observed value of the MQ trigger method call volume of the system in the second historical period.
[0015] Optionally, the method call volume observation value further includes: an MQ message sending volume observation value;
[0016] The MQ trigger method call volume model is obtained by training using a time series model, including:
[0017] Determine a predicted value of the MQ message sending volume of the system in the second historical period according to a pre-trained MQ message sending volume model and an observed value of the MQ message sending volume of the system in the second historical period; the MQ message sending volume model is obtained by training using a time series model based on the observed value of the MQ message sending volume of the system in the second historical period;
[0018] A thread regression model is established according to the predicted value of the MQ message sending volume and the observed value of the MQ trigger method calling volume of the system in the second historical period to obtain the MQ trigger method calling volume model.
[0019] Optionally, the method of the embodiment of the present invention further includes at least one of the following:
[0020] Before training the time series model, the training data sequence is stabilized;
[0021] After training using the time series model, the trained model is tested and confirmed to have passed the test.
[0022] Optionally, before determining the predicted value of thread pool usage of the system in the target time period, the method further includes:
[0023] The thread pool usage model is trained using an xgboost model according to the method call volume observation value and the thread pool usage observation value of the system in the second historical period.
[0024] Optionally, before determining the predicted value of thread pool usage of the system in the target time period, the method further includes:
[0025] Determine the predicted value of the method call volume of the system in the second historical period based on the method call volume model and the observed value of the method call volume of the system in the second historical period; determine the predicted value of the thread pool usage of the system in the second historical period based on the thread pool usage model and the predicted value of the method call volume of the system in the second historical period; test the method call volume model and the thread pool usage model based on the predicted value and observed value of the thread pool usage of the system in the second historical period and confirm that the test passes.
[0026] According to a second aspect of an embodiment of the present invention, there is provided an apparatus for system capacity planning, including:
[0027] A historical data acquisition module, which acquires the method call volume of the system in the first historical period;
[0028] A method call volume prediction module, which determines a method call volume prediction value of the system in a target period after the first historical period according to a pre-trained method call volume model and the method call volume;
[0029] A thread pool usage prediction module determines a thread pool usage prediction value of the system in a target time period according to a pre-trained thread pool usage model and the method call volume prediction value;
[0030] Among them, the method call volume model is trained using the method call volume observation values of the system in the second historical period; the thread pool usage model is trained using the method call volume observation values and thread pool usage observation values of the system in the second historical period.
[0031] Optionally, the method call volume prediction module is also used to: before determining the predicted value of the method call volume of the system in the target time period, train using a time series model based on the observed value of the method call volume of the system in the second historical time period to obtain the method call volume model.
[0032] Optionally, the method call volume model includes: an online method call volume model and an MQ triggered method call volume model; the method call volume observation value includes: an online method call volume observation value and an MQ triggered method call volume observation value;
[0033] The method call volume prediction module trains the method call volume model using a time series model, including:
[0034] According to the online method call volume observation value of the system in the second historical period, the online method call volume model is obtained by training using a time series model;
[0035] The MQ trigger method call volume model is obtained by training using a time series model according to the observed value of the MQ trigger method call volume of the system in the second historical period.
[0036] Optionally, the method call volume observation value further includes: an MQ message sending volume observation value;
[0037] The method call volume prediction module is trained using a time series model to obtain the MQ trigger method call volume model, including:
[0038] Determine a predicted value of the MQ message sending volume of the system in the second historical period according to a pre-trained MQ message sending volume model and an observed value of the MQ message sending volume of the system in the second historical period; the MQ message sending volume model is obtained by training using a time series model based on the observed value of the MQ message sending volume of the system in the second historical period;
[0039] A thread regression model is established according to the predicted value of the MQ message sending volume and the observed value of the MQ trigger method calling volume of the system in the second historical period to obtain the MQ trigger method calling volume model.
[0040] Optionally, the method call volume prediction module is further used for at least one of the following:
[0041] Before training the time series model, the training data sequence is stabilized;
[0042] After training using the time series model, the trained model is tested and confirmed to have passed the test.
[0043] Optionally, the thread pool usage prediction module is also used to: before determining the thread pool usage prediction value of the system in the target time period, train the thread pool usage model using the xgboost model based on the method call observation value and thread pool usage observation value of the system in the second historical time period.
[0044] Optionally, the apparatus of the embodiment of the present invention further comprises: a model series test module, which is used to: before determining the predicted value of the thread pool usage of the system in the target time period,
[0045] Determine the predicted value of the method call volume of the system in the second historical period based on the method call volume model and the observed value of the method call volume of the system in the second historical period; determine the predicted value of the thread pool usage of the system in the second historical period based on the thread pool usage model and the predicted value of the method call volume of the system in the second historical period; test the method call volume model and the thread pool usage model based on the predicted value and observed value of the thread pool usage of the system in the second historical period and confirm that the test passes.
[0046] According to a third aspect of an embodiment of the present invention, there is provided an electronic device for system capacity planning, including:
[0047] one or more processors;
[0048] a storage device for storing one or more programs,
[0049] When the one or more programs are executed by the one or more processors, the one or more processors implement the method provided in the first aspect of the embodiment of the present invention.
[0050] According to a fourth aspect of an embodiment of the present invention, a computer-readable medium is provided, on which a computer program is stored, and when the program is executed by a processor, the method provided by the first aspect of the embodiment of the present invention is implemented.
[0051] An embodiment of the above invention has the following advantages or beneficial effects: a method call volume model trained using the method call volume observation values of the system in the second historical period is used to determine the method call volume prediction value of the system in the target period, and a thread pool usage model trained using the method call volume observation values and thread pool usage observation values of the system in the second historical period is used to determine the thread pool usage prediction value of the system in the target period. The future capacity of the system can be intelligently planned based on the historical data of the system, thereby limiting or expanding the system before problems occur, with fast response speed, low cost and high security.
[0052] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.
[0054] Figure 1 It is a schematic diagram of the main process of the method for system capacity planning in an embodiment of the present invention;
[0055] Figure 2 is a schematic diagram of using a time series model for training in an optional embodiment of the present invention;
[0056] Figure 3 is a schematic diagram of a method for system capacity planning in an optional embodiment of the present invention;
[0057] Figure 4 is a schematic diagram of main modules of a device for system capacity planning according to an embodiment of the present invention;
[0058] Figure 5 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;
[0059] Figure 6 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION
[0060] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0061] According to one aspect of an embodiment of the present invention, a method for system capacity planning is provided.
[0062] Figure 1 FIG. 1 is a schematic diagram of the main process of the method for system capacity planning in an embodiment of the present invention. Figure 1 As shown, the method for system capacity planning includes: step S101, step S102 and step S103.
[0063] In step S101, the method call volume of the system in the first historical period is obtained. The first historical period refers to the period before the target period. For example, the target period is 2021, and the first historical period is three or six years ending in 2020. For another example, the target period is 2021, and the first historical period is from 2010 to 2015.
[0064] The method call volume refers to the call volume of each method in the system, that is, the access traffic. In the actual application process, you can analyze only the call volume of a part of the methods in the system, or you can analyze the call volume of all methods in the system. Furthermore, you can analyze the call volume of each method separately, or analyze the total call volume of multiple methods. Exemplarily, according to the composition of the access volume of each method in the system, the source of the caller is mainly divided into two aspects: one is the direct call of the business needs, which conforms to a certain specific rule, such as the large call volume at midnight; the second is triggered by a certain situation, such as relying on the message sent by MQ (Message Queue). Only when there is a change in the message will the call interface be triggered. This situation depends on how many messages are received. Therefore, the method call volume can include the online method call volume and the MQ triggered method call volume.
[0065] In step S102, a predicted value of the method call volume of the system in a target period after the first historical period is determined based on the pre-trained method call volume model and the method call volume.
[0066] The method call volume model is trained using the method call volume observations of the system in the second historical period. The second historical period refers to the period before the target period. The second historical period can be the same as the first historical period, or different from the first historical period (for example, the second historical period partially overlaps with the first historical period, the second historical period is a sub-period within the first historical period, or the second historical period does not overlap with the first historical period). For example, the first historical period is 2019, and the second historical period is three or six years ending in 2019. For another example, the first historical period is 2019, and the second historical period is from 2010 to 2015.
[0067] The training method of the method call volume model can be selectively set according to the actual situation. Optionally, before determining the predicted value of the method call volume of the system in the target period, the method call volume model is obtained by training using a time series model based on the observed value of the method call volume of the system in the second historical period. The training method using a time series model is simple and has good accuracy.
[0068] A time series is a sequence of observations of the same phenomenon at different times. Depending on the observation time, the time in the time series can be years, quarters, months, or any other time form. Time series are divided into stationary and non-stationary sequences. A stationary sequence is a sequence that basically does not have a trend. Each observation in the sequence basically fluctuates at a fixed level. The degree of fluctuation varies in different time periods, but there is no certain pattern. It fluctuates randomly. Non-stationary sequences include sequences with trends, seasonality, cyclicality, and irregular changes.
[0069] A trend (Seuclar trend) is a tendency of increase or decrease of things over a long period of time.
[0070] Seasonal variation is a cyclical change that occurs repeatedly in each period. The general seasonal variation cycle is 12 months. Sales peak season, sales off season, tourist peak season, tourist off season, change due to different seasons. Season, not only refers to the four seasons of the year, but actually refers to any cyclical change. A sequence with seasonal components may or may not contain a trend.
[0071] Cyclic variation is also called cyclic variation. It is a cyclic variation that occurs repeatedly with a certain period. Since the length of the period of this cyclic variation is irregular, there is no regularity in the prediction method. Generally, in short-term prediction, the cyclic variation factor is regarded as part of the long-term trend and is not analyzed separately.
[0072] Irregular variation refers to the changes caused by various complex factors, which form many small fluctuations on the time series curve. This kind of change has no rules to follow and is difficult to predict and analyze. In time series, moving average method or exponential smoothing method is usually used to eliminate passive interference. There are two ways to combine the above four factors of time series. One is the additive model, in which the four factors are independent of each other, that is, the time series is formed by the direct superposition of the four factors. The other is the multiplicative model, in which the four factors influence each other, that is, the time series is formed by the combination of the four factors.
[0073] If the time series is not stationary, the training data can be stabilized before using the time series model for training. For example, factors such as seasonal periodicity can be removed, and autocorrelation detection can be performed after passing the stationarity test. The autocorrelation function (ACF) is:
[0074]
[0075] It is called the autocorrelation coefficient.
[0076] The autocorrelation function can reflect the correlation between the observations of the time series. If the time series is stable, the autocorrelation coefficient will increase with the delay period. kAs the time series increases, it decreases to zero at a faster rate; if the time series is non-stationary, the speed at which the autocorrelation coefficient decreases to zero is usually slow. Since stationary series are uncorrelated, the autocorrelation coefficient is equal to zero if and only if the number of lag periods is greater than zero. Therefore, the autocorrelation test needs to check whether the correlation coefficient is equal to zero. The method of autocorrelation detection can be selectively set according to the actual situation, such as using Box-Pierce test, Ljung-Box test (both of these tests have tools available in R language and Python) and so on.
[0077] The specific form of the time series model can also be selectively set according to the actual situation, such as autoregressive model (AR), moving average model (MA), autoregressive moving average model (ARMA), autoregressive conditional heteroskedasticity model (ARCH), generalized autoregressive conditional heteroskedasticity model (GARCH), etc. For example, the ARIMA (p, d, q) difference autoregressive moving average model is used to model the data from 2014 to 2018. AR is autoregressive, p is the autoregressive term, MA is moving average, q is the moving average term, and d is the number of differences made when the time series is called stable. The model obtained by modeling can be used to predict the relevant data after 2018.
[0078] Optionally, after training with a time series model, the trained model can be tested and confirmed to have passed the test. The test method can be selectively set according to the actual situation, such as RMSE (Root Mean Square Error), MSE (Mean Square Error), MAE (Mean Absolute Error), SD (Standard Deviation), etc. RMSE (Root Mean Square Error) measures the deviation between the observed value and the true value, and is often used as a standard for measuring the prediction results of machine learning models. MSE (Mean Square Error) is the square of the difference between the true value and the predicted value, and then summed and averaged. It is easy to derive in the form of squares, so it is often used as a loss function for linear regression. MAE (Mean Absolute Error) is the average of the absolute error, which can reflect the actual situation of the predicted value error. SD (Standard Deviation) is the arithmetic mean root of the variance, which is used to measure the degree of dispersion of a set of values. Exemplarily, the ARIMA (p, d, q) differential autoregressive moving average model is used to model the data from 2014 to 2018, and the model is used to predict the call volume in 2019, and the RMSE root mean square error is used to evaluate the prediction results of the model. RMSE can evaluate the degree of change of the data. The smaller the RMSE value, the better the accuracy of the prediction model in describing the experimental data. If the effect is not good, the model can be adjusted. If the effect is good, the predicted 2019 data can be used in subsequent steps, such as for the overall test of each model of the embodiment of the present invention, or for predicting the call volume data in 2020.
[0079] Optionally, the method call volume model includes: an online method call volume model and an MQ triggered method call volume model; the method call volume observations include: online method call volume observations and MQ triggered method call volume observations. The method call volume model is trained using a time series model, including: training using a time series model based on the online method call volume observations of the system in the second historical period to obtain the online method call volume model; training using a time series model based on the MQ triggered method call volume observations of the system in the second historical period to obtain the MQ triggered method call volume model. Separately training the online method call volume model and the MQ triggered method call volume model can accurately analyze and predict based on the composition of the method access volume, thereby improving the accuracy of capacity planning.
[0080] Figure 2 Schematic diagram of using a time series model for training in an optional embodiment of the present invention. This embodiment takes the training of an online method call volume model as an example. Figure 2 As shown in the figure, the model training process mainly includes three stages, namely, sequence stabilization, model identification and model testing. In the sequence stabilization stage, ACF and PACF (partial autocorrelation coefficient) are calculated based on historical data and plotted into graphs. According to the ACF and PACF graphs, check whether the sequence needs to be differentially transformed and seasonally transformed. If necessary, perform the transformation. The ultimate goal is to differentiate the non-stationary sequence to obtain a stationary sequence. Then, according to the ACF and PACF graphs, provisional models are determined, such as autoregressive model (AR), moving average model (MA), autoregressive moving average model (ARMA), autoregressive conditional heteroscedasticity model (ARCH), generalized autoregressive conditional heteroscedasticity model (GARCH), etc. In the model identification stage, the parameter values in the model are estimated and the residual statistics in the model are calculated. In the model testing stage, the residual values are tested to determine whether the current parameter values are appropriate (i.e., whether the model accuracy meets the requirements). If appropriate, the obtained model can be used for prediction; otherwise, the model is provisionally determined again according to the ACF and PACF graphs, and then the model identification and model testing stages are performed until the parameter values of the current model are determined to be appropriate and the trained model is obtained.
[0081] The training method of the MQ trigger method call volume model can be the same as the training method of the online method call volume model. Optionally, a time series model is used for training to obtain an MQ trigger method call volume model, including: determining the predicted value of the MQ message sending volume of the system in the second historical period based on the pre-trained MQ information sending volume model and the observed value of the MQ message sending volume of the system in the second historical period; establishing a thread regression model based on the predicted value of the MQ message sending volume of the system in the second historical period and the observed value of the MQ trigger method call volume to obtain the MQ trigger method call volume model. The MQ information sending volume model is obtained by training using a time series model based on the observed value of the MQ message sending volume of the system in the second historical period. The training method can be selectively set according to the actual situation, for example, using Figure 2 The method shown is used for training.
[0082] In step S103, the predicted value of thread pool usage of the system in the target time period is determined according to the pre-trained thread pool usage model and the predicted value of the method call volume.
[0083] A thread pool is a form of multithreading where tasks are added to a queue and then automatically started after a thread is created. If all thread pool threads are always busy but the queue contains pending work, the thread pool will create another worker thread after a while but the number of threads will never exceed the maximum. Threads that exceed the maximum can be queued, but they will not start until other threads have completed.
[0084] The thread pool usage model is trained using the method call observations and thread pool usage observations of the system in the second historical period. The model form of the thread pool usage model can be selectively set according to the actual situation, such as boosting (an integrated classification method), xgboost, GBDT (Gradient Boosting DecisionTree, an iterative decision tree algorithm), etc. xgboost is a new machine learning algorithm proposed by Dr. Chen Tianqi in 2016. xgboost can be used for both classification and regression problems. The algorithm adopts the idea of boosting integrated learning, connecting multiple simple models in series, and can achieve very complex and accurate predictions. The GBDT model uses the negative gradient of the loss function to replace the residual, which can speed up the training quickly, but the first-order gradient is used to replace the residual, and the convergence is relatively slow during the training process. Xgboost uses the second-order gradient information, which can significantly speed up the convergence of the model. In addition, xgboost adds regularization information, which can effectively prevent the model from overfitting. Another major advantage of xgboost is that it can flexibly select base classifiers and custom loss functions, as long as the second-order gradient of the loss function exists, so it can be more flexible and the fitting ability is more powerful. Using xgboost for capacity prediction can not only achieve accurate prediction, but also does not need to add too much additional burden to the server. Therefore, in an optional embodiment, before determining the predicted value of the thread pool usage of the system in the target period, the thread pool usage model is trained using the xgboost model according to the method call amount observation value and the thread pool usage observation value of the system in the second historical period.
[0085] Optionally, before determining the predicted value of the system's thread pool usage in the target time period, the method further includes: determining the predicted value of the system's method call volume in the second historical time period based on the method call volume model and the observed value of the system's method call volume in the second historical time period; determining the predicted value of the system's thread pool usage in the second historical time period based on the thread pool usage model and the predicted value of the system's method call volume in the second historical time period; testing the method call volume model and the thread pool usage model based on the predicted value of the system's thread pool usage in the second historical time period and the observed value of the thread pool usage and confirming that the test passes.
[0086] Exemplarily, based on the method call volume model and the observed values of the method call volume of the system in 2014-2018, the predicted value of the method call volume of the system in 2019 is determined; based on the thread pool usage model and the predicted value of the method call volume of the system in 2019, the predicted value of the thread pool usage of the system in 2019 is determined; based on the predicted value of the thread pool usage of the system in 2019 and the observed value of the thread pool usage, the method call volume model and the thread pool usage model are tested and confirmed to have passed the test.
[0087] This embodiment uses the predicted value determined by the method call volume model and the thread pool usage model for joint testing. Through the model series test, the accuracy of the method call volume model and the fit of the thread pool usage model can be understood, and the overall effect of the test model can be tested. When the test accuracy meets the requirements, online testing is carried out, and then the model is improved and officially deployed online.
[0088] In the embodiment of the present invention, the time unit of each piece of data in each time period can be selectively set according to the actual situation, such as minutes or hours. Exemplarily, the source data obtained is the call volume and thread pool status per minute, but considering the time consumption of the method calculation for the server, the data per hour is taken.
[0089] It should also be noted that when training the method call volume model and the thread pool usage model, the training can be directly based on the feature data such as the call volume data and thread pool usage data of each method, or these feature data can be pre-processed by feature screening, feature fusion, etc. Furthermore, in order to facilitate model training, each feature can be feature encoded; in order to improve the accuracy of capacity planning, anomaly detection can be performed on each feature data.
[0090] Figure 3 Schematic diagram of a method for system capacity planning in an optional embodiment of the present invention. In this example, the method for capacity planning mainly includes four stages:
[0091] (1) Accurate data
[0092] First, obtain the call volume of each method in the system from 2014 to 2019 and the corresponding thread pool usage. Secondly, it is necessary to analyze the access volume composition of each method in the system. The sources of the callers are mainly divided into two aspects: one is the direct call due to business needs; the other is dependent on a certain situation, such as the message sent by the MQ message queue. Finally, define the characteristic variables and variables to be estimated. The variable to be estimated is the number of thread pools occupied. The thread pool is generally configured to be 200. If the thread pool is full, it means that there is a risk to the system capacity. The characteristic variable is the call volume of each method. This example uses the call volume of 10 online methods as an example, and the corresponding data from 2014 to 2019 is also taken; as well as the method call volume due to MQ triggering, in this example, the call volume of 5 methods that depend on MQ triggering is taken.
[0093] The source data obtained in this example is the call volume and thread pool status per minute, but considering the time consumption of method calculation on the server, the data is taken per hour.
[0094] (2) Prediction of future traffic of characteristic variables
[0095] A. Using time series models to predict the traffic of each calling method
[0096] First, the time series should be stabilized to remove seasonal periodicity and other factors. After passing the stability test, autocorrelation test should be performed. After passing the above test, the ARIMA (p, d, q) differential autoregressive moving average model is used to model the data from 2014 to 2018. The model is used to predict the call volume in 2019, and the RMSE root mean square error is used to evaluate the prediction results. The smaller the RMSE value, the better the accuracy of the prediction model in describing the experimental data. If the effect is not good, the model can be adjusted. If the effect is good, the predicted 2019 data will be used in the prediction of the entire model in the fourth stage for testing, and the call volume in 2020 can be predicted.
[0097] The process of time series analysis can be referred to Figure 2 The embodiments shown will not be described in detail here.
[0098] B. Prediction of method calls triggered by MQ
[0099] The prediction of method calls triggered by MQ requires two steps. First, the time series model is used to predict the MQ sending volume. Second, a univariate linear regression model is established based on the historical data sent by MQ and the method call volume triggered by it to predict the method call volume.
[0100] The first is time series prediction. The method in A is used to predict the MQ sending volume in 2019, and the RMSE is calculated. If the model fits well, the sending volume in 2020 is predicted. The second is to establish a univariate linear regression model. The dependent variable is the call volume, and the independent variable is the MQ sending volume. The call volume in 2019 is predicted. Similarly, RMSE is also needed to consider the fit of the model and predict the call volume in 2020.
[0101] (3) Use the xgboost model to perform predictive analysis on the variables to be estimated
[0102] First, we use the feature variables (15 variables) and the data from 2014 to 2018 (a total of five years, with data from 2019 reserved for serial testing) as the training set and test set. Before modeling, we need to perform a series of preprocessing on the features, including feature encoding, feature screening, anomaly detection, feature fusion, etc. Then we use xgboost to model and adjust the parameters, so that we can achieve the performance of the model under the condition of real feature variable data. When modeling, we not only use 15 variables to model, but also use the corresponding values of the variables to be estimated to adjust the model until the model meets the required prediction accuracy. The feature variables used in this step are the actual observed values.
[0103] In the process of capacity prediction, in addition to xgboost, neural networks can also be used for prediction. Neural networks simulate the neuron structure of the human brain. However, neural networks require more computing resources and the training time of the model is longer. This embodiment uses the xgboost model, which requires less computing resources and the training time of the model is also shorter.
[0104] (4) Model series test
[0105] In this phase, the predicted feature variables obtained in the second phase and the xgboost model obtained in the third phase are used for joint testing to test the overall effect of the model. First, offline testing is carried out, using the 2019 data as the test set for testing. When the test accuracy reaches the requirement, online testing is carried out, and then the model is improved and officially deployed online.
[0106] If the system encounters a large number of calls or excessive thread pool usage during operation, the client may call the microservice thread pool full or the client may time out. In this case, it can be considered that the current application capacity of the system is insufficient. At this time, a plan such as limiting the flow or expanding the capacity of the call end can be formulated. The embodiment of the present invention uses machine learning algorithms, especially the idea of ensemble learning, to predict the possible risk of insufficient capacity of the system in the future, make capacity planning in advance, and improve the system by limiting the flow of the call end or increasing the number of servers.
[0107] The capacity planning scheme in the prior art relies too much on monitoring alarms, and manual processing is connected after the alarm. It is impossible to achieve accurate prediction of long-term capacity, and intelligence relies on factual alarm information, and then completely relies on manual processing methods, which cannot be realized. Intelligence increases labor costs, and excessive manual intervention also increases the risk of the system. The manual processing time after the alarm is long. After the system alarm, if reasonable intervention cannot be made in a short time, it is easy to cause huge losses. Therefore, how to reasonably predict the capacity and limit or expand the system before problems occur is very important, thereby reducing the number of alarms. The reduction in the number of alarms can also reduce company costs and reduce the energy of research and development. The embodiment of the present invention uses the method call volume model obtained by training the method call volume observation value of the system in the second historical period to determine the method call volume prediction value of the system in the target period, and uses the thread pool usage model obtained by training the method call volume observation value and thread pool usage observation value of the system in the second historical period to determine the thread pool usage prediction value of the system in the target period. It can intelligently plan the future capacity of the system based on the historical data of the system, thereby realizing limiting or expanding the system before problems occur, with fast response speed, low cost and high security.
[0108] According to a second aspect of an embodiment of the present invention, a device for implementing the above method is provided.
[0109] Figure 4 is a schematic diagram of the main modules of the apparatus for system capacity planning according to an embodiment of the present invention, such as Figure 4 As shown, the system capacity planning device 400 includes:
[0110] The historical data acquisition module 401 acquires the method call volume of the system in the first historical period;
[0111] A method call volume prediction module 402 determines a method call volume prediction value of the system in a target period after the first historical period according to a pre-trained method call volume model and the method call volume;
[0112] The thread pool usage prediction module 403 determines the thread pool usage prediction value of the system in the target time period according to the pre-trained thread pool usage model and the method call volume prediction value;
[0113] Among them, the method call volume model is trained using the method call volume observation values of the system in the second historical period; the thread pool usage model is trained using the method call volume observation values and thread pool usage observation values of the system in the second historical period.
[0114] Optionally, the method call volume prediction module is also used to: before determining the predicted value of the method call volume of the system in the target time period, train using a time series model based on the observed value of the method call volume of the system in the second historical time period to obtain the method call volume model.
[0115] Optionally, the method call volume model includes: an online method call volume model and an MQ triggered method call volume model; the method call volume observation value includes: an online method call volume observation value and an MQ triggered method call volume observation value;
[0116] The method call volume prediction module trains the method call volume model using a time series model, including:
[0117] According to the online method call volume observation value of the system in the second historical period, the online method call volume model is obtained by training using a time series model;
[0118] The MQ trigger method call volume model is obtained by training using a time series model according to the observed value of the MQ trigger method call volume of the system in the second historical period.
[0119] Optionally, the method call volume observation value further includes: an MQ message sending volume observation value;
[0120] The method call volume prediction module is trained using a time series model to obtain the MQ trigger method call volume model, including:
[0121] Determine a predicted value of the MQ message sending volume of the system in the second historical period according to a pre-trained MQ message sending volume model and an observed value of the MQ message sending volume of the system in the second historical period; the MQ message sending volume model is obtained by training using a time series model based on the observed value of the MQ message sending volume of the system in the second historical period;
[0122] A thread regression model is established according to the predicted value of the MQ message sending volume and the observed value of the MQ trigger method calling volume of the system in the second historical period to obtain the MQ trigger method calling volume model.
[0123] Optionally, the method call volume prediction module is further used for at least one of the following:
[0124] Before training the time series model, the training data sequence is stabilized;
[0125] After training using the time series model, the trained model is tested and confirmed to have passed the test.
[0126] Optionally, the thread pool usage prediction module is also used to: before determining the thread pool usage prediction value of the system in the target time period, train the thread pool usage model using the xgboost model based on the method call observation value and thread pool usage observation value of the system in the second historical time period.
[0127] Optionally, the apparatus of the embodiment of the present invention further comprises: a model series test module, which is used to: before determining the predicted value of the thread pool usage of the system in the target time period,
[0128] Determine the predicted value of the method call volume of the system in the second historical period based on the method call volume model and the observed value of the method call volume of the system in the second historical period; determine the predicted value of the thread pool usage of the system in the second historical period based on the thread pool usage model and the predicted value of the method call volume of the system in the second historical period; test the method call volume model and the thread pool usage model based on the predicted value and observed value of the thread pool usage of the system in the second historical period and confirm that the test passes.
[0129] According to a third aspect of an embodiment of the present invention, there is provided an electronic device for system capacity planning, including:
[0130] one or more processors;
[0131] a storage device for storing one or more programs,
[0132] When the one or more programs are executed by the one or more processors, the one or more processors implement the method provided in the first aspect of the embodiment of the present invention.
[0133] According to a fourth aspect of an embodiment of the present invention, a computer-readable medium is provided, on which a computer program is stored, and when the program is executed by a processor, the method provided by the first aspect of the embodiment of the present invention is implemented.
[0134] Figure 5 An exemplary system architecture 500 is shown to which the method or apparatus for system capacity planning according to an embodiment of the present invention may be applied.
[0135] like Figure 5 As shown, system architecture 500 may include terminal devices 501, 502, 503, a network 504 and a server 505. Network 504 is used to provide a medium for communication links between terminal devices 501, 502, 503 and server 505. Network 504 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0136] Users can use terminal devices 501, 502, 503 to interact with server 505 through network 504 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 501, 502, 503, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only as examples).
[0137] The terminal devices 501 , 502 , and 503 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.
[0138] The server 505 may be a server that provides various services, such as a backend management server (only an example) that provides support for shopping websites browsed by users using the terminal devices 501, 502, and 503. The backend management server may analyze and process the received data such as product information query requests, and feed back the processing results (such as target push information, product information - only an example) to the terminal device.
[0139] It should be noted that the method for system capacity planning provided in the embodiment of the present invention is generally executed by the server 505 , and accordingly, the device for system capacity planning is generally arranged in the server 505 .
[0140] It should be understood that Figure 5 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0141] Reference below Figure 6 , which shows a schematic diagram of the structure of a computer system 600 of a terminal device suitable for implementing an embodiment of the present invention. Figure 6 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0142] like Figure 6 As shown, the computer system 600 includes a central processing unit (CPU) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage part 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the system 600 are also stored. The CPU 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0143] The following components are connected to the I / O interface 605: an input section 606 including a keyboard, a mouse, etc.; an output section 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, a modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the I / O interface 605 as needed. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as needed, so that a computer program read therefrom is installed into the storage section 608 as needed.
[0144] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 609, and / or installed from the removable medium 611. When the computer program is executed by the central processing unit (CPU) 601, the above-mentioned functions defined in the system of the present invention are executed.
[0145] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0146] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0147] The modules involved in the embodiments of the present invention may be implemented in software or hardware. The modules described may also be set in a processor, for example, they may be described as: a processor including: a historical data acquisition module, a method call volume prediction module and a thread pool usage prediction module. The name of the module does not, in some cases, constitute a limitation on the module itself, for example, the historical data acquisition module may also be described as "a module for determining the predicted value of the method call volume of the system in the target period after the first historical period".
[0148] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes: obtaining the method call volume of the system in the first historical period; determining the method call volume prediction value of the target period after the first historical period according to the pre-trained method call volume model and the method call volume; determining the thread pool usage prediction value of the system in the target period according to the pre-trained thread pool usage model and the method call volume prediction value; wherein the method call volume model is trained using the method call volume observation value of the system in the second historical period; the thread pool usage model is trained using the method call volume observation value and the thread pool usage observation value of the system in the second historical period.
[0149] According to the technical solution of the embodiments of the present invention, a method call volume model trained using the method call volume observation values of the system in the second historical period is used to determine the method call volume prediction value of the system in the target period, and a thread pool usage model trained using the method call volume observation values and thread pool usage observation values of the system in the second historical period is used to determine the thread pool usage prediction value of the system in the target period. The future capacity of the system can be intelligently planned based on the historical data of the system, thereby achieving current limiting or expansion of the system before problems occur, with fast response speed, low cost and high security.
[0150] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for system capacity planning, It is characterized in that include: Get the method call volume of the system in the first historical period; Determine a predicted value of the method call volume of the system in a target period after the first historical period according to a pre-trained method call volume model and the method call volume; Determine the predicted thread pool usage value of the system in the target time period according to the pre-trained thread pool usage model and the method call volume predicted value; When it is determined that the current application capacity of the system is insufficient according to the method call amount prediction value and the thread pool usage prediction value, capacity planning is performed on the system; The method call volume model is obtained by training using the method call volume observation value of the system in the second historical period; The thread pool usage model is trained using the method call volume observation values and thread pool usage observation values of the system in the second historical period.
2. The method according to claim 1, It is characterized in that Before determining the predicted value of the method call volume of the system in the target time period, the method further includes: The method call volume model is obtained by training the method call volume model using a time series model according to the method call volume observation value of the system in the second historical period.
3. The method according to claim 2, It is characterized in that The method call volume model includes: an online method call volume model and an MQ triggered method call volume model; the method call volume observation value includes: an online method call volume observation value and an MQ triggered method call volume observation value; Using a time series model to train the method call volume model includes: According to the online method call volume observation value of the system in the second historical period, the online method call volume model is obtained by training using a time series model; The MQ trigger method call volume model is obtained by training using a time series model according to the observed value of the MQ trigger method call volume of the system in the second historical period.
4. The method according to claim 3, It is characterized in that The method call volume observation value also includes: MQ message sending volume observation value; The MQ trigger method call volume model is obtained by training using a time series model, including: Determine a predicted value of the MQ message sending volume of the system in the second historical period according to a pre-trained MQ message sending volume model and an observed value of the MQ message sending volume of the system in the second historical period; the MQ message sending volume model is obtained by training using a time series model based on the observed value of the MQ message sending volume of the system in the second historical period; A thread regression model is established according to the predicted value of the MQ message sending volume and the observed value of the MQ trigger method calling volume of the system in the second historical period to obtain the MQ trigger method calling volume model.
5. The method according to any one of claims 2 to 4, It is characterized in that Also includes at least one of the following: Before training the time series model, the training data sequence is stabilized; After training using the time series model, the trained model is tested and confirmed to have passed the test.
6. The method according to claim 2, It is characterized in that Before determining the predicted value of thread pool usage of the system in the target period, the method further includes: The thread pool usage model is trained using an xgboost model according to the method call volume observation values and the thread pool usage observation values of the system in the second historical period.
7. The method according to claim 1, It is characterized in that Before determining the predicted value of thread pool usage of the system in the target period, the method further includes: Determining a predicted value of the method call volume of the system in a third period before the target period according to the method call volume model and the observed value of the method call volume of the system in the second historical period; Determine a predicted value of thread pool usage of the system in the third time period according to the thread pool usage model and a predicted value of method calls of the system in the third time period; Based on the predicted value of thread pool usage and the observed value of thread pool usage of the system in the third time period, the method call volume model and the thread pool usage model are tested and confirmed to pass the test.
8. A system capacity planning device, It is characterized in that include: A historical data acquisition module, which acquires the method call volume of the system in the first historical period; A method call volume prediction module, which determines a method call volume prediction value of the system in a target period after the first historical period according to a pre-trained method call volume model and the method call volume; A thread pool usage prediction module determines a thread pool usage prediction value of the system in a target time period according to a pre-trained thread pool usage model and the method call volume prediction value; The device is also used for: when it is determined that the current application capacity of the system is insufficient according to the method call amount prediction value and the thread pool usage prediction value, performing capacity planning on the system; The method call volume model is obtained by training using the method call volume observation value of the system in the second historical period; The thread pool usage model is trained using the method call volume observation values and thread pool usage observation values of the system in the second historical period.
9. An electronic device for system capacity planning, It is characterized in that include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 7.
10. A computer readable medium having a computer program stored thereon, It is characterized in that When the program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Method and system for acquiring and analyzing method performance data
CN103258009A
Micro-service dynamic aggregation splitting system based on call flow analysis and prediction
CN111130908A
