A method and system for automatically monitoring and optimizing application performance

Collect performance data and historical analysis through the stream processing system, dynamically adjust thresholds, and realize automated monitoring and optimization of application performance. This solves the problems in the existing technology of insufficient automation of monitoring and reliance on manual optimization for optimization, and improves the reliability and resource utilization efficiency of the system. .

CN118069460BActive Publication Date: 2024-09-03北京嘉华铭品牌策划有限公司
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202410173134.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-02-07
Publication Date
2024-09-03
Estimated Expiration
2044-02-07

AI Technical Summary

Technical Problem

Application performance monitoring in the existing technology is not automated and real-time enough, the optimization process relies too much on manual intervention, and it is difficult to effectively evaluate performance changes in modern deployment strategies.

Method used

Use a stream processing system to collect performance data, establish a performance baseline, and conduct high-load testing in a blue-green deployment environment. Historical data analysis is used to predict off-peak periods, and performance warning thresholds are dynamically adjusted to achieve real-time performance anomaly detection and automated problem handling.

Benefits of technology

By automatically monitoring and predicting off-peak periods, the risk of system failure is reduced, resource utilization efficiency is improved, operation and maintenance costs are reduced, operation and maintenance efficiency is improved, and the need for manual intervention is reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118069460B
    Figure CN118069460B
Patent Text Reader

Abstract

The present invention discloses an automatic monitoring and optimization method and system for application performance, the method comprising: collecting performance data during the stable operation of the system to establish a performance baseline; and performing performance testing in the blue-green deployment environment of the system, and after receiving a request for blue-green deployment, predicting a low-peak period using historical performance data analysis; performing performance testing during the low-peak period, including: performing a high-load test while deploying blue-green, comparing the test results with the performance baseline, and adjusting the dynamic threshold of the performance warning; after the blue-green deployment is completed, the early warning system performs anomaly detection on the real-time performance data based on the threshold of the performance warning; after the threshold of the performance warning is triggered, automatic problem handling of the early warning trigger is realized. The present invention improves resource utilization efficiency by predicting the low-peak period and deploying and testing during the low-peak period. The threshold setting for operation and maintenance is performed according to the test performance to reduce the need for manual intervention.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of computer technology, and in particular relates to a method and system for automatically monitoring and optimizing application performance. Background Art

[0002] With the rapid development of information technology, distributed systems have become increasingly important in processing large-scale data and high-concurrency requests. In this context, ensuring the performance and stability of applications is the key to providing high-quality services. However, due to the complexity and dynamics of distributed systems, traditional performance monitoring and optimization methods face multiple challenges.

[0003] On the one hand, traditional performance monitoring tools usually require manual configuration of monitoring parameters and are difficult to adapt to changes in system structure or workload. These tools tend to focus on collecting static indicators, while ignoring the dynamic fluctuations of system performance and their impact on system stability. In addition, performance data analysis in traditional methods is often performed offline, resulting in delays in monitoring and responding to performance issues.

[0004] On the other hand, the optimization of application performance usually relies on the experience and manual intervention of operation and maintenance personnel. This not only increases operating costs, but may also cause system performance to deteriorate further due to human errors. Therefore, how to achieve automation and real-time performance monitoring and intelligent optimization operations has become a technical problem that needs to be solved urgently.

[0005] In addition, with the popularity of agile development and continuous deployment practices, the frequency of application updates has greatly increased. In modern deployment strategies such as blue-green deployment, how to effectively monitor and evaluate the performance of new versions without affecting user experience is also a technical difficulty.

[0006] In summary, the problems of existing technologies are: the monitoring methods are not automated enough, not real-time enough, the optimization process is too dependent on manual intervention, and it is difficult to effectively evaluate performance changes in modern deployment strategies. Therefore, it is particularly urgent and important to develop a method that can automatically and real-timely monitor and optimize application performance. Summary of the invention

[0007] In view of the defects existing in the above-mentioned prior art, the present invention provides a method for automatically monitoring and optimizing application performance, the method comprising:

[0008] Collect performance data based on the stream processing system during stable system operation to establish a performance baseline;

[0009] And, perform performance testing in the blue-green deployment environment of the system, after receiving a request for blue-green deployment, use historical performance data analysis to predict the off-peak period; perform performance testing during the off-peak period, including:

[0010] During the blue-green deployment, high-load testing is performed, the test results are compared with the performance baseline, and the dynamic thresholds of performance warnings are adjusted;

[0011] After the blue-green deployment is completed, the early warning system detects anomalies in real-time performance data based on performance warning thresholds;

[0012] After the performance warning threshold is triggered, automatic problem handling triggered by the early warning is realized.

[0013] The performance data is collected to establish a performance baseline, and the baseline data covers the performance data involved in all key performance indicators; the performance data at least includes response time, throughput, CPU usage and memory usage.

[0014] Among them, it is characterized in that

[0015] The discovery of new services is a controlled service discovery process because it needs to be done after receiving notification.

[0016] Among them, an HTTP interface or a message queue interface is used to receive notifications of new services, and the notifications of new services are sent after it is determined that the dynamic threshold of performance warning adjustment has been completed; when the new service is deployed, the currently active service information is recorded in the maintained central service directory, and the notifications of new services will update this directory, and the monitoring system will read it to update the monitoring target. The central service directory records the service ID, update time and dynamic threshold of performance warning of the new service.

[0017] The low-peak period is predicted by analyzing historical performance data, including prediction of the low-peak period based on throughput and / or system CPU usage.

[0018] Wherein, determining whether there is a high correlation between the throughput and the CPU usage rate based on the monotonic relationship between the two variables;

[0019] Determine whether there is a high correlation between the throughput and the CPU usage based on the monotonic relationship between the two variables, including when the Spearman correlation coefficient is greater than or equal to 0.7, determine that there is a high correlation between the transaction throughput and the CPU usage, and select to predict the low peak period based on the throughput or the system CPU usage;

[0020] Otherwise, choose to make predictions for off-peak hours based on throughput and system CPU usage.

[0021] When predicting off-peak hours based on throughput or system CPU usage, it includes:

[0022] Step S1: Collect the throughput data (i.e., the number of requests per second, TPS) and CPU usage data within a certain period of time;

[0023] Perform time series decomposition on each individual time series to identify and model seasonality, trend, and cyclical components;

[0024] For each time series Y t , perform time series decomposition to identify trends T t , Seasonality t and the random component R t : Y t =S t +T t +R t ;

[0025] in,

[0026] T t : represents the trend component at time point t;

[0027] w_n: represents the window size of the moving average used to calculate the trend, which is equal to 2k+1, where k is the span on one side of the moving average window;

[0028] ∑: represents the summation symbol, which is used to accumulate all values ​​of a sequence;

[0029] i: is the index of the summation symbol, which traverses from -k to +k in the formula to ensure that the window covers a total of n time points before and after t;

[0030] Y t+i : represents the original observation value of the time series at time t+i;

[0031] S t+i : represents the seasonal component at time point t+i;

[0032] Y t+i -S t+i : This part removes the seasonal effect from the original data in order to estimate the trend component more accurately;

[0033] The random components are:

[0034] R t =Y t -S t -T t ;

[0035] Step S2: Check the random components after decomposition and determine the stationarity of the sequence based on the ADF test. The detection equation can be expressed as:

[0036]

[0037] The meaning of each parameter is as follows:

[0038] ΔR t : represents the first-order difference of the random component at time t, that is, R t -R t-1 ;

[0039] α: is the intercept term or constant term in the model;

[0040] β: is the coefficient of the time trend term, reflecting the random component R t Linear trends over time;

[0041] t: is the time index of the time series;

[0042] γ: is R t-1 , which is the coefficient of the random component lagged by one period, is used to test R t Is there a unit root?

[0043] YesR t The accumulation of p-order lagged difference terms, where is the coefficient of the ith lagged difference;

[0044] ε t : is the error term, representing the unobservable random disturbance in the model. It is usually assumed that ε t It follows a normal distribution with zero mean and constant variance;

[0045] Step S3: building a model;

[0046] In confirming R t After the series is stationary, the model is used to analyze R t Conduct modeling;

[0047] R t =c+φ1R t-1 +φ2R t-2 +...+φ p R t-p +θ1ε t-1 +θ2ε t-2 +...+θ q ε t-q +ε t ,

