Cloud resource intelligent monitoring alarm method, device, equipment, medium and program
By obtaining resource information in the Knative cluster and using the scoring model to predict the comprehensive health, it solves the accuracy, flexibility and timeliness problems of monitoring alarms in the existing technology, achieves more accurate and flexible resource management, and improves business stability. performance and efficiency of business activities.
Patent Information
- Application Number
- CN202410161982.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-05
- Publication Date
- 2024-10-22
AI Technical Summary
The existing Knative cluster monitoring and alarm technology has poor accuracy, poor flexibility, and poor timeliness. It cannot effectively monitor and process the resource utilization of nodes and businesses, causing business stability and operating activities to be affected.
By obtaining the resource information of the Knative cluster, we use the pre-trained scoring model to predict the comprehensive health of the application on the node, determine whether to issue an alarm based on the target score, and adjust resources based on the comprehensive health, combining the resource utilization of nodes and services. Rate information is weighted and summed to achieve more accurate and flexible alarms.
It improves the accuracy, flexibility and timeliness of monitoring alarms, can better handle resource health abnormalities, is applicable to all businesses and nodes, and reduces maintenance complexity and resource waste.
Smart Images

Figure CN118820001A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of cloud computing technology, and in particular, relates to a resource intelligent monitoring and alarm method, device, equipment, medium and program. Background Art
[0002] Knative is a Serverless framework based on Kubernetes, whose goal is to develop cloud-native, cross-platform Serverless orchestration standards. It provides a standardized, reusable way to build container images, reducing the time and cost of image building; it also implements dynamic workload scaling, can automatically manage the entire life cycle of workloads, and allows users to create traffic policies for multiple versions of applications, and implement functions such as blue-green release. In the cloud platform, effective monitoring alarms can monitor the abnormal status of deployed applications in Knative in the first place and promptly notify operations and developers to handle them, ensuring the continuous and stable operation of the business, and will also have a huge impact on the entire business activities of the enterprise.
[0003] In the existing Knative cluster, monitoring and alarm management usually collects application-related monitoring indicators and generates corresponding alarm information based on the alarm thresholds of the set monitoring indicators. This method only achieves a rough comparison between the collected monitoring indicators and the set alarm thresholds, and has poor accuracy. Moreover, the alarm thresholds of various monitoring indicators need to be configured based on previous business experience. If there are many businesses or nodes, multiple sets of alarm thresholds need to be configured, which is difficult to maintain and has poor flexibility. In addition, the existing monitoring alarms monitor the applications deployed in the cluster and the nodes in the cluster separately, and they are independent and maintained and processed by different personnel, which makes the alarm timeliness poor. Summary of the invention
[0004] The embodiments of the present application provide a cloud resource intelligent monitoring and alarm method, device, equipment, medium and program, which can improve the accuracy, flexibility and timeliness of monitoring and alarm.
[0005] In a first aspect, an embodiment of the present application provides a cloud resource intelligent monitoring and alarm method, comprising:
[0006] Obtain first resource information of the Knative cluster, where the first resource information includes first resource utilization information of a first node corresponding to the first application in the Knative cluster and second resource utilization information of a first business Pod corresponding to the first application in the first node;
[0007] Determine a first comprehensive health of the first application on the first node based on the first resource information;
[0008] A target score corresponding to the first comprehensive health is predicted using a pre-trained scoring model, where the target score is used to indicate the size relationship between the first comprehensive health and the first health threshold interval, where the scoring model is trained based on a first data set, where the first data set includes a plurality of first training samples with score labels, and each first training sample includes a historical comprehensive health applied to a node;
[0009] A determination is made based on the target score whether to issue an alarm to the first node.
[0010] As a possible implementation manner, determining a first comprehensive health of a first application on a first node based on the first resource information includes:
[0011] Determining a service type of the first application;
[0012] Acquire first weight information corresponding to the business type, the first weight information including an indicator weight corresponding to each indicator in the first resource information;
[0013] Determining a node health of the first node based on the first resource utilization information and an indicator weight corresponding to each indicator in the first resource utilization information;
[0014] Determining a service health of the first application on the first node based on the second resource utilization information and an indicator weight corresponding to each indicator in the second resource utilization information;
[0015] Obtain a first weight corresponding to the node health and a second weight corresponding to the business health;
[0016] A weighted sum of the node health and the service health is performed based on the first weight and the second weight to obtain a first comprehensive health of the first application on the first node.
[0017] As a possible implementation manner, determining the service type of the first application includes:
[0018] The business type of the first application is predicted based on a pre-trained classification model and the second resource utilization information, the classification model is trained based on a second data set, the second data set includes multiple second training samples with business type labels, and each second training sample includes historical resource utilization information of a business Pod applied on a node.
[0019] As a possible implementation manner, the first health threshold interval includes a first health threshold interval minimum value and a first health threshold interval maximum value, and determining whether to issue an alarm to the first node based on the target score includes:
[0020] When the target score indicates that the first comprehensive health is less than a minimum value of the first health threshold interval or greater than a maximum value of the first health threshold interval, it is determined to issue an alarm to the first node.
[0021] As a possible implementation manner, after predicting the target score corresponding to the first comprehensive health level using a pre-trained scoring model, the method further includes:
[0022] When the target score indicates that the first comprehensive health is less than the minimum value of the first health threshold interval, the second application on the first node is migrated out, or the first business Pod is expanded;
[0023] When the target score indicates that the first comprehensive health is greater than the maximum value of the first health threshold interval, the first business Pod is scaled down, or the third application on other nodes in the Knative cluster is migrated to the first node.
[0024] As a possible implementation manner, after determining whether to issue an alarm to the first node based on the target score, the method further includes:
[0025] When it is determined to alarm the first node, the first comprehensive health degree and the target score are stored as alarm information in an alarm record, where the alarm record is used to store historical alarm information of each node;
[0026] Generate training data for training a scoring model based on historical alarm information stored in the alarm record;
[0027] The scoring model is trained based on the training data.
[0028] In a second aspect, the present application provides a cloud resource intelligent monitoring and alarm device, including:
[0029] An acquisition module, configured to acquire first resource information of a Knative cluster, wherein the first resource information includes first resource utilization information of a first node corresponding to a first application in the Knative cluster and second resource utilization information of a first business Pod corresponding to the first application in the first node;
[0030] A health determination module, configured to determine a first comprehensive health of a first application on a first node based on the first resource information;
[0031] A score prediction module, used to predict a target score corresponding to a first comprehensive health by using a pre-trained scoring model, the target score is used to indicate a size relationship between the first comprehensive health and a first health threshold interval, the scoring model is trained based on a first data set, the first data set includes a plurality of first training samples with score labels, each first training sample includes a historical comprehensive health applied to a node;
[0032] An alarm module is used to determine whether to alarm the first node based on the target score.
[0033] In a third aspect, the present application provides an electronic device, the electronic device comprising: a processor and a memory storing computer program instructions;
[0034] When the processor executes the computer program instructions, the cloud resource intelligent monitoring and alarm method of the first aspect is implemented.
[0035] In a fourth aspect, the present application implements a computer-readable storage medium on which computer program instructions are stored. When the computer program instructions are executed by a processor, the cloud resource intelligent monitoring and alarm method of the first aspect is implemented.
[0036] In a fifth aspect, the present application provides a computer program product. When the instructions in the computer program product are executed by a processor of an electronic device, the electronic device executes the cloud resource intelligent monitoring and alarm method as in the first aspect.
[0037] The cloud resource intelligent monitoring alarm method, device, equipment, medium and program of the embodiment of the present application, based on the first resource utilization information of the first node corresponding to the first application in the Knative cluster and the second resource utilization information of the first business Pod corresponding to the first application in the first node, determine the first comprehensive health of the first application on the first node; use the pre-trained scoring model to predict the target score corresponding to the first comprehensive health, the target score is used to indicate the size relationship between the first comprehensive health and the first health threshold interval, and determine whether to alarm the first node based on the target score. According to the embodiment of the present application, the resource utilization information of the node and the business is combined to jointly determine the comprehensive health of the business on the node, so that the comprehensive health can reflect both the node health and the node health, and the alarm based on the comprehensive health is more timely, and based on the scoring model, the score that can characterize the size relationship between the comprehensive health and the health threshold is predicted, and the alarm is based on the score. Compared with the traditional method of alarming based on the alarm threshold set based on experience, the alarm is more accurate, and the scoring model is applicable to all businesses and nodes, which is more flexible. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] In order to more clearly illustrate the technical solution of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0039] Figure 1 It is a flow chart of the cloud resource intelligent monitoring and alarm method provided in the embodiment of the present application;
[0040] Figure 2 It is a structural diagram of a cloud resource intelligent monitoring and alarm device provided in an embodiment of the present application;
[0041] Figure 3 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0042] The features and exemplary embodiments of various aspects of the present application will be described in detail below. In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain the present application, rather than to limit the present application. For those skilled in the art, the present application can be implemented without the need for some of these specific details. The following description of the embodiments is only to provide a better understanding of the present application by illustrating the examples of the present application.
[0043] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "include..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0044] First, the professional terms in the embodiments of the present application are explained:
[0045] Kubernetes refers to the container cluster management system, abbreviated as K8s.
[0046] Knative refers to the function computing framework, abbreviated as kn.
[0047] Pod is a logical concept and the atomic scheduling unit of the Kubernetes project. A Pod can contain a group of related containers.
[0048] A node is a working node in a Kubernetes cluster, also known as a host or machine. Each node has its own computing resources (such as CPU, memory, etc.) and storage resources. A node can host multiple Pods, and the Kubernetes Master will automatically schedule Pods on the cluster.
[0049] Prometheus refers to a visual monitoring tool, abbreviated as prm.
[0050] Grafana refers to the data visualization tool, referred to as gf.
[0051] Before describing the technical solutions provided by the embodiments of the present application, in order to facilitate the understanding of the embodiments of the present application, the present application first specifically describes the problems existing in the prior art:
[0052] With the development of information technology, cloud computing has gradually become a hot spot in the industry. The development and use of cloud platform technology is becoming more and more frequent. Cloud computing service platforms of major domestic and foreign manufacturers have also been invested in e-commerce, education, science, the Internet of Things and other fields.
[0053] Knative is a serverless framework based on Kubernetes, which aims to develop cloud-native, cross-platform serverless orchestration standards. It provides a set of standardized and reusable container image building methods, reducing the time and cost of image building; it also implements the dynamic expansion and contraction of workloads, can automatically manage the entire life cycle of workloads, and allows users to create traffic policies for multiple versions of applications, and implement blue-green release and other functions.
[0054] Kubernetes, abbreviated as k8s, is a containerized application orchestration management framework designed and developed by Google. It provides a large-scale container deployment and orchestration capability, which can help enterprises or individuals quickly and securely deploy and manage containerized applications. It solves the development and operation and maintenance problems of daily deployment, management of containerized applications and reduces infrastructure costs. In the cloud platform, k8s is widely used in multi-node cluster deployment environments as a new leading distributed architecture solution based on container technology. However, its own scheduling method is to select the most suitable node from all available nodes for deployment based on application resource requirements. This scheduling strategy is simple but lacks flexibility.
[0055] In the existing Knative system, monitoring and alarm management is usually implemented by combining Prometheus and Grafana. When the user develops a function and submits the code to the code repository, the Knative Build component detects that there is a code update, automatically pulls the latest code and builds the application container. The user only needs to write the corresponding Knative deployment yaml file to use the application container to deploy it to the Knative cluster. The application is deployed to the Knative cluster, and the resulting pod needs to be implemented in the Kubernetes cluster. The Knative pod has two containers by default, namely Queue-Proxy and business container. The Queue-Proxy container is responsible for collecting application-related monitoring indicators; then deploy and configure the Prometheus monitoring component and Grafana component. After configuring the various monitoring indicator information in Queue-Proxy, the collected monitoring indicator data can be passed to Prometheus. At this time, the indicator information can be viewed through Prometheus. Finally, the data collected by the Prometheus server is added to Grafana as a data source so that Grafana can obtain Prometheus data, and these monitoring indicator data can be generated into visualization icons for easy viewing. In addition, according to the alarm thresholds set for various monitoring indicators, corresponding alarm information is generated and notified to the relevant person in charge for maintenance.
[0056] In the cloud platform, effective monitoring and alarming can monitor the abnormal status of deployed applications in Knative in the first place and promptly notify the operation and maintenance and developers to handle them, ensuring the continuous and stable operation of the business, and also having a huge impact on the entire business activities of the enterprise. As mentioned above, the inventors of this application found that the existing Knative monitoring and alarming technology mainly has the following problems:
[0057] The accuracy is poor, and the monitoring strategy is relatively traditional and simple. It only roughly compares the collected monitoring indicators with the set alarm thresholds. This very simple way of monitoring is difficult to achieve accurate and intelligent monitoring purposes.
[0058] Poor flexibility. In the existing Knative system, monitoring alarms are implemented by deploying and configuring Prometheus monitoring components and Grafana components. The application-related monitoring indicators are collected by the Queue-Proxy container, and the collected monitoring indicator data are transmitted to Prometheus. Then, Grafana is configured to generate visualization icons for easy viewing. Although this method is simple and intuitive, the alarm thresholds of these monitoring indicators need to be configured based on previous business experience. If there are many businesses or nodes, multiple sets of alarm thresholds need to be deployed repeatedly, which is difficult to maintain and has poor flexibility.
[0059] Poor timeliness. In the existing Knative system, monitoring alarms are either for applications deployed in the Knative cluster or for the nodes where the applications are located. A simple judgment is made based on the monitoring indicators and alarm thresholds set for each of them whether an alarm is generated. These two types of monitoring alarms are independent and are maintained and processed by different personnel. In many cases, the node where the application is located fails before it is transmitted to the business side, which in turn causes problems with the application. Or after a node-side failure occurs or is repaired, the business side is notified to verify. This method is relatively simple, and the timeliness of processing and responding to alarms is poor, and alarm processing cannot be done in a timely manner.
[0060] In view of this, the present invention provides a cloud resource intelligent monitoring and alarm method, device, equipment, medium and program.
[0061] The following first describes the cloud resource intelligent monitoring and alarm method provided in the embodiment of the present application.
[0062] The cloud resource intelligent monitoring and alarm method provided in the embodiment of the present application can be applied to the Knative cluster. Figure 1 The cloud resource intelligent monitoring and alarm method provided in the embodiment of the present application is described in detail.
[0063] For ease of understanding, the Knative cluster is first explained. The Knative cluster may include multiple nodes. Each application deployed in the Knative cluster may include multiple business Pods, and multiple business Pods may be distributed on multiple nodes in the cluster. In this way, an application can correspond to multiple nodes in the Knative cluster, and each node may include business Pods for different businesses. The embodiment of the present application takes the deployment of the first application on the Knative cluster for cloud resource monitoring and alarming as an example to describe in detail the cloud resource intelligent monitoring and alarming method provided in this embodiment.
[0064] See also Figure 1 , is a flow chart of a cloud resource intelligent monitoring and alarm method provided in an embodiment of the present application, such as Figure 1 As shown, the method may include the following steps S11-S14, which are described in detail below.
[0065] S11. Obtain first resource information of the Knative cluster, where the first resource information includes first resource utilization information of a first node corresponding to the first application in the Knative cluster and second resource utilization information of a first business Pod corresponding to the first application in the first node.
[0066] In some embodiments of the present application, the first application may be any application deployed in the Knative cluster. The first node is any node in the Knative cluster corresponding to the first application, that is, a node carrying the business Pod of the first application. The Knative cluster may include one or more nodes corresponding to the first application, and each node corresponding to the first application may be used as a first node, and then steps S11-S14 are performed for the first node.
[0067] In some embodiments of the present application, the first resource information includes first resource utilization information of the first node and second resource utilization information of the first business Pod corresponding to the first application carried in the first node. The first resource utilization information may include indicators related to the load degree of the first node. For example, the first resource utilization information may include but is not limited to indicators such as CPU utilization, memory utilization, and disk I / O utilization of the first node. Similarly, the second resource utilization information may include indicators related to the load degree of the first business Pod. For example, the second resource utilization information may include but is not limited to indicators such as CPU utilization, memory utilization, and disk I / O utilization of the first business Pod.
[0068] S12. Based on the first resource information, determine a first comprehensive health of the first application on the first node.
[0069] In some embodiments of the present application, determining the first comprehensive health of the first application on the first node based on the first resource information may include determining the node health of the first node itself based on the first resource utilization information, determining the business health of the first application on the first node based on the second resource utilization information, and then determining the first comprehensive health of the first application on the first node based on the node health and the business health. In this way, the obtained first comprehensive health can accurately represent the resource health of the first application on the first node.
[0070] S13. Use a pre-trained scoring model to predict the target score corresponding to the first comprehensive health, where the target score is used to indicate the relationship between the first comprehensive health and the first health threshold interval. The scoring model is trained based on a first data set, and the first data set includes multiple first training samples with score labels, and each first training sample includes a historical comprehensive health applied to a node.
[0071] In some embodiments of the present application, a deep learning algorithm may be used to train a scoring model based on the first data set. In some embodiments of the present application, before executing the above step S13, the following steps S21-S26 may be used to train the scoring model:
[0072] S21. Obtain a first data set, the first data set including a plurality of first training samples with score labels, each of the first training samples including a historical comprehensive health degree applied on a node.
[0073] Here, the score label of the first training sample is the real score corresponding to the historical comprehensive health in the first training sample, and the real score can be determined according to the size relationship between the historical comprehensive health and the historical health threshold range.
[0074] In some embodiments of the present application, multiple scores can be pre-set and the size relationship between the comprehensive health represented by each score interval and the health threshold can be set respectively. For example, the first score, the second score, and the third score can be pre-set, and the size relationship represented by the first score is set to the minimum value of the comprehensive health less than the health threshold, the size relationship represented by the second score is set to the comprehensive health belonging to the health threshold interval, and the size relationship represented by the third score is set to the maximum value of the comprehensive health greater than the health threshold interval. In this way, the score label of each first training sample can be determined based on the above settings.
[0075] S22. Divide the first data set into a first training set and a first validation set according to a preset first division ratio.
[0076] In some embodiments of the present application, the first partition ratio refers to the ratio of the first training set to the first validation set in the first data set. For example, if the first partition ratio is 8:2, 80% of the data in the first data set is used as the first training set, and the remaining 20% of the data is used as the first validation set.
[0077] S23. Use the first training set to train the scoring model.
[0078] In some embodiments of the present application, when the scoring model is trained using the first training set, each first training sample in the first training set can be input into the scoring model respectively to obtain a score prediction value corresponding to each first training sample output by the scoring model. For each first training sample, the parameters of the scoring model are adjusted based on the difference between the score prediction value corresponding to the training sample and the score label.
[0079] S24. After each training cycle (epoch), the first validation set is used to verify the accuracy of the trained scoring model.
[0080] In some embodiments of the present application, after each training cycle is completed, the trained scoring model is used to predict the score prediction value of each first training sample in the first verification set, and the number of first training samples in the first verification set whose corresponding score prediction values are consistent with the score labels is determined, and the ratio of this number to the total number of first training samples in the first verification set is used as the accuracy of the scoring model.
[0081] S25. Based on the accuracy of the first initial model, adjust the parameters of the scoring model and perform iterative training until the accuracy of the scoring model is greater than a set accuracy threshold.
[0082] S26. The scoring model whose accuracy is greater than the accuracy threshold is used as the trained scoring model.
[0083] Among them, the accuracy threshold can be set according to actual needs.
[0084] Based on this, in the above step S13, the first comprehensive health can be input into the trained scoring model to obtain the target score corresponding to the first comprehensive health output by the scoring model. S14. Determine whether to issue an alarm to the first node based on the target score.
[0085] In some embodiments of the present application, after obtaining the target score through the scoring model, the size relationship between the first comprehensive health and the first health threshold interval can be determined based on the target score. The size relationship between the first comprehensive health and the first health threshold interval can characterize whether the first comprehensive health is abnormal. If the first comprehensive health is abnormal, it means that the resources of the first node are abnormal, so that the first node needs to be alarmed. Based on this, it can be determined whether to alarm the first node based on the target score.
[0086] In some embodiments of the present application, when determining whether to alert the first node based on the target score, the method may include:
[0087] When the target score indicates that the first comprehensive health is less than a minimum value of the first health threshold interval or greater than a maximum value of the first health threshold interval, it is determined to issue an alarm to the first node.
[0088] Here, when the target score corresponding to the first comprehensive health indicates that the first comprehensive health is less than the minimum value of the first health threshold interval, it means that the first comprehensive health of the first application on the first node is low, and the first node may have insufficient resources at this time, so an alarm can be issued; when the score corresponding to the first comprehensive health indicates that the first comprehensive health is greater than the maximum value of the first health threshold interval, it means that the first comprehensive health of the first application on the first node is high, and the first node may have a waste of resources at this time, so an alarm can be issued. In this way, the health of nodes and business pods in the Knative cluster can be kept within a reasonable range, avoiding situations where the health of nodes and business pods is too high or too low.
[0089] In addition, in some embodiments of the present application, when the target score indicates that the first comprehensive health is greater than or equal to the minimum value of the first health threshold interval and less than or equal to the maximum value of the first health threshold interval, it can be considered that the resources on the first node are within a reasonable range, and therefore no alarm is issued.
[0090] The cloud resource intelligent monitoring and alarm method provided in the embodiment of the present application determines the first comprehensive health of the first application on the first node based on the first resource utilization information of the first node corresponding to the first application in the Knative cluster and the second resource utilization information of the first business Pod corresponding to the first application in the first node; uses a pre-trained scoring model to predict the target score corresponding to the first comprehensive health, the target score is used to indicate the size relationship between the first comprehensive health and the first health threshold interval, and determines whether to alarm the first node based on the target score. According to the embodiment of the present application, the resource utilization information of the node and the business is combined to jointly determine the comprehensive health of the business on the node, so that the comprehensive health can reflect both the node health and the node health, and the alarm based on the comprehensive health is more timely, and based on the scoring model, the score that can characterize the size relationship between the comprehensive health and the health threshold is predicted, and the alarm is based on the score. Compared with the traditional method of alarming according to the alarm threshold set based on experience, the alarm is more accurate, and the scoring model is applicable to all businesses and nodes, which is more flexible.
[0091] In some embodiments, different applications of different business types may be deployed in a Knative cluster, where the business types may include but are not limited to computing-intensive and I / O-intensive types. Considering that applications of different business types have different sensitivities to different indicators, in order to improve the accuracy of the first comprehensive health, the following steps S31-S36 may be used to determine the first comprehensive health of the first application on the first node:
[0092] S31. Determine the service type of the first application.
[0093] In some embodiments of the present application, there are usually some differences in resource allocation on nodes for applications of different business types. Therefore, in step S31, the business type of the first application can be determined based on the second resource information of the first business Pod.
[0094] In some embodiments of the present application, in order to quickly and accurately determine the business type of the first application, a classification model can be trained using a deep learning algorithm before executing the above step S31, so that the trained classification model can be used in the above step S31 to predict the business type of the first application based on the acquired second resource utilization information. The classification model is trained based on the second data set, and the second data set includes multiple second training samples with business type labels, and each second training sample includes historical resource utilization information of a business Pod applied on a node.
[0095] In some embodiments of the present application, the following steps S41-S46 may be used to train the classification model:
[0096] S41. Obtain a second data set, the second data set comprising a plurality of second training samples with business type labels, each second training sample comprising historical resource utilization information of a business Pod applied on a node.
[0097] The business type label of the second training sample is the actual business type of the application corresponding to the second training sample.
[0098] S42. Divide the second data set into a second training set and a second validation set according to a preset second division ratio.
[0099] In some embodiments of the present application, the second partition ratio refers to the ratio of the second training set to the second validation set in the second data set. For example, if the second partition ratio is 8:2, 80% of the data in the second data set is used as the second training set, and the remaining 20% of the data is used as the second validation set.
[0100] S43. Use the second training set to train the classification model.
[0101] In some embodiments of the present application, when the classification model is trained using the second training set, each second training sample in the second training set can be input into the classification model respectively to obtain the business type prediction value corresponding to each second training sample output by the classification model. For each second training sample, the parameters of the classification model are adjusted based on the difference between the business type prediction value corresponding to the second training sample and the business type label.
[0102] S44. After each training cycle is completed, use the second validation set to verify the accuracy of the trained classification model.
[0103] A training cycle means that the model uses the entire training set to perform a forward propagation and a backward propagation. In other words, the model will use each training sample in the training set in turn to update the model's parameters. After an epoch, the model will traverse the entire training set once.
[0104] In some embodiments of the present application, after each training cycle is completed, the trained classification model is used to predict the business type prediction value of each second training sample in the second verification set, and the number of second training samples in the second verification set whose corresponding business type prediction values are consistent with the business type labels is determined, and the ratio of this number to the total number of second training samples in the second verification set is used as the accuracy of the classification model.
[0105] S45. Based on the accuracy of the classification model, adjust the parameters of the classification model and perform iterative training until the accuracy of the classification model is greater than the set accuracy threshold.
[0106] S46. The classification model whose accuracy is greater than the accuracy threshold is regarded as a trained classification model.
[0107] As an example, the classification model may adopt a logistic regression model, and the construction formula of the logistic regression model is as follows:
[0108]
[0109]
[0110] x=(α 1 x 1 , α 2 x 2 , …α n x n )
[0111] k=1,2,…K-1
[0112] In the formula, P(y=k|x,θ) represents the probability that the prediction result is of category k, P(y=K|x,θ) represents the probability that the prediction result is of category K, θ represents the model parameter, y represents the predicted category label, which can be regarded as the service type here, x represents the input feature matrix. In this embodiment, the resource utilization information of the service Pod can be used as the feature matrix, α i Represents the weight of the i-th dimension feature in the feature matrix, i = 1, 2, …, n.
[0113] Based on this, in the above step S31, the second resource utilization information can be input into the trained classification model to obtain the business type corresponding to the second resource utilization information output by the classification model, and the business type is used as the business type of the first application.
[0114] S32. Obtain weight information corresponding to the business type, where the weight information includes indicator weights corresponding to each indicator in the first resource information.
[0115] In some embodiments of the present application, weight information corresponding to each business type can be set in advance based on experience, wherein the weight information for different business types can be different. In this way, after determining the business type of the first application, the first weight information corresponding to the business type can be directly obtained. The first weight information includes the indicator weights corresponding to each indicator in the first resource information. For example, when the first resource utilization information includes the CPU utilization, memory utilization, and disk I / O utilization of the first node, and the second resource utilization information includes the CPU utilization, memory utilization, and disk I / O utilization of the first business Pod, the first weight information may include a weight α corresponding to the CPU utilization of the first node, a weight β corresponding to the memory utilization of the first node, a weight λ corresponding to the disk I / O utilization of the first node, and a weight λ corresponding to the CPU utilization of the first business Pod. The weight Φ corresponding to the memory utilization of the first business Pod, and the weight θ corresponding to the disk I / O utilization of the first business Pod.
[0116] S33. Determine the node health of the first node based on the first resource utilization information and the indicator weight corresponding to each indicator in the first resource utilization information.
[0117] Among them, the indicator weight corresponding to each indicator in the first resource utilization information can be directly obtained from the first indicator information.
[0118] In some embodiments of the present application, the node health of the first node may be determined in the following manner:
[0119] For each indicator in the first resource utilization information, calculate the difference between 1 and the indicator to obtain the resource remaining rate corresponding to the indicator;
[0120] The resource surplus rate corresponding to each indicator in the first resource utilization information is weightedly summed with the corresponding indicator weight to obtain the node health of the first node.
[0121] As an example, taking the first resource utilization information including the CPU utilization, memory utilization, and disk I / O utilization of the first node as an example, the node health of the first node can be calculated using the following formula:
[0122] R i =(1-C i )*α+(1-M i )*β+(1-D i )*λ
[0123] In the formula, α+β+λ=1, R i represents the node health of the first node i, C i represents the CPU utilization of the first node i, M i represents the memory utilization of the first node i, D i Indicates the disk I / O utilization of the first node i.
[0124] S34. Determine the service health of the first application on the first node based on the second resource utilization information and the indicator weight corresponding to each indicator in the second resource rate information.
[0125] In some embodiments of the present application, the service health of the first application on the first node may be determined in the following manner:
[0126] For each indicator in the second resource utilization information, calculate the difference between 1 and the indicator to obtain the resource remaining rate corresponding to the indicator;
[0127] The resource surplus rate corresponding to each indicator in the second resource utilization information is weightedly summed with the corresponding indicator weight to obtain the service health of the first application at the first node.
[0128] As an example, taking the CPU utilization, memory utilization, and disk I / O utilization of the first business Pod included in the second first resource information as an example, the business health of the first application on the first node can be calculated according to the following formula:
[0129]
[0130] In the formula, B i represents the service health of the first application on the first node i, V i Indicates the CPU utilization of the first service Pod on the first node i, L i Memory utilization of the first service Pod on the first node i, H i Indicates the disk I / O utilization of the first service Pod on the first node i.
[0131] S35. Obtain a first weight corresponding to the node health and a second weight corresponding to the business health.
[0132] In some embodiments of the present application, the first weight is the influence weight of the node health on the first comprehensive health, and the second weight is the influence weight of the business health on the first comprehensive health, wherein the first weight and the second weight can be set according to actual conditions. By adjusting the first weight and the second weight, the flexibility of the Knative cluster resource distribution strategy can be achieved.
[0133] S36. Perform a weighted summation of the node health and the service health based on the first weight and the second weight to obtain a first comprehensive health of the first application on the first node.
[0134] In some embodiments of the present application, the first comprehensive health of the first application on the first node may be calculated according to the following formula:
[0135] S i =R i *m+B i *n
[0136] In the formula, m+n=1, S i represents the first comprehensive health of the first application on the first node i, m represents the first weight, and n represents the second weight.
[0137] In this embodiment, according to the different impact weights of resources such as CPU, memory, disk I / O on services and nodes of different business types, a node health calculation model and a business health calculation model based on indicators and indicator weights are respectively constructed, and a comprehensive health calculation model that comprehensively considers node health and business health is constructed. It has strong adaptability and can realize the calculation of the comprehensive health of applications of various business types on nodes.
[0138] In some embodiments, when it is determined that an alarm needs to be issued to the first node based on the target score, alarm information corresponding to the first node can be generated and pushed to the user. The user may include but is not limited to an administrator or an operation and maintenance personnel, so that the user can discover and handle the alarm information in a timely manner to reduce the impact on the business. The alarm information may include but is not limited to information such as the target score.
[0139] In some embodiments, in order to optimize the health of the node, evenly distribute the service pods, and improve the resource utilization of the node, after the above step S13 uses the pre-trained scoring model to predict the target score corresponding to the first comprehensive health, the following steps may also be performed:
[0140] When the target score indicates that the first comprehensive health is less than the minimum value of the first health threshold interval, the second application on the first node is migrated out, or the first business Pod is expanded;
[0141] When the target score indicates that the first comprehensive health is greater than the maximum value of the first health threshold interval, the first business Pod is scaled down, or the third application on other nodes in the Knative cluster is migrated to the first node.
[0142] In some embodiments of the present application, when the target score indicates that the first comprehensive health is less than the minimum value of the first health threshold interval, the business health of each application on the first node on the first node can be determined, and the application with the lowest business health can be used as the second application, and the business Pod of the second application on the first node can be migrated to other nodes in the cluster, thereby reducing the resource usage on the first node, improving the node health of the first node, and further improving the first comprehensive health of the first application on the first node.
[0143] In addition, in some embodiments of the present application, in order to avoid migrating the second application to other nodes, which would cause the other nodes to trigger an alarm, when migrating the second application, it is possible to first determine whether other nodes in the cluster will trigger an alarm if they receive the second application, determine the nodes among the other nodes that will not trigger an alarm, and migrate the second application to any node that will not trigger an alarm. If each node in the other nodes triggers an alarm when receiving the second application, the second application will no longer be migrated from the first node.
[0144] In some embodiments of the present application, when the target score indicates that the first comprehensive health is less than the minimum value of the first health threshold interval, the first business Pod of the first application on the first node can also be expanded to increase the number of first business Pods, thereby improving the business health of the first application on the first node, and then improving the first comprehensive health of the first application on the first node.
[0145] In some embodiments of the present application, when the target score indicates that the first comprehensive health is greater than the maximum value of the first health threshold interval, any application on other nodes can be used as a third application, and the business Pod of the third application on other nodes can be migrated to the first node, thereby reducing the node health of the first node, and then reducing the first comprehensive health of the first application on the first node.
[0146] In addition, in some embodiments of the present application, in order to avoid migrating the third application to the first node, which would cause the first comprehensive health of the first application on the first node to be lower than the minimum first health threshold, before migrating the third application to the first node, it is possible to first determine whether migrating the third application to the first node will cause the first comprehensive health of the first application on the first node to be lower than the minimum first health threshold. If this will cause the first comprehensive health of the first application on the first node to be lower than the minimum first health threshold, the third application will no longer be migrated to the first node.
[0147] In some embodiments of the present application, when the target score indicates that the first comprehensive health is greater than the maximum value of the first health threshold interval, the first business Pod of the first application on the first node can also be scaled down to reduce the number of first business Pods, thereby reducing the business health of the first application on the first node, and further reducing the first comprehensive health of the first application on the first node.
[0148] In some embodiments, in order to improve the accuracy of the scoring model, after determining whether to issue an alarm to the first node based on the target score, the following steps may be further performed:
[0149] When it is determined to alarm the first node, the first comprehensive health degree and the target score are stored as alarm information in an alarm record, where the alarm record is used to store historical alarm information of each node in the cluster;
[0150] Generate training data for training a scoring model based on historical alarm information stored in the alarm record;
[0151] The scoring model is trained based on the training data.
[0152] In this way, the accuracy and early warning ability of the scoring model can be improved.
[0153] Based on the cloud resource intelligent monitoring and alarming method provided in the above embodiment, the present application also provides a specific implementation method of the cloud resource intelligent monitoring and alarming device. Please refer to the following embodiment.
[0154] See also Figure 2 The cloud resource intelligent monitoring and alarm device 200 provided in the embodiment of the present application may include the following modules:
[0155] An acquisition module 201 is used to acquire first resource information of a Knative cluster, where the first resource information includes first resource utilization information of a first node corresponding to a first application in the Knative cluster and second resource utilization information of a first business Pod corresponding to the first application in the first node;
[0156] A health determination module 202, configured to determine a first comprehensive health of a first application on a first node based on first resource information;
[0157] A score prediction module 203 is used to predict a target score corresponding to the first comprehensive health by using a pre-trained scoring model, where the target score is used to indicate the size relationship between the first comprehensive health and the first health threshold interval, and the scoring model is trained based on a first data set, where the first data set includes a plurality of first training samples with score labels, and each first training sample includes a historical comprehensive health applied to a node;
[0158] The alarm module 204 is used to determine whether to alarm the first node based on the target score.
[0159] The cloud resource intelligent monitoring and alarm device provided in the embodiment of the present application determines the first comprehensive health of the first application on the first node based on the first resource utilization information of the first node corresponding to the first application in the Knative cluster and the second resource utilization information of the first business Pod corresponding to the first application in the first node; uses a pre-trained scoring model to predict the target score corresponding to the first comprehensive health, the target score is used to indicate the size relationship between the first comprehensive health and the first health threshold interval, and determines whether to alarm the first node based on the target score. According to the embodiment of the present application, the resource utilization information of the node and the business is combined to jointly determine the comprehensive health of the business on the node, so that the comprehensive health can reflect both the node health and the node health, and the alarm based on the comprehensive health is more timely. Moreover, based on the scoring model, the score that can characterize the size relationship between the comprehensive health and the health threshold is predicted, and the alarm is based on the score. Compared with the traditional method of alarming according to the alarm threshold set based on experience, the alarm is more accurate, and the scoring model is applicable to all businesses and nodes, which is more flexible.
[0160] In some embodiments, the health determination module 201 may include:
[0161] A type determination unit, configured to determine a service type of the first application;
[0162] A first weight acquisition unit, used to acquire first weight information corresponding to the service type, the first weight information including an indicator weight corresponding to each indicator in the first resource information;
[0163] a node health determination unit, configured to determine the node health of the first node based on the first resource utilization information and the indicator weight corresponding to each indicator in the first resource utilization information;
[0164] a service health determination unit, configured to determine the service health of the first application on the first node based on the second resource utilization information and the indicator weight corresponding to each indicator in the second resource utilization information;
[0165] A second weight acquisition unit, used to acquire a first weight corresponding to the node health and a second weight corresponding to the business health;
[0166] The comprehensive health determination unit is used to perform weighted summation of the node health and the service health based on the first weight and the second weight to obtain a first comprehensive health of the first application on the first node.
[0167] In some embodiments, the type determination unit is configured to:
[0168] The business type of the first application is predicted based on a pre-trained classification model and the second resource utilization information, the classification model is trained based on a second data set, the second data set includes multiple second training samples with business type labels, and each second training sample includes historical resource utilization information of a business Pod applied on a node.
[0169] In some embodiments, the alarm module 204 is used to:
[0170] When the target score indicates that the first comprehensive health is less than a minimum value of the first health threshold interval or greater than a maximum value of the first health threshold interval, it is determined to issue an alarm to the first node.
[0171] In some embodiments, the apparatus 200 may further include: a resource adjustment module, configured to:
[0172] After predicting the target score corresponding to the first comprehensive health by using the pre-trained scoring model, if the target score indicates that the first comprehensive health is less than the minimum value of the first health threshold interval, the second application on the first node is migrated out, or the first business Pod is expanded;
[0173] When the target score indicates that the first comprehensive health is greater than the maximum value of the first health threshold interval, the first business Pod is scaled down, or the third application on other nodes in the Knative cluster is migrated to the first node.
[0174] In some embodiments, the apparatus 200 may further include: a training module, configured to:
[0175] After determining whether to alarm the first node based on the target score, if it is determined that the first node is to be alarmed, storing the first comprehensive health and the target score as alarm information in an alarm record, where the alarm record is used to store historical alarm information of each node;
[0176] Generate training data for training a scoring model based on historical alarm information stored in the alarm record;
[0177] The scoring model is trained based on the training data.
[0178] The cloud resource intelligent monitoring and alarm device provided in the embodiment of the present application can achieve Figure 1 To avoid repetition, the various processes implemented by the method embodiment are not described here.
[0179] Figure 3 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application is shown.
[0180] The electronic device 300 may include a processor 301 and a memory 302 storing computer program instructions.
[0181] Specifically, the processor 301 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.
[0182] The memory 302 may include a large capacity memory for data or instructions. By way of example and not limitation, the memory 302 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a tape, or a universal serial bus (USB) drive or a combination of two or more of these. Where appropriate, the memory 302 may include a removable or non-removable (or fixed) medium. Where appropriate, the memory 302 may be inside or outside the integrated gateway disaster recovery device. In a specific embodiment, the memory 302 is a non-volatile solid-state memory. The memory 302 may include a read-only memory (ROM), a random access memory (RAM), a disk storage medium device, an optical storage medium device, a flash memory device, an electrical, optical, or other physical / tangible memory storage device. Therefore, typically, the memory 302 includes one or more tangible (non-transitory) computer-readable storage media (e.g., a memory device) encoded with software including computer executable instructions, and when the software is executed (e.g., by one or more processors), it may perform the operations described in any one of the cloud resource intelligent monitoring alarm methods in the above-mentioned embodiments.
[0183] The processor 301 implements any one of the cloud resource intelligent monitoring and alarm methods in the above embodiments by reading and executing computer program instructions stored in the memory 302 .
[0184] In one example, the electronic device 300 may further include a communication interface 303 and a bus 310. Figure 3 As shown, the processor 301, the memory 302, and the communication interface 303 are connected via a bus 310 and communicate with each other.
[0185] The communication interface 303 is mainly used to implement communication between various modules, devices, units and / or equipment in the embodiments of the present application.
[0186] Bus 310 includes hardware, software or both, and the parts of online data flow billing equipment are coupled to each other. For example, but not limitation, bus may include accelerated graphics port (AGP) or other graphics bus, enhanced industrial standard architecture (EISA) bus, front-end bus (FSB), hypertransport (HT) interconnection, industrial standard architecture (ISA) bus, infinite bandwidth interconnection, low pin count (LPC) bus, memory bus, micro channel architecture (MCA) bus, peripheral component interconnection (PCI) bus, PCI-Express (PCI-X) bus, serial advanced technology attachment (SATA) bus, video electronics standard association local (VLB) bus or other suitable bus or two or more of these combinations. In appropriate cases, bus 310 may include one or more buses. Although the present application embodiment describes and shows a specific bus, the present application considers any suitable bus or interconnection.
[0187] In addition, in combination with the cloud resource intelligent monitoring and alarming method in the above embodiment, the embodiment of the present application can provide a computer storage medium for implementation. The computer storage medium stores computer program instructions; when the computer program instructions are executed by the processor, any one of the cloud resource intelligent monitoring and alarming methods in the above embodiment is implemented.
[0188] It should be clear that the present application is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present application is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present application.
[0189] The functional blocks shown in the above-described block diagram can be implemented as hardware, software, firmware or a combination thereof. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc. When implemented in software, the elements of the present application are programs or code segments that are used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or a communication link by a data signal carried in a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, optical fiber media, radio frequency (RF) links, etc. The code segment can be downloaded via a computer network such as the Internet, an intranet, etc.
[0190] It should also be noted that the exemplary embodiments mentioned in this application describe some methods or systems based on a series of steps or devices. However, this application is not limited to the order of the above steps, that is, the steps can be performed in the order mentioned in the embodiment, or in a different order from the embodiment, or several steps can be performed simultaneously.
[0191] Aspects of the present disclosure are described above with reference to the flowchart and / or block diagram of the method, device (system) and computer program product according to the embodiment of the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device to produce a machine so that these instructions executed by the processor of the computer or other programmable data processing device enable the implementation of the function / action specified in one or more boxes of the flowchart and / or block diagram. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field programmable logic circuit. It can also be understood that each box in the block diagram and / or flowchart and the combination of boxes in the block diagram and / or flowchart can also be implemented by dedicated hardware that performs a specified function or action, or can be implemented by a combination of dedicated hardware and computer instructions.
[0192] The above is only a specific implementation of the present application. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, modules and units described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. It should be understood that the protection scope of the present application is not limited to this. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in this application, and these modifications or replacements should be included in the protection scope of this application.
Claims
1. A cloud resource intelligent monitoring and alarm method, characterized in that: include: Obtain first resource information of a Knative cluster, where the first resource information includes first resource utilization information of a first node corresponding to a first application in the Knative cluster and second resource utilization information of a first business Pod corresponding to the first application in the first node; Determining a first comprehensive health of the first application on the first node based on the first resource information; Predicting a target score corresponding to the first comprehensive health by using a pre-trained scoring model, the target score being used to indicate a magnitude relationship between the first comprehensive health and a first health threshold interval, the scoring model being trained based on a first data set, the first data set comprising a plurality of first training samples with score labels, each of the first training samples comprising a historical comprehensive health applied to a node; Determine whether to issue an alarm to the first node based on the target score.
2. The method according to claim 1, characterized in that The determining, based on the first resource information, a first comprehensive health of the first application on the first node includes: Determining a service type of the first application; Acquire first weight information corresponding to the business type, the first weight information including an indicator weight corresponding to each indicator in the first resource information; Determining a node health of the first node based on the first resource utilization information and an indicator weight corresponding to each indicator in the first resource utilization information; Determining a service health of the first application on the first node based on the second resource utilization information and an indicator weight corresponding to each indicator in the second resource utilization information; Obtaining a first weight corresponding to the node health and a second weight corresponding to the business health; The node health and the service health are weightedly summed based on the first weight and the second weight to obtain a first comprehensive health of the first application on the first node.
3. The method according to claim 2, characterized in that The determining the service type of the first application includes: The business type of the first application is predicted based on a pre-trained classification model and the second resource utilization information, the classification model is trained based on a second data set, the second data set includes multiple second training samples with business type labels, and each of the second training samples includes historical resource utilization information of a business Pod applied on a node.
4. The method according to claim 1, characterized in that: The first health threshold interval includes a first health threshold interval minimum value and a first health threshold interval maximum value, and determining whether to issue an alarm to the first node based on the target score includes: When the target score indicates that the first comprehensive health is less than a minimum value of the first health threshold interval or greater than a maximum value of the first health threshold interval, it is determined to issue an alarm to the first node.
5. The method according to claim 4, characterized in that After predicting the target score corresponding to the first comprehensive health level using the pre-trained scoring model, the method further includes: When the target score indicates that the first comprehensive health is less than the minimum value of the first health threshold interval, the second application on the first node is migrated out, or the first business Pod is expanded; When the target score indicates that the first comprehensive health is greater than the maximum value of the first health threshold interval, the first business Pod is scaled down, or a third application on other nodes in the Knative cluster is migrated to the first node.
6. The method according to claim 4, characterized in that After determining whether to alert the first node based on the target score, the method further includes: In the case of determining to alarm the first node, storing the first comprehensive health degree and the target score as alarm information in an alarm record, where the alarm record is used to store historical alarm information of each node; Generating training data for training the scoring model based on the historical alarm information stored in the alarm record; The scoring model is trained based on the training data.
7. A cloud resource intelligent monitoring and alarm device, characterized in that: include: An acquisition module, configured to acquire first resource information of a Knative cluster, wherein the first resource information includes first resource utilization information of a first node corresponding to a first application in the Knative cluster and second resource utilization information of a first business Pod corresponding to the first application in the first node; a health determination module, configured to determine a first comprehensive health of the first application on the first node based on the first resource information; A score prediction module, used to predict a target score corresponding to the first comprehensive health by using a pre-trained scoring model, wherein the target score is used to indicate a size relationship between the first comprehensive health and a first health threshold interval, wherein the scoring model is trained based on a first data set, wherein the first data set includes a plurality of first training samples with score labels, and each of the first training samples includes a historical comprehensive health applied to a node; An alarm module is used to determine whether to alarm the first node based on the target score.
8. An electronic device, characterized in that: The electronic device comprises: a processor and a memory storing computer program instructions; When the processor executes the computer program instructions, the cloud resource intelligent monitoring and alarm method as described in any one of claims 1-6 is implemented.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer program instructions, and when the computer program instructions are executed by the processor, the cloud resource intelligent monitoring and alarm method according to any one of claims 1 to 6 is implemented.
10. A computer program product, characterized in that When the instructions in the computer program product are executed by a processor of an electronic device, the electronic device executes the cloud resource intelligent monitoring and alarm method as described in any one of claims 1-6.
