Method and device for monitoring utilization rate of central processing unit core

By calculating the utilization rate per core of the container, the problem of CPU utilization monitoring distortion in multi-core and resource-constrained scenarios is solved, achieving more efficient and accurate monitoring and alerting.

CN121092402AInactive Publication Date: 2025-12-09INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202511645196.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-11
Publication Date
2025-12-09
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Existing technologies suffer from distorted CPU utilization monitoring metrics in multi-core, super-resolution, or resource-constrained scenarios, affecting monitoring efficiency and alarm accuracy.

Method used

By collecting the original utilization and usage parameters of the central processing unit in the container, the maximum number of cores that the container can use is calculated, the utilization per core is determined, and an alarm policy is executed based on the utilization per core.

Benefits of technology

It improves monitoring efficiency and alarm accuracy, provides more accurate data for operation and maintenance personnel, and eliminates the problem of distorted indicators.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121092402A_ABST
    Figure CN121092402A_ABST
Patent Text Reader

Abstract

The invention provides a central processing unit core utilization rate monitoring method and equipment, and relates to the technical field of computers. The method comprises the following steps: collecting an original utilization rate of a central processing unit in a container and a usage amount parameter of the central processing unit; determining the maximum core number of the central processing unit capable of being used by the container based on the central processing unit usage amount parameter; based on the original utilization rate and the maximum core number of the central processing unit capable of being used by the container, determining the utilization rate of each core of the central processing unit; and executing an alarm strategy according to the utilization rate of each core of the central processing unit. By adopting the method disclosed by the invention, index distortion can be avoided when multiple cores, super-resolution or resources are limited, so that the monitoring efficiency is effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present disclosure relates to the technical field of computer, and particularly relates to a central processor core utilization rate monitoring method and device. BACKGROUND

[0002] In the related art, as the core computing resource, the CPU (Central Processing Unit) is very important to monitor its utilization rate. At present, the CPU utilization rate is usually monitored by using the resource statistics command provided by the Docker container (Docker Container) to obtain the CPU usage rate of the container, and then the total CPU utilization rate of the container is obtained by simple conversion combined with the number of CPU cores allocated to the container. Although this method can realize the monitoring of the CPU utilization rate, it may cause index distortion in the complex scene of multi-core, over-partitioning or resource limitation, thereby affecting the monitoring efficiency. SUMMARY

[0003] The present disclosure provides a central processor core utilization rate monitoring method and device. The main purpose is to solve the problem of low monitoring efficiency.

[0004] According to a first aspect of the present disclosure, a central processor core utilization rate monitoring method is provided, comprising: collecting the original utilization rate of the central processor in the container and the central processor usage parameter; determining the maximum number of cores of the central processor that can be used by the container based on the central processor usage parameter; determining the per-core utilization rate of the central processor based on the original utilization rate and the maximum number of cores of the central processor that can be used by the container; executing an alarm strategy according to the per-core utilization rate of the central processor.

[0005] According to a second aspect of the present disclosure, a central processor core utilization rate monitoring device is provided, comprising: a collection module configured to collect the original utilization rate of the central processor in the container and the central processor usage parameter; a first determination module configured to determine the maximum number of cores of the central processor that can be used by the container based on the central processor usage parameter; a second determination module configured to determine the per-core utilization rate of the central processor based on the original utilization rate and the maximum number of cores of the central processor that can be used by the container; an alarm module configured to execute an alarm strategy according to the per-core utilization rate of the central processor.

[0006] According to a third aspect of the present disclosure, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected with the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method of the first aspect.

[0007] According to a fourth aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to perform the method of the first aspect.

[0008] According to a fifth aspect of the present disclosure, a computer program product is provided, comprising a computer program which, when executed by a processor, implements the method of the first aspect.

[0009] In the embodiments provided by the present disclosure, the original utilization rate of the central processor in a container and the central processor usage parameter are collected; the maximum core number of the central processor that can be used by the container is determined based on the central processor usage parameter; the per-core utilization rate of the central processor is determined based on the original utilization rate and the maximum core number of the central processor that can be used by the container; and the alarm strategy is executed according to the per-core utilization rate of the central processor. In this way, the per-core utilization rate of the CPU can be dynamically calculated by the CPU utilization rate and the maximum core number. Thus, by introducing the dynamic monitoring of the per-core utilization rate of the CPU, the index distortion can be avoided in the case of multi-core, hyper-threading or resource limitation, thereby effectively improving the monitoring efficiency; and by monitoring and alarming based on the calculation of the per-core utilization rate of the CPU, the alarm accuracy and efficiency can be further improved, and better data basis can be provided for the operation and maintenance of the operation and maintenance personnel.