[0048] in,

[0049] c: intercept term, representing the long-term mean of the time series;

[0050] These are the parameters of the autoregressive part, which measure R t The relationship between the current value of and its p past values;

[0051] R t-1 ,Rt-2 ,…,R t-p :These are R t Past values ​​of , lagged 1 to p periods;

[0052] θ1,θ2,…,θ q : These are the parameters of the moving average part, which measure the error term ε t-1 ,ε t-2 ,…,ε t-q For the current value R t The impact of

[0053] ε t-1 ,ε t-2 ,…,ε t-q : These are the R t The past q error terms of ;

[0054] ε t : is the error term at time t, representing the unpredictable random shock;

[0055] Before modeling, it is necessary to determine the orders of the autoregressive part and the moving average part, i.e., p and q;

[0056] With the estimated values ​​of p and q, we can use maximum likelihood estimation to estimate the parameters: c, and θ1,θ2,…,θ q ;

[0057] Step S4: residual autocorrelation test;

[0058] Check whether the residual sequence exhibits the characteristics of white noise, that is, there is no autocorrelation between the residuals; the statistic is expressed as:

[0059]

[0060] in,

[0061] n represents the sample size, i.e. the length of the time series;

[0062] h is the number of lags used in the test, which is predetermined and needs to be large enough to capture evidence of residual correlation;

[0063] is the sample autocorrelation coefficient of the time series residual at lag k;

[0064] Q is the test statistic, whose distribution, under the null hypothesis, approximately follows a chi-square distribution with hm degrees of freedom, where m is the number of parameters estimated in the model;

[0065]

[0066] in,

[0067] is the sample autocorrelation coefficient at lag k;

[0068] ε t is the residual value at time t;

[0069] is the mean of the residual sequence;

[0070] n is the sample size, i.e. the length of the time series;

[0071] t is the time index, t = 1, 2, ..., n;

[0072] If the test indicates that there is autocorrelation in the residuals, you need to re-perform the time series decomposition in step 1 to identify the trend T t , Seasonality t and the random component R t ;

[0073] Step S5, model prediction;

[0074] Use the established model to analyze the random component R t Make a forecast and then add the decomposed trend T t , seasonal component S t , to predict the original sequence Y t The future value of

[0075] The prediction of future values ​​can be expressed as:

[0076]

[0077] in,

[0078] Represents the time series R t The predicted value at time point t+1;

[0079] is the intercept of the model, The value of is equal to the intercept term c;

[0080] are the parameter estimates of the autoregressive part, which measure the R t The linear dependence between the current value and its previous p past values ​​in ; its value is correspondingly equal to

[0081] R t ,R t-1 ,…,R t-p+1 are the observations at time t, t-1, …, t-p+1;

[0082] are the parameter estimates of the moving average part, which measure the model residual ε t The impact on the current predicted value; its value is equal to θ1, θ2, …, θ q ;

[0083] ε t ,ε t-1 ,…,ε t-q+1 is the model residual at time t, t-1, …, t-q+1, that is, the error between the previous predicted value and the actual observed value; its value is correspondingly equal to ε t-1 ,ε t-2 ,…,ε t-q ;

[0084] The stochastic component of the forecast is then combined with the seasonal and trend components:

[0085]

[0086] in,

[0087] The predicted value of the seasonal component;

[0088] The predicted value of the trend component;

[0089] predicted value of the random component;

[0090] In seasonal decomposition models, future values ​​of the seasonal and trend components are usually predicted based on the patterns and properties of these components in historical data, i.e., the functions of these two components can be determined after seasonal decomposition;

[0091] Step S6: Determination of off-peak hours

[0092] Analyze the forecast results and combine business logic to determine the off-peak period of the system. Value to formulate;

[0093] Specifically, through the predicted The value of all trough points in the future preset time period; the corresponding The average of the values ​​was taken as the low peak threshold;

[0094] Determine whether there is a continuous time period L below the low-peak threshold within the future preset time period; if yes, take the continuous time period L as the low-peak period;

[0095] If there are multiple consecutive time periods below the low-peak threshold, the longest time period is selected as the low-peak period;

[0096] Otherwise, adjust the low peak threshold, for example, increase it by 10%, and repeat the above determination.

[0097] Among them, when predicting the off-peak period based on throughput and system CPU usage, it includes:

[0098] Step P1, collect two time series data: number of requests per second (TPS) and CPU usage;

[0099] Here t represents the time index;

[0100] Step P2: Model establishment and estimation;

[0101] For the above time series, the following model is constructed; assuming that p represents the lag order, the model can be expressed as:

[0102]

[0103] A t-i is a 2×2 coefficient matrix, which is the coefficient matrix of the model corresponding to the time ti;

[0104] c is a 2×1 vector containing a constant term;

[0105] ∈ TPS,t and ∈ CPU,t is the error term;

[0106] Step P3, to detect the error terms of different equations ∈ TPS,t and ∈ CPU,t The correlation between the two series is calculated; this can be calculated by estimating the model and obtaining the residuals using the following formula:

[0107]

[0108] in:

[0109] ρ(∈ TPS ,∈ CPU ) is the sample correlation coefficient between the two error series;

[0110] ∈ TPS,t and ∈ CPU,t are ∈ at time t TPS and ∈ CPU The value of

[0111] and They are ∈ TPS and ∈ CPU The sample mean of ;

[0112] T is the number of observations;

[0113] Step P4, construct an error correlation matrix, which contains the correlation coefficients between different error terms; for the model, the error correlation matrix is ​​a 2×2 matrix, which contains ∈ TPS,t and ∈ CPU,t The elements on the diagonal of the error correlation matrix are the autocorrelation coefficients of their respective error terms, while the elements on the off-diagonal are the correlation coefficients between two different error terms.

[0114] Here is the form of the error correlation matrix: Where ρ(∈ TPS ,∈ CPU ) is∈ TPS and ∈ CPU The sample correlation coefficient between ;

[0115] In this matrix:

[0116] The diagonal elements are set to 1, and the off-diagonal elements ρ(∈ TPS,t ,∈ CPU,t ) is the time point t∈ TPS,t and ∈ CPU,t The sample correlation coefficient r between them;

[0117] The correlation coefficient ρ(∈ TPS,t ,∈ CPU ,t) Conduct a hypothesis test to determine whether the correlation is statistically significant; if the correlation coefficient is significantly different from 0, then there is a statistically significant correlation between the two error terms;

[0118] To test whether the error terms are significantly correlated, use the z-transformation; the z-transformation can be used to transform the distribution of the correlation coefficient to a close normal distribution and perform hypothesis testing on the correlation coefficient; the z-transformation of the correlation coefficient is defined as:

[0119]

[0120] Where r is the sample correlation coefficient and z is the transformed value;

[0121] For the sample correlation coefficient r, its z-transformed variance is Where n is the sample size; used to construct confidence intervals or perform hypothesis testing;

[0122] If we find ρ(∈ TPS ,∈ CPU ) is significantly different from zero, re-evaluate the model parameter settings, including changing the lag order.

[0123] When the off-peak period is predicted based on the throughput and the system CPU usage, it further includes:

[0124] Step P5, model prediction

[0125] After estimating the model, the steps for making a one-step prediction are as follows:

[0126] Y t is a vector of two variables, Assume that the lag of the model is 1, that is, it contains one lag: Y t =c+Φ1Y t-1 +∈ t ;

[0127] Among them, Φ0 is the constant term vector, Φ1 is the coefficient matrix specifically corresponding to A t-1 Matrix,∈ t is the error vector;

[0128] Given the last observation Y t-1 , the one-step prediction will be: here, is the predicted value at time point t;

[0129] For more predictions, recursively use the model's predicted values ​​to predict the value at the next time point.

[0130] Set a finite length of prediction time;

[0131] Step P6, determine the off-peak period

[0132] Analyze the forecast results and combine business logic to determine the off-peak period of the system. Value to formulate;

[0133] Specifically, through the predicted The value of all trough points in the future preset time period; the Y corresponding to all the trough points t The average of the values ​​was taken as the low peak threshold;

[0134] Determine whether there is a continuous time period L below the low-peak threshold within the future preset time period; if yes, take the continuous time period L as the low-peak period;

[0135] If there are multiple consecutive time periods below the low-peak threshold, the longest time period is selected as the low-peak period;

[0136] Otherwise, adjust the low peak threshold, for example, increase it by 10%, and repeat the above determination.

[0137] The present invention also discloses an automatic monitoring and optimization system for application performance, the system comprising a memory and a processor, the memory storing a computer program, and the processor being used to execute the computer program to implement the aforementioned automatic monitoring and optimization method for application performance.

[0138] The present invention reduces the risk of system failures through automatic monitoring and problem handling, and improves the overall reliability of the system. It improves resource utilization efficiency by predicting off-peak periods and performing deployment and testing during off-peak periods. It sets thresholds for operation and maintenance based on test performance, reduces the need for manual intervention, reduces operation and maintenance costs, and improves operation and maintenance efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0139] By reading the detailed description below with reference to the accompanying drawings, the above and other purposes, features and advantages of the exemplary embodiments of the present disclosure will become readily understood. In the accompanying drawings, several embodiments of the present disclosure are shown in an exemplary and non-limiting manner, and the same or corresponding reference numerals represent the same or corresponding parts, wherein:

[0140] Figure 1 The flowchart shows a method for automatically monitoring and optimizing application performance according to an embodiment of the present invention. DETAILED DESCRIPTION

[0141] In order to make the purpose, technical scheme and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0142] The terms used in the embodiments of the present invention are only for the purpose of describing specific embodiments, and are not intended to limit the present invention. The singular forms "a", "said" and "the" used in the embodiments of the present invention and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings, and "multiple" generally includes at least two.

[0143] It should be understood that although the terms first, second, third, etc. may be used to describe ... in the embodiments of the present invention, these ... should not be limited to these terms. These terms are only used to distinguish .... For example, without departing from the scope of the embodiments of the present invention, the first ... may also be referred to as the second ..., and similarly, the second ... may also be referred to as the first ....

[0144] It should be understood that the term "and / or" used in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.

[0145] As used herein, the words "if" and "if" may be interpreted as "at the time of" or "when" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrases "if it is determined" or "if (stated condition or event) is detected" may be interpreted as "when it is determined" or "in response to determining" or "when detecting (stated condition or event)" or "in response to detecting (stated condition or event)", depending on the context.

[0146] It should also be noted that the term "includes", "comprising" or any other variation thereof is intended to cover non-exclusive inclusion, so that a commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprising a ..." do not exclude the existence of other identical elements in the commodity or device including the elements.

[0147] The automatic application performance monitoring and optimization system of the present invention is a highly integrated and automated solution, which aims to provide continuous performance monitoring, optimization and problem handling for distributed systems. The main goal of the system is to minimize human intervention and ensure the highest performance and availability of applications.

[0148] like Figure 1 As shown, the present invention discloses a method for automatically monitoring and optimizing application performance, the method comprising:

[0149] During the stable operation of the system, performance data is collected based on the stream processing system to establish a performance baseline, and the baseline data covers the performance data involved in all key performance indicators. The baseline data is collected during the non-test operation period of the system, and the baseline data covers all key performance indicators. The performance data at least includes response time, throughput (TPS), CPU usage, and memory usage. The performance indicators are key performance indicators.

[0150] Also, performance testing is performed in the system's blue-green deployment environment. After receiving a request for blue-green deployment, historical performance data analysis is used to predict off-peak hours, and performance testing of blue-green deployment is performed during this period to reduce the impact on users.

[0151] During the blue-green deployment, high-load testing is performed and the test results are compared with the performance baseline to evaluate the performance changes of the new version. During the above process, the performance data is analyzed in real time through the real-time stream processing monitoring system. The dynamic threshold of performance warning is adjusted according to the real-time performance and historical data of the system.

[0152] After the blue-green deployment is completed, the early warning system performs anomaly detection on the real-time performance data based on the performance warning threshold, so that the system can accurately identify when a warning or error is issued. After the performance warning threshold is triggered, the automatic problem handling process triggered by the early warning is implemented, including expanding resources or restarting services, realizing automatic tuning, and automatically adjusting the system configuration. The present invention discloses an automatic monitoring and optimization system for application performance, which is a distributed monitoring system. In the distributed monitoring system, the distributed system deploys monitoring tool software, such as Prometheus. The monitoring tool should be able to be expanded to monitor more nodes and services.

[0153] The system also monitors the configuration of real-time stream processing, including configuring a stream processing system, including configuring a data stream platform and components for performing stream processing, so as to analyze and monitor performance data in real time.

[0154] During the stable operation of the system, performance data is collected based on the stream processing system to establish a performance baseline, and the baseline data covers the performance data involved in all key performance indicators. The baseline data is collected during the non-test operation period of the system, and the baseline data covers all key performance indicators.

[0155] Also, perform performance testing in the system's blue-green deployment environment. After receiving a request for blue-green deployment, use historical data analysis to predict the off-peak period and perform performance testing during this period to reduce the impact on users.

[0156] During the blue-green deployment, high-load testing is performed and the test results are compared with the performance baseline to evaluate the performance changes of the new version. During the above process, the performance data is analyzed in real time through the real-time stream processing monitoring system. The dynamic threshold of performance warning is adjusted according to the real-time performance and historical data of the system.

[0157] After the blue-green deployment is completed, the early warning system detects anomalies in real-time performance data based on the performance warning threshold, so that the system can accurately identify when a warning or error is issued. After the dynamic threshold is triggered, the automatic problem handling process triggered by the early warning is realized, including expanding resources or restarting services, realizing automatic tuning, and automatically adjusting system configuration.

[0158] Traditional monitoring systems may require manual configuration and updates, and cannot be easily expanded to cover more nodes and services. The present invention provides an automated solution that can automatically expand and adapt to dynamically changing distributed system structures. In distributed systems, real-time collection and analysis of performance data is crucial to timely discovery and resolution of problems. In a blue-green deployment environment, it is necessary to evaluate the performance difference between the new version and the old version while minimizing the impact on end users. The present invention performs performance testing by using historical data to predict off-peak periods. The present invention adjusts dynamic thresholds by combining the performance and historical data during blue-green deployment. In one embodiment, in the distributed system, Prometheus monitoring tool software is deployed to achieve real-time monitoring and data collection of system performance. Prometheus is an open source system monitoring and alert toolkit that collects and stores various indicators that occur at runtime.

[0159] Install the Prometheus server on some nodes of the monitoring system and configure Prometheus to discover the monitored services and nodes.

[0160] For each service or node that needs to be monitored, deploy the corresponding exporter or agent. Exporters are software specifically designed to expose metrics for specific services such as databases, hardware, or other software services.

[0161] For large-scale systems, use the federation feature of Prometheus to collect monitoring data from multiple Prometheus instances.

[0162] For automatic node discovery, use Prometheus' built-in service discovery mechanism. The following are service discovery configuration examples for different environments:

[0163] Kubernetes: Prometheus can use the Kubernetes API to automatically discover new nodes in the cluster.

[0164] Consul: Prometheus can query Consul's service directory to discover newly registered nodes.

[0165] AWS EC2: Prometheus can automatically discover new instances in AWS environments using the EC2 API.

[0166] These service discovery mechanisms are usually set in the Prometheus configuration file prometheus.yml.

[0167] Service updates or additions require stricter control processes. When new services are added or updated, ensure that service changes comply with security standards during service deployment and updates.

[0168] The discovery of new services is a controlled service discovery process because it needs to be performed after receiving notification.

[0169] Use HTTP interface or message queue interface to receive notification of new service. The notification of new service is sent after the dynamic threshold of performance warning adjustment is determined to be completed. When a new service is deployed, notification is actively sent to the above interface through CI / CD pipeline or service orchestration tool.

[0170] When the Prometheus interface receives a notification of a new service, an automated script or service is triggered to update the Prometheus configuration file prometheus.yml and add a new crawling target.

[0171] Prometheus supports reloading its configuration file at runtime, which can be achieved by sending a HUP signal to Prometheus, or calling its HTTP API to trigger a reload.

[0172] Automate configuration changes and deployments.

[0173] When the new service is deployed, the currently active service information is recorded in the maintained central service directory. The notification of the new service will update this directory and be read by the monitoring system to update the monitoring target. The central service directory records the service ID, update time and dynamic threshold of performance warning of the new service.