[0010] It should be understood that the content described in this part is not intended to identify key or important features of the embodiments of the present disclosure, nor to limit the scope of the present disclosure. Other features of the present disclosure will become apparent from the following description. BRIEF DESCRIPTION OF DRAWINGS

[0011] The accompanying drawings are used to better understand the present scheme and do not constitute limitations on the present disclosure. Among them: Figure 1 A flowchart of a central processor core utilization rate monitoring method provided by an embodiment of the present disclosure is shown; Figure 2 A flowchart of another central processor core utilization rate monitoring method provided by an embodiment of the present disclosure is shown; Figure 3 A structural diagram of a central processor core utilization rate monitoring device provided by an embodiment of the present disclosure is shown. DETAILED DESCRIPTION

[0012] Exemplary embodiments of the present disclosure are described below with reference to the accompanying drawings, which include various details of the embodiments of the present disclosure to assist in understanding them. These should be considered as merely exemplary. Thus, those of ordinary skill in the art will recognize various changes and modifications of the embodiments described herein, which do not depart from the scope and spirit of the present disclosure. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.

[0013] As known from the background art, with the rapid development of cloud computing, micro-service architecture and artificial intelligence technology, Docker container technology has become the mainstream solution for modern application deployment and resource isolation. In an artificial intelligence platform, Docker containers, as the carrier of application deployment and running, carry various tasks from model training, inference services to platform basic components. In actual running environment, the platform may manage tens of thousands or even hundreds of thousands of container instances simultaneously, which puts high requirements on fine management and real-time monitoring of resources. Moreover, as the most core computing resource, the accurate monitoring of CPU utilization is not only the key to guarantee the stability of application performance, but also the important basis for realizing reasonable scheduling of resources, cost control and system operation automation. Especially in the AI (Artificial Intelligence) scenario, the computing task usually has the characteristics of high concurrency, high volatility and strong real-time, and the actual use of CPU resources by the container will directly affect the task execution efficiency and the overall resource utilization of the platform.

[0014] Currently, the CPU utilization monitoring of containers in an artificial intelligence platform usually relies on the resource statistics function of the Docker engine itself. For example, the CPU usage percentage of a container in a unit of time (i.e., "raw CPU utilization") can be obtained by executing the docker stats command. If the container is configured with multiple CPU cores, the raw utilization can be multiplied by the number of CPU cores used by the container to obtain the "overall CPU utilization" of the container. For example, if a container is configured with a 2-core CPU and the utilization returned by docker stats is 50%, the CPU utilization of the container calculated by the system is 100%. Although this method can reflect the occupation of host CPU resources by the container to some extent, its calculation logic is based on the assumption that the container exclusively allocates the number of cores, and does not fully consider the resource management strategies commonly used in actual running environment, such as CPU resource limitation and over-provisioning configuration.

[0015] This calculation method often leads to the final CPU utilization value significantly exceeding 100% in actual operation, especially in the case of multiple CPU cores configured for the container and high load, the index is prone to overflow. This utilization index exceeding 100% brings significant difficulties and confusion to the triggering and execution of the alarm strategy in actual operation and maintenance management; moreover, it makes it difficult for the operation and maintenance personnel to set effective alarm rules according to the conventional percentage threshold, resulting in the inability to accurately and timely monitor and manage the CPU resource status of various containers in the platform.

[0016] Based on this, the embodiments of the present disclosure provide a central processor core utilization monitoring method and device, which can avoid index distortion in the case of multiple cores, over-provisioning or resource constraints by introducing a dynamic monitoring item of CPU per-core utilization, improve monitoring efficiency; moreover, by calculating the CPU per-core utilization for monitoring and alarm, the alarm accuracy and efficiency can be further improved, and better data basis can be provided for the operation and maintenance of the operation and maintenance personnel.

[0017] The central processor core utilization monitoring method and device of the embodiments of the present disclosure are described below with reference to the accompanying drawings.

[0018] Figure 1 A flowchart of a central processor core utilization monitoring method provided by the embodiments of the present disclosure is shown. As shown in Figure 1 The method comprises the following steps: Step 101, collecting the original utilization of the central processor in the container and the central processor usage parameter.