[0174] The present invention uses the powerful automatic service discovery capability of Prometheus and the monitoring system that can control the triggering time of new service discovery. This method provides a good balance for maintaining the stability and security of the system.

[0175] In one embodiment, Apache Kafka is used as a data stream platform, and Apache Flink or Spark Streaming is used as a stream processing engine to build a stream processing technology stack.

[0176] Apache Kafka is a distributed stream processing platform that can efficiently process high-throughput data streams. Kafka can be used as a message queue, log aggregation, event source, and real-time stream processing.

[0177] Apache Flink and Spark Streaming are both big data stream processing frameworks for real-time or near real-time data processing. They can connect to Kafka to consume data, perform complex event processing, and output results.

[0178] Design and create Kafka topics for configuration updates. Implement the Kafka producer afterwards, including implementing a hook or service in the deployment pipeline that sends configuration updates as messages to Kafka.

[0179] For real-time monitoring of application performance, set up stream processing jobs, write Flink / Spark jobs to consume configuration update messages, process these messages, and update monitoring configurations as needed. Implement configuration updates, including calling Prometheus API to reload or update configurations after the stream processing job processes the configuration update message.

[0180] Finally, deployment and monitoring include deploying stream processing applications, monitoring the performance and status of deployed applications at runtime, and collecting and storing performance data.

[0181] In a certain embodiment, performance data is collected based on the stream processing system during stable operation of the system to establish a performance baseline, which is a benchmark for performance comparison and anomaly detection.

[0182] The baseline data should be collected during the normal operation period of the system, and the baseline data covers the performance data involved in all key performance indicators.

[0183] In the high-load test of the blue-green deployment, test data is collected, and the dynamic threshold of the performance warning is determined based on the test data. The performance indicators include at least response time, throughput (TPS), CPU usage and memory usage. The performance indicators are key performance indicators.

[0184] In one embodiment, the baseline data and the test data follow the same data model and have a unified data format, which can simplify the query and analysis process.

[0185] And, store baseline data and test data in different tables for easier management and querying.

[0186] Also, add indexes to query category columns (timestamp, indicator name) to improve query efficiency.

[0187] In one embodiment, baseline_metrics is used to store baseline data, and test_metrics is used to store test data.

[0188] In one embodiment, after receiving the blue-green deployment request, the baseline data of the corresponding service type in the database is determined, and a prediction of the off-peak period is performed.

[0189] In one embodiment, the prediction of off-peak periods is made based on transaction throughput (requests per second) and / or system CPU usage.

[0190] In a certain embodiment, when the prediction of the off-peak period is performed based on the transaction throughput (number of requests per second) or the system CPU usage, it includes:

[0191] Step S1: Collect the number of requests per second (TPS) and CPU usage data within a certain period of time. Perform time series decomposition on each individual time series (TPS and CPU usage) to identify and model seasonal, trend, and cyclic components. This can be done by using classic decomposition methods, such as seasonal and trend decomposition using the Loess (STL) method. In R language, the stl() function can be used for time series decomposition. For each time series Y t , perform time series decomposition to identify trends T t , Seasonality t and the random component R t : Y t =S t +T t +R t .

[0192] For seasonal decomposition, STL is a flexible approach that uses local regression to estimate both the trend and seasonal components. This approach allows for variations in the seasonal component and can handle any type of seasonality, not just fixed-frequency seasonality.

[0193] in,

[0194]

[0195] in,

[0196] T t : represents the trend component at time point t. w_n: represents the window size of the moving average used to calculate the trend, which is equal to 2k+1, where k is the span on one side of the moving average window. ∑: represents the summation symbol, which is used to accumulate all values ​​of a sequence.

[0197] i: is the index of the summation symbol, which traverses from -k to +k in the formula to ensure that the window covers a total of n time points before and after t.

[0198] Y t+i : represents the original observation value of the time series at time t+i.

[0199] S t+i : represents the seasonal component at time point t+i.

[0200] Y t+i -S t+i : This part removes the seasonal effect from the original data in order to estimate the trend component more accurately.

[0201] The random components are:

[0202] R t =Y t -S t -T t .

[0203] Step S2: Check the random components after decomposition. The present invention determines the stationarity of the sequence based on the ADF test. The detection equation can be expressed as:

[0204]

[0205] The meaning of each parameter is as follows:

[0206] ΔR t : represents the first-order difference of the random component at time t, that is, R t -R t-1 .

[0207] α: is the intercept term or constant term in the model.

[0208] β: is the coefficient of the time trend term, reflecting the random component R t Linear trend over time.

[0209] t: is the time index of the time series.

[0210] γ: is R t-1 , which is the coefficient of the random component lagged by one period, is used to test R t Is there a unit root?

[0211] YesR t The accumulation of p-order lagged difference terms, where is the coefficient of the ith lagged difference.

[0212] ε t : is the error term, representing the unobservable random disturbance in the model. It is usually assumed that ε t It follows a normal distribution with zero mean and constant variance.

[0213] Step S3: Building the model

[0214] In confirming R t After the series is stationary, the model is used to analyze R t Modeling.

[0215] R t =c+φ1R t-1 +φ2R t-2 +...+φ p R t-p +θ1ε t-1+θ2ε t-2 +...+θ q ε t-q +ε t ,

[0216] in,

[0217] c: intercept term, representing the long-term mean of the time series.

[0218] These are the parameters of the autoregressive part, which measure R t The relationship between the current value of and its p past values.

[0219] R t-1 ,R t-2 ,…,R t-p :These are R t Past values ​​of , lagged 1 to p periods.

[0220] θ1,θ2,…,θ q : These are the parameters of the moving average part, which measure the error term ε t-1 ,ε t-2 ,…,ε t-q For the current value R t impact.

[0221] ε t-1 ,ε t-2 ,…,ε t-q : These are the R t The past q error terms of .

[0222] ε t : is the error term at time t, representing unpredictable random shocks.

[0223] Before modeling, you need to determine the order of the autoregressive part and the moving average part, i.e., p and q. This can be done by looking at the autocorrelation function (ACF) and the partial autocorrelation function (PACF).

[0224] Autocorrelation function (ACF): measures the correlation between a time series and its own past values, and will show a tail.

[0225] Partial Autocorrelation Function (PACF): measures the correlation between a time series and its own past values, but excluding the influence of intermediate values, PACF will also show tailing. With the estimated values ​​of p and q, you can use maximum likelihood estimation or other methods to estimate the parameters: c, and θ1,θ2,…,θ q .

[0226] Step S4: Residual autocorrelation test

[0227] After the parameter estimation is completed, the model needs to be tested to confirm whether the model can adequately fit the data. This includes checking whether the residual sequence exhibits the characteristics of white noise, that is, there is no autocorrelation between the residuals. The residuals of the model are tested for autocorrelation. If the test shows that there is autocorrelation in the residuals, the model needs to be adjusted. The statistic is expressed as:

[0228]

[0229] in,

[0230] n represents the sample size, that is, the length of the time series.

[0231] h is the number of lags used in the test and is set in advance to be large enough to capture evidence of residual correlation.

[0232] is the sample autocorrelation coefficient of the time series residual at lag k.

[0233] Q is the test statistic, and its distribution, under the null hypothesis, approximately follows a chi-square distribution with hm degrees of freedom, where m is the number of estimated parameters in the model.

[0234]

[0235] in,

[0236] is the sample autocorrelation coefficient at lag k.

[0237] ε t is the residual value at time t.

[0238] is the mean of the residual sequence.

[0239] n is the sample size, i.e. the length of the time series.

[0240] t is the time index, t=1,2,…,n.

[0241] For each parameter:

[0242] Residual value ε t : This is the observed residual at time point t, i.e. the difference between the actual observed value and the value estimated by the model.

[0243] Residual mean This is the residual sequence ε t The mean value of is used to center the residual data.

[0244] Sample size n: This is the total number of observations in the time series.

[0245] Time index t: This is an index pointing to a specific point in time.

[0246] Sample autocorrelation coefficient It is used to measure the linear correlation between the values ​​of the residual sequence at two different time points (k periods apart). This coefficient ranges from -1 to +1, where +1 indicates a perfect positive correlation, -1 indicates a perfect negative correlation, and 0 indicates no correlation. To ensure the accuracy of the results, the model should usually be fitted to the data before calculating the sample autocorrelation coefficient in order to calculate the residual ε t When performing the Q test, Used to evaluate the correlation of the residual series at different lags k. If the residual series is white noise, it is expected that all will be close to zero.