[0019] When monitoring the central processor core utilization, two key parameters need to be collected first, including: the original utilization, that is, the proportion of the current CPU time used by the container to the total available CPU time, which can be expressed in percentage, for example; and obtaining the central processor usage parameter, such as the central processor time slice period, the maximum central processor time that can be used in each central processor time slice period, etc., which can be used to comprehensively understand the CPU usage of the container. For example, the original utilization and the central processor usage parameter can be obtained through the command or API (Application Programming Interface, application programming interface) provided by the container management tool (such as Docker). For example, the stats command of Docker can be used to obtain the real-time CPU usage of the container, including the original utilization and the CPU usage parameter.

[0020] Step 102, determining the maximum number of cores of the central processor that can be used by the container based on the central processor usage parameter.

[0021] The maximum core number of the CPU that the container can use can be calculated according to the collected CPU usage parameter after the original utilization rate of the central processor in the collection container and the central processor usage parameter. That is, the maximum core number, which is used to determine the maximum CPU resource that can be used under the current configuration. It can be understood that in the container environment, the allocation of CPU resources can usually be controlled by resource limit parameters such as CpuPeriod (central processor time slice period) and CpuQuota (maximum central processor time that can be used in each central processor time slice period). Through these parameters, the maximum core number of the CPU that the container can use can be calculated.

[0022] In some possible implementation manners, the CPU usage parameter comprises a central processor time slice period and a maximum central processor time that can be used in each central processor time slice period. Determining the maximum core number of the central processor that the container can use based on the CPU usage parameter comprises: calculating a first quotient value of the maximum central processor time that can be used in each central processor time slice period and the central processor time slice period, as the maximum core number of the central processor that the container can use.

[0023] In the process of determining the maximum core number of the central processor that the container can use based on the CPU usage parameter, a quotient of the maximum central processor time that can be used in each central processor time slice period and the central processor time slice period can be calculated as the first quotient value. The first quotient value is determined as the maximum core number of the central processor that the container can use. As an example, the maximum core number of the CPU can be calculated as follows: Maximum core number of the CPU = CpuQuota / CpuPeriod wherein CpuQuota is the maximum central processor time that can be used in each central processor time slice period, and CpuPeriod is the central processor time slice period.

[0024] In step 103, the per-core utilization rate of the central processor is determined based on the original utilization rate and the maximum core number of the central processor that the container can use.

[0025] The per-core utilization rate of the central processor can be calculated based on the original utilization rate and the maximum core number of the central processor that the container can use. The per-core utilization rate of the central processor can more accurately reflect the use of CPU resources by the container, especially in a multi-core CPU environment.

[0026] In some possible implementation manners, the per-core utilization rate of the central processor is determined based on the original utilization rate and the maximum core number of the central processor that the container can use, comprising: The second quotient of the original utilization rate and the maximum number of cores of the central processor available to the container is calculated as the per-core utilization rate of the central processor.

[0027] In the determination of the per-core utilization rate of the central processor based on the original utilization rate and the maximum number of cores of the central processor available to the container, the collected original utilization rate can be divided by the maximum number of cores of the CPU available to the container to obtain the utilization rate of each CPU core, that is, the per-core utilization rate of the CPU. As an example, if the original CPU utilization rate of the container is 200% and the maximum number of cores of the CPU available to the container is 2, the utilization rate of each CPU core is 100%, which can be used to evaluate the performance and resource use efficiency of the container.

[0028] In step 104, an alarm strategy is executed according to the per-core utilization rate of the central processor.

[0029] After the per-core utilization rate of the central processor is calculated, the corresponding alarm strategy can be executed according to the calculated utilization rate of each CPU core. The alarm strategy can be triggered according to the preset threshold value, and when the per-core utilization rate exceeds the threshold value, the system will issue an alarm notification. It can be understood that the alarm threshold value can be set to multiple, and different threshold values can set different alarm modes, and when the per-core utilization rate exceeds the corresponding threshold value, the corresponding alarm measures can be taken according to the alarm level, such as sending an alarm notification to the operation and maintenance personnel, automatically adjusting the container resource limit or automatically restarting the container, etc.

[0030] In the embodiments provided by the present disclosure, the original utilization rate of the central processor in the container and the central processor usage parameter are collected; the maximum number of cores of the central processor available to the container is determined based on the central processor usage parameter; the per-core utilization rate of the central processor is determined based on the original utilization rate and the maximum number of cores of the central processor available to the container; and an alarm strategy is executed according to the per-core utilization rate of the central processor. In this way, the per-core utilization rate of the CPU can be dynamically calculated based on the CPU utilization rate and the maximum number of cores. In this way, by introducing the dynamic monitoring of the per-core utilization rate of the CPU, the distortion of the index can be avoided in the case of multi-core, over-provisioning or resource limitation, thereby effectively improving the monitoring efficiency; and by monitoring and alarming based on the per-core utilization rate of the CPU, the accuracy and efficiency of the alarm can be further improved, and better data basis can be provided for the operation and maintenance of the operation and maintenance personnel.

[0031] It should be noted that the embodiments of the present disclosure can include multiple steps, and in order to facilitate description, these steps are numbered, but these numbers do not limit the execution time slots and execution order between the steps; these steps can be implemented in any order, and the embodiments of the present disclosure do not limit this.

[0032] In a possible implementation, the maximum central processor time that can be used in each central processor time slice period is calculated, and a first quotient of the central processor time slice period is taken as the maximum core number of the central processor that can be used by the container, including: In a case where the first quotient belongs to a first preset value, the total central processor core number of the container host is taken as the maximum core number of the central processor that can be used by the container; In a case where the first quotient does not belong to the first preset value, the first quotient is taken as the maximum core number of the central processor that can be used by the container.

[0033] In an embodiment of the present disclosure, considering that the calculated maximum core number can have an abnormal value, therefore, an abnormal value judgment of the maximum core number can be performed. For example, the first quotient can be compared with a preset value (the first preset value), and the first preset value can be set to 1 or 0, for example. If the first quotient belongs to the first preset value, the total central processor core number of the container host can be taken as the maximum core number of the central processor that can be used by the container. Conversely, if the first quotient does not belong to the first preset value, the first quotient can be directly taken as the maximum core number of the central processor that can be used by the container. In this way, more accurate data basis can be provided for subsequent per-core utilization calculation.

[0034] In a possible implementation, a second quotient of the original utilization rate and the maximum core number of the central processor that can be used by the container is calculated as the per-core utilization rate of the central processor, including: In a case where the second quotient is greater than a second preset value, the second preset value is determined as the per-core utilization rate of the central processor.

[0035] In which, considering that the calculated per-core utilization rate can exceed the normal range, therefore, an abnormal judgment of the per-core utilization rate is needed. For example, after the second quotient of the original utilization rate and the maximum core number of the central processor that can be used by the container is calculated, the second quotient of the original utilization rate and the maximum core number of the central processor that can be used by the container can be compared with a preset value (the second preset value), and the second preset value can be 100%, 95%, or other data according to actual needs. If the second quotient is greater than the second preset value, the second preset value can be determined as the per-core utilization rate of the central processor. In this way, it can effectively avoid the influence of CPU utilization monitoring due to the abnormal per-core utilization rate.

[0036] In a possible implementation, an alarm strategy is executed according to the per-core utilization rate of the central processor, including: In a case where the per-core utilization rate of the central processor is greater than or equal to a first preset alarm threshold and less than a second preset alarm threshold, a first-level alarm is executed; In a case that the per-core utilization of the central processor is greater than or equal to the second preset alarm threshold, a second-level alarm is executed.

[0037] The first preset alarm threshold can be the second preset alarm threshold, and can be a threshold preset in advance, which is used to define when a first-level alarm is triggered and when a second-level alarm is triggered. For example, the first preset alarm threshold can be set to 50%, indicating that when the per-core utilization exceeds 50%, a first-level alarm is triggered; and the second preset alarm threshold can be set to 90%, indicating that when the per-core utilization exceeds 90%, a second-level alarm is triggered. For example, when the per-core utilization is greater than or equal to the first preset alarm threshold and less than the second preset alarm threshold, a first-level alarm can be executed. The first-level alarm can indicate that the system resource usage is high, but has not reached a serious state, and some preliminary measures can be taken, such as sending a warning notification to an operation and maintenance personnel to prompt them to pay attention to the system state. When the per-core utilization is greater than or equal to the second preset alarm threshold, a second-level alarm can be executed. The second-level alarm can indicate that the system resource usage is very tight, and immediate measures may need to be taken, such as automatically adjusting resource limits, restarting a container, or sending an urgent notification to an operation and maintenance personnel. In this way, by defining different preset alarm thresholds and executing corresponding alarm strategies according to the per-core utilization, the CPU usage of the container can be more accurately monitored, potential performance problems can be discovered in a timely manner, and corresponding measures can be taken. This method can effectively improve the reliability and stability of the system.

[0038] In a further possible implementation, after determining the per-core utilization of the central processor based on the original utilization and the maximum number of cores of the central processor available to the container, at least one of the following is further included: storing the per-core utilization of the central processor; displaying the per-core utilization of the central processor.