[0247] The purpose of the Q test is to test whether the overall autocorrelation of a series of residuals (or another observation series) is equal to zero. This test is used to check whether there is evidence of lagged correlation in the residuals, which usually indicates that the model fails to capture some predictable components in the data. If there is autocorrelation in the residual series, then the model may not be making full use of the available information, which will affect the predictive ability of the model. A good time series model should be able to extract the signal in the data so that the residuals are as close to white noise as possible. If the residuals are not white noise, then the model may need to include additional lags, or a different type of time series model may need to be used.

[0248] Therefore, if the test indicates that there is autocorrelation in the residuals, it is necessary to re-perform the time series decomposition in step 1 to identify the trend T t , Seasonality t and the random component R t .

[0249] Step S5, model prediction

[0250] Use the established model to analyze the random component R t Make a forecast and then add the decomposed trend T t , seasonal component S t , to predict the original sequence Y t The future value of .

[0251] Predicting future values ​​usually involves model parameters and past observations. The prediction of future values ​​can be expressed as:

[0252]

[0253] in,

[0254] Represents the time series R tThe predicted value at time point t+1.

[0255] is the intercept of the model, The value of is equal to the intercept term c.

[0256] are the parameter estimates of the autoregressive part, which measure the R t The linear dependence between the current value and its previous p past values ​​in . Its value is correspondingly equal to

[0257] R t ,R t-1 ,…,R t-p+1 are the observations at time t, t-1, …, t-p+1.

[0258] are the parameter estimates of the moving average part, which measure the model residual ε t The impact on the current prediction value. Its value is correspondingly equal to θ1, θ2, …, θ q .

[0259] ε t ,ε t-1 ,…,ε t-q+1 is the model residual at time t, t-1, …, t-q+1, that is, the error between the previous predicted value and the actual observed value. Its value is correspondingly equal to ε t-1 ,ε t-2 ,…,ε t-q .

[0260] For the above model, Represents the time series R t The predicted value at time point t+1. This prediction is based on two main parts:

[0261] 1. Autoregression (AR) part: consider the impact of p past observations on the current forecast value.

[0262] 2. Moving average (MA) part: consider the impact of q past residuals on the current forecast value.

[0263] The calculation of involves weighted averaging of the historical information of the model (including historical observations and historical forecast errors), where the weights are given by and Given. In this way, the autocorrelation and moving average characteristics of time series data are captured to provide forecasts for future time points.

[0264] The stochastic component of the forecast is then combined with the seasonal and trend components:

[0265]

[0266] in,

[0267] The forecast value of the seasonal component; this component captures the periodic fluctuations in the time series. This component is usually estimated by using known periodic patterns on historical data, so that in the model, the future seasonal component It is predicted by the corresponding seasonal component in the historical data.

[0268] The forecast value of the trend component; this component represents the long-term trend of the time series, which may be rising or falling. This trend component can be used to predict future trends by estimating the trend of historical data

[0269] The predicted value of the random component.

[0270] In seasonal decomposition models, the future values ​​of the seasonal component and the trend component are usually predicted based on the patterns and properties of these components in the historical data, that is, the two random components can be determined after seasonal decomposition. The prediction is made by building a statistical model.

[0271] Step S6: Determination of off-peak hours

[0272] Analyze the forecast results and combine business logic to determine the off-peak period of the system. Value to set.

[0273] Specifically, through the predicted The value of all trough points in the future preset time period. The average of the values ​​is used as the low peak threshold.

[0274] It is determined whether there is a continuous time period L within the future preset time period that is below the low-peak threshold. If yes, the continuous time period L is regarded as the low-peak period.

[0275] If there are multiple consecutive time periods below the low-peak threshold, the longest time period is selected as the low-peak period.

[0276] Otherwise, adjust the low peak threshold, for example, increase it by 10%, and repeat the above determination.

[0277] In a certain embodiment, when predicting the off-peak period based on the transaction throughput (number of requests per second) and the system CPU usage, it includes:

[0278] Step P1, collect two time series data: number of requests per second (TPS) and CPU usage.

[0279] Here t represents the time index.

[0280] Step P2: Model building and estimation

[0281] For the above time series, the following model is constructed. Assuming that p represents the lag order, the model can be expressed as:

[0282]

[0283] A t-i is a 2×2 coefficient matrix, which is the coefficient matrix of the model corresponding to the time ti. c is a 2×1 vector containing constant terms.

[0284] ∈ TPS,t and ∈ CPU,t is the error term.

[0285] To obtain an estimate of the A matrix, the number of lags p needs to be determined. This can be done using information criteria such as the Akaike Information Criterion (AIC), the Bayesian Information Criterion (BIC), or the Hannan-Quinn Criterion (HQIC).

[0286] The parameters of the model are estimated using the least squares method (OLS). For each equation, a multiple regression is performed. After the model parameters are estimated, a model diagnostic test is performed and the model structure is adjusted based on the results of the model test, including changing the lag order or transforming the data.

[0287] Step P3, to detect the error terms of different equations ∈ TPS,t and ∈ CPU,t The correlation between the two series is calculated. This can be calculated by estimating the model and obtaining the residuals using the following formula:

[0288]

[0289] in:

[0290] ρ(∈ TPS ,∈ CPU ) is the sample correlation coefficient between the two error series.

[0291] ∈ TPS,t and ∈ CPU,t are ∈ at time t TPS and ∈ CPU The value of .

[0292] and They are ∈TPS and ∈ CPU The sample mean of .

[0293] T is the number of observations.

[0294] Step P4, construct an error correlation matrix, which contains the correlation coefficients between different error terms. For the model, the error correlation matrix is ​​a 2×2 matrix, which contains ∈ TPS,t and ∈ CPU,t The elements on the diagonal of the error correlation matrix are the autocorrelation coefficients of their respective error terms, while the elements on the off-diagonal are the correlation coefficients between two different error terms.

[0295] Here is the form of the error correlation matrix: Where ρ(∈ TPS ,∈ CPU ) is∈ TPS and ∈ CPU The sample correlation coefficient between .

[0296] In this matrix:

[0297] The diagonal elements are set to 1, which represents the correlation coefficient of each error term with itself (autocorrelation), which is always equal to 1 because any term is always perfectly positively correlated with itself.

[0298] The off-diagonal elements ρ(∈ TPS,t ,∈ CPU,t ) is the time point t∈ TPS,t (error term of the transaction processing system) and ∈ CPU,t The sample correlation coefficient r between the (error terms of CPU usage). This indicates whether changes in one error term are correlated with changes in another error term in the model.

[0299] In multivariate time series analysis, if there is a significant non-zero correlation between error terms, this may indicate that there are omitted variables in the model or that the model structure needs to be adjusted. TPS,t ,∈ CPU ,t) to conduct a hypothesis test to determine whether the correlation is statistically significant. If the correlation coefficient is significantly different from 0, then this means that there is a statistically significant correlation between the two error terms.

[0300] To test whether the error terms are significantly correlated, use the z-transformation. The z-transformation can be used to transform the distribution of the correlation coefficient to a close normal distribution and perform hypothesis testing on the correlation coefficient. The z-transformation of the correlation coefficient is defined as:

[0301]

[0302] Where r is the sample correlation coefficient and z is the transformed value.

[0303] For the sample correlation coefficient r, its z-transformed variance is approximately Where n is the sample size. This can be used to construct confidence intervals or perform hypothesis testing.

[0304] If we find ρ(∈ TPS ,∈ CPU ) is significantly different from zero (i.e., there is a significant correlation between the error terms), then this indicates that there may be some omitted dynamic relationships in the model, causing the error terms to influence each other. In this case, re-evaluate the parameter settings of the model, including changing the lag order or transforming the data.

[0305] Step P5, model prediction

[0306] After estimating the model, the steps for making a one-step prediction are as follows:

[0307] Y t is a vector of two variables, First, to simplify the explanation, assume that the lag of the model is 1, that is, the first-order model has been estimated, that is, it contains one lag: Y t =c+Φ1Y t-1 +∈ t .

[0308] Among them, Φ0 is the constant term vector, Φ1 is the coefficient matrix specifically corresponding to A t-1 Matrix,∈ t is the error vector.

[0309] Given the last observation Y t-1 , the one-step prediction will be: here, is the predicted value at time point t, and the hats on the coefficients indicate that they are estimates. For forecasts further out, the predicted values ​​of the model are recursively used to predict the values ​​at the next time point. For example, a two-step forecast One-step forecast will be used Although it is extended to multi-step prediction, the uncertainty of the prediction usually increases with the increase of the number of prediction steps. Therefore, it is necessary to set a finite prediction time.

[0310] Step P6, determine the off-peak period

[0311] Analyze the forecast results and combine business logic to determine the off-peak period of the system. Value to set.

[0312] Specifically, through the predicted The Y values ​​corresponding to all the trough points in the preset time period in the future aret The average of the values ​​is used as the low peak threshold.

[0313] It is determined whether there is a continuous time period L within the future preset time period that is below the low-peak threshold. If yes, the continuous time period L is regarded as the low-peak period.

[0314] If there are multiple consecutive time periods below the low-peak threshold, the longest time period is selected as the low-peak period.

[0315] Otherwise, adjust the low peak threshold, for example, increase it by 10%, and repeat the above determination.

[0316] In one embodiment, when there is a high correlation between transaction throughput and CPU usage, the prediction of the low peak period is selected based on the transaction throughput (number of requests per second) or the system CPU usage. When there is no high correlation between transaction throughput and CPU usage, the prediction of the low peak period is selected based on the transaction throughput (number of requests per second) and the system CPU usage.

[0317] In one embodiment, whether there is a high correlation between the transaction throughput and the CPU usage is determined based on a monotonic relationship between the two variables.

[0318] Alternatively, based on the Spearman rank correlation coefficient, which is a non-parametric correlation measure used to evaluate the monotonic relationship between two variables, the calculation formula of the Spearman rank correlation coefficient is as follows:

[0319]

[0320] in:

[0321] r s is the Spearman rank correlation coefficient, which has a value between -1 and 1.

[0322] d i is the rank difference (TPS) of each observation pair t and CPU t level difference).

[0323] n is the number of observation pairs.

[0324] The meaning of the Spearman correlation coefficient is as follows:

[0325] -r s =1: perfect positive monotonic relationship.

[0326] -r s >0: positive monotonic relationship.

[0327] -r s =0: No monotonic relationship.

[0328] -r s <0: negative monotonic relationship.

[0329] -r s =-1: perfect negative monotonic relationship.

[0330] Determine whether there is a high correlation between the transaction throughput and the CPU usage based on the monotonic relationship between the two variables, including when the Spearman correlation coefficient is greater than or equal to a preset threshold (e.g., 0.7), determine that there is a high correlation between the transaction throughput and the CPU usage.

[0331] In order to calculate the Spearman rank correlation coefficient, the observed values ​​of each variable must first be sorted and assigned a rank. If two or more values ​​are the same (i.e., there is a "tie"), the average rank is assigned to these values.

[0332] To calculate the rank difference for each pair of observations, first for each set of data - in this case, TPS t and CPU t - Assign grades respectively. The steps of grade assignment can be carried out as follows:

[0333] Each data set (TPS t and CPU t ) are sorted according to the size of the value.

[0334] Each value in the sorted order is assigned a rank, with the smallest value being assigned rank 1, the next smallest being assigned rank 2, and so on. If there are identical values ​​(i.e. ties), the values ​​are assigned the average of their ranks.

[0335] Once a rank has been assigned to each value in both data sets, the difference in rank between the two can be calculated.

[0336] The formula for calculating the grade difference is:

[0337] in:

[0338] d i is the rank difference of the i-th pair of observations.

[0339] is the time point t i TPS t level.

[0340] is the time point t i CPU t level.

[0341] For example, if at time t i , TPSt The value of is ranked third in its dataset, while CPU t The value of is ranked fifth in its data set, so the rank difference d i That is 3-5=-2. Calculate each pair of observations (TPS t ,CPU t ) i , and then for each square of the difference Finally, substitute the sum into the formula to calculate r s .

[0342] Determine whether there is a high correlation between the transaction throughput and the CPU usage rate based on the monotonic relationship between the two variables, including when the Spearman correlation coefficient is greater than or equal to 0.7, determine that there is a high correlation between the transaction throughput and the CPU usage rate, and select to predict the low peak period based on the transaction throughput (number of requests per second) or the system CPU usage rate. Otherwise, select to predict the low peak period based on the transaction throughput (number of requests per second) and the system CPU usage rate.

[0343] In one embodiment, blue-green deployment is a software release mode that can reduce or eliminate downtime and risk by running two production environments (one blue and one green) at the same time. When a new version needs to be released, only the traffic needs to be switched from the old version (blue) to the new version (green). This mode is particularly suitable for scenarios that require high availability and fast rollback.

[0344] Perform high-load testing while performing blue-green deployments to evaluate the performance of the new version under high load without affecting existing users.

[0345] After determining the off-peak period, a test environment is set up during the off-peak period and a new version of the software is deployed.

[0346] Define a performance baseline, which is the expected performance indicators of the system under a known load. These indicators can be determined from historical performance data, and the baseline is determined based on the historical performance data of the current production environment (blue environment).

[0347] Perform high-load tests on the newly deployed environment (green environment) to simulate real user behavior and traffic patterns and generate enough load to evaluate performance. The test load is based on the prediction of off-peak hours. The highest value among the values ​​is determined.

[0348] Monitoring and data collection, using a real-time stream processing monitoring system to collect performance indicators, the performance indicators at least include response time, throughput (TPS), CPU usage and memory usage.

[0349] Analyze performance data, compare the collected performance data with the established performance baseline, and evaluate the performance of the new version under high load. Dynamically adjust the performance warning threshold based on the collected performance data in the green environment test and the established performance baseline.

[0350] The pre-set performance thresholds mean that when the performance indicators exceed these thresholds, the system will issue a warning. The pre-set performance thresholds are set based on historical performance data and business requirements. Optionally, the historical performance data setting is the performance data collected during the actual operation of the previous version of the software before the current version is updated.

[0351] The preset performance threshold is set based on historical performance data and the stability requirements of the business.

[0352] BL I =α·μ I +(1-α)·σ I

[0353] In a certain embodiment, the formula based on the comprehensive performance baseline includes historical performance data parameters based on response time RT, transactions per second TPS, CPU usage CPU and memory usage MEM.

[0354] Among them, determining the comprehensive performance baseline includes:

[0355] Define a baseline for each metric: BL I =α·μ I +(1-α)·σ I ,

[0356] in,

[0357] BL I It is the baseline of indicator I.

[0358] α is a weighting factor used to balance the impact of historical mean and standard deviation.

[0359] μ I is the historical average of indicator I.

[0360] σ I is the historical standard deviation of indicator I.

[0361] The baselines for all metrics are then combined into a single performance baseline score:

[0362] BL score =w RT BL RT +w TPS BL TPS +w CPU BL CPU+w MEM BL MEM ,

[0363] where w RT ,w TPS ,w CPU ,w MEM is the weight corresponding to the four indicators of response time RT, transactions per second TPS, CPU usage CPU and memory usage MEM, and satisfies w RT +w TPS +w CPU +w MEM =1.

[0364] In one embodiment, a high load test is performed, wherein the test load is based on the prediction of the off-peak period. The test load determination takes into account the smaller of the highest load value predicted during off-peak hours and the availability of test environment resources:

[0365]

[0366] in:

[0367] Load test is a determined test load.

[0368] is the highest load value predicted during the off-peak period.

[0369] R available is the amount of resources available at test time.

[0370] In one embodiment, the performance data is analyzed, and the collected performance data is compared with the established performance baseline to evaluate the performance of the new version under high load. The performance warning threshold is dynamically adjusted based on the collected performance data in the green environment test and the established performance baseline, including determining the adjusted performance warning threshold based on the following model:

[0371] Threshold new =BL score + k·(V current -BL score )+f(Trends score ,Volatility score ),

[0372] V current =w RT ·RT current +w TPS TPS current +w CPU CPU current +wMEM MEM current ,

[0373]

[0374] Trends score =w RT Trend RT +w TPS Trend TPS +w CPU Trend CPU +w MEM Trend MEM ,