[0039] The calculated per-core utilization data can also be stored in a persistent storage system for subsequent querying and analysis. For example, the per-core utilization data can be stored in a relational database (such as MySQL, PostgreSQL), a time series database (such as InfluxDB, Prometheus), or a file system. For example, information including timestamp, container ID, per-core utilization, etc. can be stored for subsequent querying and analysis. In addition, the calculated per-core utilization data can also be displayed to users through a user interface or command line tool for real-time monitoring and analysis. For example, the per-core utilization data can be displayed through a web interface, command line tool, or graphical interface, and the changes in per-core utilization can be displayed in real time to help operations personnel discover potential performance problems in a timely manner. In this way, by storing and displaying the per-core utilization of the central processing unit, the CPU usage of the container can be more comprehensively monitored, the stored data can be used for subsequent analysis and reporting, and the displayed data can provide real-time monitoring information to help operations personnel discover and solve problems in a timely manner. This method can effectively improve the reliability and stability of the system.

[0040] In further possible implementations, further comprising: obtaining historical central processing unit utilization of the container; performing prediction processing based on the historical central processing unit utilization through a central processing unit utilization prediction model to generate a predicted value of the central processing unit utilization; executing an alarm strategy according to the predicted value of the central processing unit utilization.

[0041] The historical central processor utilization can be the CPU utilization records of the container in the past period of time. These data are usually stored in a time series database (such as InfluxDB) or a relational database (such as MySQL, PostgreSQL) for subsequent analysis and prediction. For example, the CPU utilization data of the container can be collected by periodically running the docker stats command or using the API of the container management platform, and stored in the database. Then, the historical central processor utilization can be input into the central processor utilization prediction model, and the central processor utilization prediction model can be used to predict based on the historical central processor utilization to generate a predicted value of the central processor utilization. The central processor utilization prediction model can be a mathematical model or a machine learning algorithm used to predict future CPU utilization based on historical data. The prediction model can include linear regression, time series analysis, machine learning algorithms, etc. The prediction model can be trained using historical CPU utilization data, and the future CPU utilization prediction value at a future time point can be generated through the model. Then, different alarm levels and response measures can be set according to the predicted CPU utilization value. For example, if the predicted value exceeds the preset alarm threshold, an alarm notification can be triggered to the operation and maintenance personnel, or the container resource limit can be automatically adjusted. In this way, the historical central processor utilization of the container can be obtained, the future CPU utilization prediction value can be generated using the prediction model, and the corresponding alarm strategy can be executed according to the prediction value, so that the performance of the container can be monitored more intelligently, potential performance problems can be found in advance, and preventive measures can be taken. This not only improves the reliability of the system, but also reduces the workload of the operation and maintenance personnel.

[0042] In further possible implementations, the method further comprises: determining a dynamic alarm threshold based on the historical central processor utilization; updating the preset alarm threshold based on the dynamic alarm threshold; wherein the preset alarm threshold comprises at least one of a first preset alarm threshold and a second preset alarm threshold.

[0043] The dynamic alarm threshold can be an alarm threshold dynamically adjusted according to historical CPU utilization data. When the dynamic alarm threshold is determined based on the historical central processor utilization, the statistical characteristics (such as the mean and standard deviation) of the historical data can be used to determine the dynamic alarm threshold. For example, the dynamic alarm threshold can be set to the mean of the historical data plus several times the standard deviation. Then, the preset alarm threshold can be updated according to the calculation result of the dynamic alarm threshold, for example, the first preset alarm threshold and the second preset alarm threshold are updated. In this way, by determining the dynamic alarm threshold based on the historical central processor utilization and updating the preset alarm threshold according to the dynamic threshold, the performance of the container can be more intelligently monitored, potential performance problems can be found in advance, and preventive measures can be taken, thereby the reliability of the system can be further improved, and the work burden of the operation and maintenance personnel can be further reduced.

[0044] To make the central processor core utilization monitoring method provided by the embodiments of the present disclosure clearer, the following specific examples are combined for description. The central processor core utilization monitoring method provided by the embodiments of the present disclosure can include the following processing: The embodiments of the present disclosure can convert the traditional container overall CPU utilization into a standardized and easy-to-understand CPU per core utilization indicator by dynamically calculating the equivalent CPU core number of the container. To realize the monitoring of the CPU per core utilization, the following contents need to be mainly added in the artificial intelligence platform: A CPU per core utilization column is added in the collected container performance table, that is, a cpu_perc_cores column can be added in the collect_container_performance collection item, which is used to store the CPU per core utilization indicator data. Wherein, collect_container_performance: container performance collection item; cpu_perc_cores: per core CPU utilization.

[0045] The CPU per core utilization monitoring alarm is uniformly added in the alarm strategy, alarm indicator, and threshold template. The CPU per core utilization monitoring item is added in the alarm strategy, which is used to monitor the CPU per core utilization and set the general alarm and serious alarm thresholds, so as to facilitate the operation and maintenance personnel to monitor and maintain the platform resources; the setting of the alarm indicator and the threshold template facilitates the operation and maintenance personnel to quickly create a custom alarm strategy.

[0046] The CPU per core utilization performance data curve is uniformly added in the container instance, inference service, and platform service, that is, the cpu_perc_cores monitoring item is displayed in the artificial intelligence platform. For example, in the system settings-general settings-platform service, any service (such as iresource (CPU)) of the platform is entered, and the CPU per core utilization monitoring curve of the container of the platform service can be directly observed.

[0047] Referring to Figure 2 The monitoring method of the central processor core utilization rate can include the following steps: (1) Data acquisition and processing: First, the original utilization rate value of the container can be obtained through docker stats (Docker resource statistics command), such as obtaining the cpu per core utilization rate of the platform service iresource service. First, use docker ps (Docker list container command) -a | grep (text search tool) iresource to obtain the docker container id, i.e. CONTAINER ID (container ID). Then, use docker stats ${{container id}} | grep iresource | awk (text processing tool) 'NR==2 {print $3}' to output the original CPU utilization rate of the container.

[0048] Then, through docker inspect (Docker inspection command) ${{container id}}, the CpuPeriod and CpuQuota values of the container are obtained.

[0049] (2) Core calculation logic: The maximum core limit of the CPU = CpuQuota / CpuPeriod. If the maximum core limit of the CPU is empty or zero, the total CPU core number of the host is taken as the maximum core limit of the CPU.

[0050] Then the CPU per core utilization rate is the original CPU utilization rate / CPU maximum core limit. If the CPU per core utilization rate still exists CPU oversubscription, it may be slightly greater than 100%. In order to maintain the definition of this index item, when it is greater than 100%, the value is taken as 100%.

[0051] (3) Storage and display: In the influxdb database, a new column cpu_perc_cores can be added to the collect_container_performance table to store the container CPU per core utilization rate index data. In our company's platform, a new CPU per core utilization rate index is added to the system settings-platform service-monitoring index in the platform system service to display the CPU per core utilization rate data of the platform system service. In the model development and reasoning service, the CPU per core utilization rate data is added to the container instance monitoring item in each task.

[0052] At the same time, add "CPU per core utilization" alarm policy in the alarm strategy, generally set the alarm threshold to 50%, and the serious alarm threshold to 90%. When the per-core utilization exceeds the set threshold, the platform will notify the operation and maintenance personnel according to the set alarm notification mode, and can accurately realize the per-core CPU utilization.

[0053] Based on this, the equivalent CPU core number of the container can be calculated dynamically to convert the traditional container overall CPU utilization into a standardized and easy-to-understand CPU per core utilization indicator. The specific implementation steps include: obtaining the original CPU utilization of the container through the dockerstats command; obtaining the CpuPeriod and CpuQuota parameters of the container through the docker inspect command; calculating the maximum core number limit of the CPU according to CpuQuota / CpuPeriod, if the value is empty or zero, taking the total CPU core number of the host as the maximum core number limit; calculating the CPU per core utilization, which is the value of the original CPU utilization / the maximum core number limit of the CPU; normalizing the calculation result, if the CPU per core utilization is greater than 100%, taking the value 100%, to ensure that the indicator meets the intuitive cognitive range of 0%-100%.

[0054] Add a cpu_perc_cores column in the container performance data table (such as the collect_container_performance table in InfluxDB) to store the CPU per core utilization indicator data; add a CPU per core utilization performance data curve in the platform monitoring interface (such as system settings - platform services - monitoring indicators, model development tasks, inference services, etc.) to visually display the indicator; add an alarm item based on the CPU per core utilization in the alarm strategy, support setting a unified general alarm threshold (such as 50%) and a serious alarm threshold (such as 90%), and can notify the operation and maintenance personnel through the preset mode when the alarm is triggered.