[0375]

[0376] Volatility score =w RT Volatility RT +w TPS Volatility TPS +w CPU Volatility CPU +w MEM Volatility MEM ,

[0377] Volatility RT =σ(RT observations ),

[0378] Volatility TPS =σ(TPS observations ),

[0379] Volatility CPU =σ(CPU observations ),

[0380] Volatility MEM =σ(MEM observations ),

[0381] in,

[0382] Threshold new is the new comprehensive performance warning threshold. BL score is the comprehensive performance baseline score, which is the weighted sum of the four baseline parameters. current is the current comprehensive performance value, which is also the weighted sum of the four real-time performance parameters. k is the adjustment factor, which determines the sensitivity of baseline changes. is a function that gives an adjustment value based on the trend and volatility of the comprehensive performance score.current : The current comprehensive performance value is a comprehensive indicator calculated based on the current actual performance data and is used to compare with the baseline performance value BL score

[0383] Compare to evaluate current system performance status. RT : The weight of the response time, which reflects the relative importance of the response time (RT) when calculating the comprehensive performance value. RT current : Current response time, which is the current average response time indicator of the system, and it indicates the average time required for the system to respond to user requests. TPS : The weight of the number of transactions per second, which reflects the relative importance of the number of transactions per second (TPS) when calculating the comprehensive performance value. TPS current : Current number of transactions per second, which is the number of transactions currently processed by the system per second, and it indicates the processing capacity of the system. CPU : The weight of CPU usage, which reflects the relative importance of CPU usage when calculating the comprehensive performance value. current : Current CPU usage, which is the current CPU load of the system, and it indicates the usage of CPU resources. MEM : The weight of memory usage, which reflects the relative importance of memory usage (MEM) when calculating the comprehensive performance value. MEM current : Current memory usage, which is the current memory load of the system, and it indicates the usage of memory resources. γ is the trend impact coefficient, which determines the impact of the trend on the adjustment value. λ is the trend sensitivity coefficient, which amplifies or reduces the trend score The impact on the tanh function. δ is the volatility impact coefficient, which determines the impact of volatility on the adjusted value. score is the trend threshold. When the comprehensive trend indicator exceeds this threshold, different adjustment methods will be used. score It is a comprehensive trend indicator, which is a comprehensive trend expression based on the weighted sum of the trends of four performance indicators. score It is a comprehensive volatility index, which is based on the weighted and comprehensive volatility expression of the volatility of four performance indicators. Respectively represent the average response time, number of transactions, CPU usage, and memory usage in the current time window, and and represents the corresponding mean value of the previous time window. σ represents the standard deviation, RT observations1 TPS observations1 CPU observations1 and MEM observations Represent the observation value sequences of response time, number of transactions, CPU usage and memory usage within the time window respectively.

[0384] In one embodiment, the system performance is monitored in real time, including the old and new versions in the blue-green deployment. The monitoring tool collects performance indicator data, calculates it through the model, and compares it with the preset performance alarm threshold.

[0385] When the monitored performance data exceeds the threshold, the early warning system will identify this as an abnormality. Once an abnormality is detected, the early warning system will trigger an alert. This can include sending a notification to the system administrator or automatically triggering the problem handling process.

[0386] According to the content of the early warning, the following automated problem handling process can be implemented:

[0387] Resource expansion: Automated processes can expand resources, such as adding more servers or service instances.

[0388] Restart service: The automated process can attempt to restart the service.

[0389] Automated tuning: Automated processes can adjust system configurations, such as modifying database indexes or adjusting caching strategies.

[0390] The present invention reduces the risk of system failures through automatic monitoring and problem handling, and improves the overall reliability of the system. It improves resource utilization efficiency by predicting off-peak periods and performing deployment and testing during off-peak periods. It sets thresholds for operation and maintenance based on test performance, reduces the need for manual intervention, reduces operation and maintenance costs, and improves operation and maintenance efficiency.

[0391] It should be noted that the computer-readable medium disclosed above 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 disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, 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 suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.

[0392] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.

[0393] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages, or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).

[0394] 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 disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square 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 square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / 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.

[0395] The units involved in the embodiments described in the present disclosure may be implemented by software or hardware, wherein the name of a unit does not, in some cases, limit the unit itself.

[0396] The above introduces the preferred embodiments of the present invention, which is intended to make the spirit of the present invention clearer and easier to understand, but is not intended to limit the present invention. All modifications, substitutions, and improvements made within the spirit and principles of the present invention should be included in the scope of protection outlined by the claims attached to the present invention.

Claims

1. A method for automatically monitoring and optimizing application performance, the method comprising: Collect performance data based on the stream processing system during stable system operation to establish a performance baseline; Also, perform performance testing in the blue-green deployment environment of the system. After receiving a request for blue-green deployment, use historical performance data analysis to predict off-peak hours; Performance testing during the off-peak hours, including: During the blue-green deployment, high-load testing is performed, the test results are compared with the performance baseline, and the dynamic thresholds of performance warnings are adjusted; After the blue-green deployment is completed, the early warning system detects anomalies in real-time performance data based on performance warning thresholds; After the performance warning threshold is triggered, automatic problem handling is realized for early warning triggering; Wherein, using historical performance data analysis to predict off-peak periods, including predicting off-peak periods based on throughput and / or system CPU usage; Wherein, determining whether there is a high correlation between the throughput and the CPU usage rate based on the monotonic relationship between the two variables; Determine whether there is a high correlation between the throughput and the CPU usage based on the monotonic relationship between the two variables, including when the Spearman correlation coefficient is greater than or equal to 0.7, determine that there is a high correlation between the transaction throughput and the CPU usage, and select to predict the low peak period based on the throughput or the system CPU usage; Otherwise, select the off-peak period prediction based on throughput and system CPU usage. When the off-peak period prediction is based on throughput and system CPU usage, it includes: Step P1, collect two time series data: number of requests per second (TPS) and CPU usage; Here t represents the time index; Step P2: Model establishment and estimation; For the above time series, the following model is constructed; assuming that p represents the lag order, the model can be expressed as: A t-i is a 2×2 coefficient matrix, which is the coefficient matrix of the model corresponding to the time ti; c is a 2×1 vector containing a constant term; ∈ TPS,t and ∈ CPU,t is the error term; Step P3, to detect the error terms of different equations ∈ TPS,t and ∈ CPU,t The correlation between the two series is calculated; this can be calculated by estimating the model and obtaining the residuals using the following formula: in: ρ(∈ TPS ,∈ CPU ) is the sample correlation coefficient between the two error series; ∈ TPS,t and ∈ CPU,t are ∈ at time t TPS and ∈ CPU The value of and They are ∈ TPS and ∈ CPU The sample mean of ; T is the number of observations; Step P4, construct an error correlation matrix, which contains the correlation coefficients between different error terms; for the model, the error correlation matrix is ​​a 2×2 matrix, which contains ∈ TPS,t and ∈ CPU,t The elements on the diagonal of the error correlation matrix are the autocorrelation coefficients of their respective error terms, while the elements on the off-diagonal are the correlation coefficients between two different error terms. Here is the form of the error correlation matrix: Where ρ(∈ TPS ,∈ CPU ) is∈ TPS and ∈ CPU The sample correlation coefficient between ; In this matrix: The diagonal elements are set to 1, and the off-diagonal elements ρ(∈ TPS,t ,∈ CPU,t ) is the time point t∈ TPS,t and ∈ CPU,t The sample correlation coefficient r between them; The correlation coefficient ρ(∈ TPS,t ,∈ CPU ,t) Conduct a hypothesis test to determine whether the correlation is statistically significant; if the correlation coefficient is significantly different from 0, then there is a statistically significant correlation between the two error terms; To test whether the error terms are significantly correlated, use the z-transformation; the z-transformation can be used to transform the distribution of the correlation coefficient to a close normal distribution and perform hypothesis testing on the correlation coefficient; the z-transformation of the correlation coefficient is defined as: Where r is the sample correlation coefficient and z is the transformed value; For the sample correlation coefficient r, its z-transformed variance is Where n is the sample size; used to construct confidence intervals or perform hypothesis testing; If we find ρ(∈ TPS ,∈ CPU ) is significantly different from zero, re-evaluate the parameter settings of the model, including changing the lag order; When predicting off-peak hours based on throughput and system CPU usage, it further includes: Step P5, model prediction After estimating the model, the steps for making a one-step prediction are as follows: Y t is a vector of two variables, Assume that the lag of the model is 1, that is, it contains one lag: Y t =c+Φ1Y t-1 +∈ t ; Among them, Φ0 is the constant term vector, Φ1 is the coefficient matrix specifically corresponding to A t-1 Matrix,∈ t is the error vector; Given the last observation Y t-1 , the one-step prediction will be: here, is the predicted value at time point t; For more predictions, recursively use the model's predicted values ​​to predict the value at the next time point. Set a finite length of prediction time; Step P6, determine the off-peak period Analyze the forecast results and combine business logic to determine the off-peak period of the system. Value to formulate; Through the predicted The value of all trough points in the future preset time period; the Y corresponding to all the trough points t The average of the values ​​was taken as the low peak threshold; Determine whether there is a continuous time period L below the low-peak threshold within the future preset time period; if yes, take the continuous time period L as the low-peak period; If there are multiple consecutive time periods below the low-peak threshold, the longest time period is selected as the low-peak period; Otherwise, adjust the low peak threshold, increase it by 10%, and repeat the above judgment.

2. The method for automatic monitoring and optimization of application performance according to claim 1, characterized in that: Performance data is collected to establish a performance baseline, where the baseline data covers performance data involved in all key performance indicators; the performance data includes at least response time, throughput, CPU usage, and memory usage.

3. The method for automatic monitoring and optimization of application performance according to claim 1, characterized in that: The discovery of new services is a controlled service discovery process because it needs to be performed after receiving notification.

4. The method for automatic monitoring and optimization of application performance according to claim 3, characterized in that: Using an HTTP interface or a message queue interface to receive a notification of a new service, wherein the notification of the new service is sent after determining that the dynamic threshold of the performance warning has been adjusted; When the new service is deployed, the currently active service information is recorded in the maintained central service directory. The notification of the new service will update this directory and be read by the monitoring system to update the monitoring target. The central service directory records the service ID, update time and dynamic threshold of performance warning of the new service.

5. The method for automatic monitoring and optimization of application performance according to claim 1, characterized in that: When making predictions for off-peak periods based on throughput or system CPU usage, include: Step S1: Collect the throughput data (i.e., the number of requests per second, TPS) and CPU usage data within a certain period of time; Perform time series decomposition on each individual time series to identify and model seasonality, trend, and cyclical components; For each time series Y t , perform time series decomposition to identify trends T t , Seasonality t and the random component R t : Y t =S t +T t +R t ; in, T t : represents the trend component at time point t; w_n: represents the window size of the moving average used to calculate the trend, which is equal to 2k+1, where k is the span on one side of the moving average window; ∑: represents the summation symbol, which is used to accumulate all values ​​of a sequence; i: is the index of the summation symbol, which traverses from -k to +k in the formula to ensure that the window covers a total of n time points before and after t; Y t+i : represents the original observation value of the time series at time t+i; S t+i : represents the seasonal component at time point t+i; Y t+i -S t+i : This part removes the seasonal effect from the original data in order to estimate the trend component more accurately; The random components are: R t =Y t -S t -T t ; Step S2: Check the random components after decomposition and determine the stationarity of the sequence based on the ADF test. The detection equation can be expressed as: The meaning of each parameter is as follows: ΔR t : represents the first-order difference of the random component at time t, that is, R t -R t-1 ; α: is the intercept term or constant term in the model; β: is the coefficient of the time trend term, reflecting the random component R t Linear trends over time; t: is the time index of the time series; γ: is R t-1 , which is the coefficient of the random component lagged by one period, is used to test R t Is there a unit root? YesR t The accumulation of p-order lagged difference terms, where is the coefficient of the ith lagged difference; ε t : is the error term, representing the unobservable random disturbance in the model. It is usually assumed that ε t It follows a normal distribution with zero mean and constant variance; Step S3: building a model; In confirming R t After the series is stationary, the model is used to analyze R t Conduct modeling; R t =c+φ1R t-1 +φ2R t-2 +...+φ p R t-p +θ1ε t-1 +θ2ε t-2 +...+θ q e t-q +e t , in, c: intercept term, representing the long-term mean of the time series; These are the parameters of the autoregressive part, which measure R t The relationship between the current value of and its p past values; R t-1 ,R t-2 ,…,R t-p :These are R t Past values ​​of , lagged 1 to p periods; θ1,θ2,…,θ q : These are the parameters of the moving average part, which measure the error term ε t-1 ,ε t-2 ,…,ε t-q For the current value R t The impact of ε t-1 ,ε t-2 ,…,ε t-q : These are the R t The past q error terms of ; ε t : is the error term at time t, representing the unpredictable random shock; Before modeling, it is necessary to determine the orders of the autoregressive part and the moving average part, i.e., p and q; With the estimated values ​​of p and q, we can use maximum likelihood estimation to estimate the parameters: c, and θ1,θ2,…,θ q ; Step S4: residual autocorrelation test; Check whether the residual sequence exhibits the characteristics of white noise, that is, there is no autocorrelation between the residuals; the statistic is expressed as: in, n represents the sample size, i.e. the length of the time series; h is the number of lags used in the test, which is predetermined and needs to be large enough to capture evidence of residual correlation; is the sample autocorrelation coefficient of the time series residual at lag k; Q is the test statistic, whose distribution, under the null hypothesis, approximately follows a chi-square distribution with hm degrees of freedom, where m is the number of parameters estimated in the model; in, is the sample autocorrelation coefficient at lag k; ε t is the residual value at time t; is the mean of the residual sequence; t is the time index, t = 1, 2, ..., n; If the test indicates that there is autocorrelation in the residuals, you need to re-perform the time series decomposition in step 1 to identify the trend T t , Seasonality t and the random component R t ; Step S5, model prediction; Use the established model to analyze the random component R t Make a forecast and then add the decomposed trend T t , seasonal component S t , to predict the original sequence Y t The future value of The prediction of future values ​​can be expressed as: in, Represents the time series R t The predicted value at time point t+1; is the intercept of the model, The value of is equal to the intercept term c; are the parameter estimates of the autoregressive part, which measure the R t The linear dependence between the current value and its previous p past values ​​in ; its value is correspondingly equal to R t ,R t-1 ,…,R t-p+1 are the observations at time t, t-1, …, t-p+1; are the parameter estimates of the moving average part, which measure the model residual ε t The impact on the current predicted value; its value is equal to θ1, θ2, …, θ q ; ε t ,ε t-1 ,…,ε t-q+1 is the model residual at time t, t-1, …, t-q+1, that is, the error between the previous predicted value and the actual observed value; its value is correspondingly equal to ε t-1 ,ε t-2 ,…,ε t-q ; The stochastic component of the forecast is then combined with the seasonal and trend components: in, The predicted value of the seasonal component; The predicted value of the trend component; predicted value of the random component; In seasonal decomposition models, future values ​​of the seasonal and trend components are usually predicted based on the patterns and properties of these components in historical data, i.e., the functions of these two components can be determined after seasonal decomposition; Step S6: Determination of off-peak hours Analyze the forecast results and combine business logic to determine the off-peak period of the system. Value to formulate; Specifically, through the predicted The value of all trough points in the future preset time period; the corresponding The average of the values ​​was taken as the low peak threshold; Determine whether there is a continuous time period L below the low-peak threshold within the future preset time period; if yes, take the continuous time period L as the low-peak period; If there are multiple consecutive time periods below the low-peak threshold, the longest time period is selected as the low-peak period; Otherwise, adjust the low peak threshold, increase it by 10%, and repeat the above judgment.

6. An automatic application performance monitoring and optimization system, the system comprising a memory and a processor, the memory storing a computer program, the processor being used to execute the computer program to implement the automatic application performance monitoring and optimization method of any one of claims 1-5.

Citation Information

Patent Citations

  • Abnormity detection early warning method and system

    CN110865929A

  • Automatic test monitoring method, device and equipment and storage medium

    CN111858352A

  • DCGW cluster alarm method and system

    CN113778805A

  • Intelligent alarm method, device and equipment for operation and maintenance monitoring data and medium

    CN114328118A

  • Method and corresponding system for implementing virtual network function performance monitoring

    EP3255916A1