[0055] Thus, by introducing the container CPU per-core utilization, the standardization and visualization of monitoring indicators can be achieved: by dynamically calculating the equivalent CPU core number of the container and converting the original CPU utilization to per-core utilization, the monitoring indicators are uniformly standardized in a reasonable range of 0%-100%, which enables operation and maintenance personnel to quickly and intuitively understand the real load pressure of the container on the single-core CPU allocated to it, eliminating cognitive confusion and interpretation difficulties caused by indicators exceeding 100%. In addition, the accuracy and operability of the alarm strategy can be greatly improved: based on the standardized per-core utilization indicator, operation and maintenance personnel can set uniform and effective alarm thresholds (such as 50% general alarm and 90% severe alarm) for all containers on the platform, which can avoid false alarms and missed alarms caused by container configuration differences, significantly reduce the configuration and maintenance complexity of the alarm strategy, and improve the accuracy of the alarm and the efficiency of operation and maintenance.

[0056] Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be realized by means of software and the necessary general hardware platform, of course, it can also be realized by hardware, but in many cases the former is a better embodiment.

[0057] According to the embodiments of the present disclosure, the present disclosure also provides a central processor core utilization monitoring device. For example, Figure 3 A structural schematic diagram of a central processor core utilization monitoring device provided by an embodiment of the present disclosure. The central processor core utilization monitoring device 300 comprises: The acquisition module 310 is configured to acquire the original utilization of the central processor in the container and the central processor usage parameter; The first determination module 320 is configured to determine the maximum core number of the central processor that can be used by the container based on the central processor usage parameter; The second determination module 330 is configured to determine the per-core utilization of the central processor based on the original utilization and the maximum core number of the central processor that can be used by the container; The alarm module 340 is configured to execute an alarm strategy according to the per-core utilization of the central processor.

[0058] Further, the central processor usage parameter comprises a central processor time slice period and a maximum central processor time available in each central processor time slice period; The first determination module 320 is configured to: Calculate the first quotient value of the maximum central processor time available in each central processor time slice period and the central processor time slice period as the maximum core number of the central processor that can be used by the container.

[0059] Further, the first determining module 320 is used for: in a case where the first quotient belongs to a first preset value, obtaining a total number of central processor cores of the container host as the maximum number of cores of the central processor available to the container; in a case where the first quotient does not belong to the first preset value, taking the first quotient as the maximum number of cores of the central processor available to the container.

[0060] Further, the second determining module 330 is used for: calculating a second quotient of the original utilization rate and the maximum number of cores of the central processor available to the container as the utilization rate per core of the central processor.

[0061] Further, the second determining module 330 is used for: in a case where the second quotient is greater than a second preset value, determining the second preset value as the utilization rate per core of the central processor.

[0062] Further, the alarm module 340 is used for: in a case where the utilization rate per core of the central processor is greater than or equal to a first preset alarm threshold and less than a second preset alarm threshold, performing a first-level alarm; in a case where the utilization rate per core of the central processor is greater than or equal to the second preset alarm threshold, performing a second-level alarm.

[0063] Further, at least one of the following is further included: a storage module, used for storing the utilization rate per core of the central processor; a display module, used for displaying the utilization rate per core of the central processor.

[0064] Further, a prediction module is further included, which is used for: obtaining historical central processor utilization rates of the container; performing prediction processing based on the historical central processor utilization rates through a central processor utilization rate prediction model to generate a predicted value of the central processor utilization rate; performing the alarm strategy according to the predicted value of the central processor utilization rate.

[0065] Further, an updating module is further included, which is used for: determining a dynamic alarm threshold based on the historical central processor utilization rates; updating a preset alarm threshold based on the dynamic alarm threshold; wherein the preset alarm threshold includes at least one of a first preset alarm threshold and a second preset alarm threshold.

[0066] It should be noted that the features of the central processor core utilization monitoring device corresponding embodiment can be referred to the related description of the central processor core utilization monitoring method corresponding embodiment, which will not be repeated here.

[0067] Embodiments of the present disclosure also provide an electronic device, comprising a memory and a processor, the memory stores a computer program, and the processor is configured to run the computer program to perform the steps of any of the above method embodiments.

[0068] Embodiments of the present disclosure also provide a computer readable storage medium, which stores a computer program, wherein the computer program is configured to perform the steps of any of the above method embodiments when running.

[0069] In an example embodiment, the above computer readable storage medium can include, but is not limited to, a U disk, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and various media that can store computer programs.

[0070] Embodiments of the present disclosure also provide a computer program product, which comprises a computer program, and the computer program is executed by a processor to implement the steps of any of the above method embodiments.

[0071] Embodiments of the present disclosure also provide another computer program product, which comprises a non-volatile computer readable storage medium, and the non-volatile computer readable storage medium stores a computer program, and the computer program is executed by a processor to implement the steps of any of the above method embodiments.

[0072] The skilled person can further realize that the units and algorithm steps of the examples described in conjunction with the embodiments disclosed herein can be realized by electronic hardware, computer software or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the components and steps of the examples have been described in the above description in general terms. Whether the functions are realized in hardware or software depends on the specific application and design constraints of the technical solution. The skilled person can use different methods to realize the described functions for each specific application, but such implementation should not be considered beyond the scope of the present disclosure.

[0073] The above describes in detail the central processor core utilization rate monitoring method provided by the present disclosure. The principles and implementation manners of the present disclosure are described by applying specific examples, and the above description of the embodiments is only used to help understand the method of the present disclosure and its core idea. It should be pointed out that, for those skilled in the art, without departing from the principles of the present disclosure, the present disclosure can be improved and modified in several ways, and these improvements and modifications also fall within the protection scope of the claims of the present disclosure.

Claims

1. A method for monitoring central processing unit (CPU) core utilization, characterized in that, include: Collect raw utilization and CPU usage parameters of the CPU in the container; The maximum number of CPU cores that the container can use is determined based on the CPU usage parameters. Based on the original utilization rate and the maximum number of CPU cores that the container can use, the utilization rate per CPU core is determined. An alarm policy is executed based on the per-core utilization of the central processing unit.

2. The method for monitoring central processing unit core utilization according to claim 1, characterized in that, The CPU usage parameters include CPU time slice period and the maximum CPU time available in each CPU time slice period. Determining the maximum number of CPU cores that the container can use based on the CPU usage parameter includes: The maximum CPU time available in each CPU time slice period is calculated, and the first quotient of the CPU time slice period is used as the maximum number of CPU cores that the container can use.

3. The method for monitoring central processing unit core utilization according to claim 2, characterized in that, The step of calculating the maximum CPU time available within each CPU time slice period, and the first quotient of the CPU time slice period, as the maximum number of CPU cores that the container can use, includes: If the first quotient is within the first preset value, the total number of CPU cores of the container host is obtained as the maximum number of CPU cores that the container can use; If the first quotient does not belong to the first preset value, the first quotient is used as the maximum number of CPU cores that the container can use.

4. The method for monitoring central processing unit core utilization according to claim 1, characterized in that, Determining the utilization rate per core of the central processing unit based on the original utilization rate and the maximum number of CPU cores that the container can use includes: The second quotient of the original utilization rate and the maximum number of CPU cores that the container can use is calculated as the CPU core utilization rate.

5. The method for monitoring central processing unit core utilization according to claim 4, characterized in that, The calculation of the second quotient of the original utilization rate and the maximum number of CPU cores that the container can use, as the CPU core utilization rate, includes: If the second quotient is greater than the second preset value, the second preset value is determined as the utilization rate per core of the central processing unit.

6. The method for monitoring central processing unit core utilization according to claim 1, characterized in that, The step of executing the alarm policy based on the per-core utilization of the central processing unit includes: If the utilization rate per core of the central processing unit is greater than or equal to the first preset alarm threshold and less than the second preset alarm threshold, a level one alarm is executed; If the utilization rate per core of the central processing unit is greater than or equal to the second preset alarm threshold, a level two alarm is executed.

7. The method for monitoring central processing unit core utilization according to claim 1, characterized in that, After determining the utilization rate per core of the central processing unit based on the original utilization rate and the maximum number of CPU cores that the container can use, the method further includes at least one of the following: Store the per-core utilization of the central processing unit; This displays the utilization rate per core of the central processing unit.

8. The method for monitoring central processing unit core utilization according to claim 1, characterized in that, Also includes: Obtain the historical CPU utilization of the container; The CPU utilization prediction model is used to predict the CPU utilization based on the historical CPU utilization, and a predicted value of CPU utilization is generated. The alarm policy is executed based on the predicted value of the central processing unit utilization.

9. The method for monitoring central processing unit core utilization according to claim 8, characterized in that, Also includes: Based on the historical CPU utilization, determine the dynamic alarm threshold; The preset alarm threshold is updated based on the dynamic alarm threshold; wherein the preset alarm threshold includes at least one of a first preset alarm threshold and a second preset alarm threshold.

10. An electronic device, characterized in that, include: At least one processor; as well as, A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1-9.

Citation Information

Patent Citations

  • A multi-core host performance monitoring method based on a power function

    CN109766243A

  • Server performance evaluation method, electronic equipment, storage medium and product

    CN118277223A

  • Inference service monitoring method and device, computer equipment and storage medium

    CN119759694A

  • Cloud service alarm method, electronic device, storage medium and computer program product

    WO2025169000A1