An application creation method, device, equipment and computer readable storage medium

By performing CPU NUMA affinity operations in BestEffort Pod to identify and bind the initial CPU core, the problems of long application runtime and low efficiency in BestEffort Pod are solved, and efficient application execution is achieved.

CN115391043BActive Publication Date: 2026-05-05JINAN INSPUR DATA TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
JINAN INSPUR DATA TECH CO LTD
Filing Date
2022-08-30
Publication Date
2026-05-05

AI Technical Summary

Technical Problem

BestEffort Pod suffers from runtime length issues and low efficiency when creating applications.

Method used

By obtaining the initial number of CPU cores and the preset number of CPU NUMA affinity initialization cores, CPU NUMA affinity operation is performed to determine the initial CPU cores to be bound, and the target application is bound to them, so as to improve the application execution efficiency under CPU core binding conditions.

Benefits of technology

It improves the business execution capabilities of the BestEffort Pod, reduces request latency, and enhances application runtime efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115391043B_ABST
    Figure CN115391043B_ABST
Patent Text Reader

Abstract

This invention discloses an application creation method, which includes the following steps: when creating a target application using BestEffort Pod, obtaining the initial number of CPU cores to be allocated to the target application; obtaining a preset number of CPU NUMA affinity initialization cores; performing CPU NUMA affinity operation based on the number of CPU NUMA affinity initialization cores to obtain an affinity result; when it is determined that the CPU core binding condition is met based on the initial number of CPU cores and the affinity result, determining the initial CPU cores to be bound; and binding the target application to the initial CPU cores to create the target application using the initial CPU cores. Applying the application creation method provided by this invention improves the ability of BestEffort Pod to efficiently execute business logic, reduces request latency, and improves application running efficiency. This invention also discloses an application creation device, equipment, and storage medium, which have corresponding technical effects.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of container technology, and in particular to an application creation method, apparatus, device, and computer-readable storage medium. Background Technology

[0002] In the era of container technology, a large number of business applications have been migrated to the cloud using Kubernetes container orchestration technology. Kubernetes is an open-source platform for the automated deployment, scaling, and operation of container clusters, often abbreviated as k8s.

[0003] Deployed applications ultimately run as Pods (container groups). A Pod is the smallest deployable unit in Kubernetes. Pod QoS represents the quality of service of a currently running Pod. Pod QoS values ​​include BestEffort, Burstable, and Guaranteed. Pods with a QoS of Guaranteed have a higher service priority and are prioritized for service by the Kubernetes cluster; Pods with a QoS of BestEffort have a lower service priority and are more likely to be reclaimed if Kubernetes cluster node resources become insufficient; Pods with a QoS of Burstable have a moderate service priority and are relatively stable.

[0004] Pods using BestEffort do not limit the amount of resources they use when creating applications, leading to context switching during CPU usage by the application process. This results in longer application runtime requests and lower operating efficiency.

[0005] In summary, how to effectively solve the problems of long runtime request times and low operating efficiency in applications created using BestEffort Pods is a problem that urgently needs to be solved by those skilled in the art. Summary of the Invention

[0006] The purpose of this invention is to provide an application creation method that improves the ability of BestEffort Pod to execute business functions efficiently, reduces request latency, and improves application running efficiency. Another purpose of this invention is to provide an application creation apparatus, device, and computer-readable storage medium.

[0007] To solve the above-mentioned technical problems, the present invention provides the following technical solution:

[0008] An application creation method includes:

[0009] When creating a target application using the BestEffort Pod, obtain the initial number of CPU cores to be allocated to the target application;

[0010] Obtain the preset number of CPU NUMA affinity initialization cores;

[0011] Perform CPU NUMA affinity operation based on the number of CPU NUMA affinity initialization cores to obtain the affinity result;

[0012] When it is determined that the CPU core binding conditions are met based on the initial number of CPU cores and the affinity result, the initial CPU cores to be bound are determined.

[0013] The target application is bound to the initial CPU core to create the target application using the initial CPU core.

[0014] In one specific embodiment of the present invention, when it is determined that the CPU core binding conditions are met based on the initial number of CPU cores and the affinity result, determining the initial CPU cores to be bound includes:

[0015] The number of idle CPU cores within the target NUMA to be allocated is determined based on the affinity results.

[0016] Determine whether the number of idle CPU cores is greater than or equal to the initial number of CPU cores;

[0017] If so, the initial CPU core to be bound is determined from the idle CPU cores within the NUMA.

[0018] In one specific embodiment of the present invention, after creating the target application using the initial CPU core, the method further includes:

[0019] Collect CPU usage data of the target application;

[0020] Calculate the number of target CPU cores to be allocated to the target application based on the CPU usage data;

[0021] The target number of CPU cores is compared with the initial number of CPU cores to obtain the comparison result;

[0022] When it is determined from the comparison results that rebinding of the cores is necessary, the core binding operation is performed again on the target application.

[0023] In one specific embodiment of the present invention, when it is determined based on the comparison result that re-binding of cores is required, the core binding operation is re-performed on the target application, including:

[0024] When the comparison result shows that the target number of CPU cores is greater than the initial number of CPU cores, the core binding operation is re-performed on the target application.

[0025] In one specific embodiment of the present invention, when it is determined based on the comparison result that re-binding of cores is required, the core binding operation is re-performed on the target application, including:

[0026] When it is determined from the comparison results that rebinding of cores is required and there are available CPU resources for binding, the core binding operation is performed again on the target application.

[0027] In one specific embodiment of the present invention, calculating the number of target CPU cores to be allocated to the target application based on the CPU usage data includes:

[0028] Construct a target histogram corresponding to the CPU usage data using a half-life exponential histogram model;

[0029] Calculate the estimated number of CPU cores to be allocated to the target application based on the target peak value of the target histogram;

[0030] The confidence level is calculated by performing a confidence score calculation on the CPU usage data to obtain the target confidence level;

[0031] The target number of CPU cores is calculated based on the estimated number of CPU cores and the target confidence level.

[0032] In one specific embodiment of the present invention, the confidence level of the CPU usage data is calculated to obtain a target confidence level, including:

[0033] Obtain the first sampling time corresponding to the first sampling within a preset time period;

[0034] Obtain the second sampling time corresponding to the last sampling within the preset time period;

[0035] Calculate the difference between the second sampling time and the first sampling time;

[0036] Obtain the total number of CPU usage data samples collected within the preset time period;

[0037] The number of subsamples of CPU usage data collected within a preset unit of time is calculated based on the total number of samples; wherein the preset unit of time is consistent with the time unit of the difference.

[0038] The smaller of the difference and the number of subsamples is selected as the target confidence level.

[0039] An application creation apparatus, comprising:

[0040] The initial CPU core acquisition module is used to acquire the initial number of CPU cores to be allocated to the target application when the target application is created using BestEffort Pod.

[0041] The NUMA affinity initialization core number acquisition module is used to obtain the preset CPU NUMA affinity initialization core number;

[0042] The affinity result acquisition module is used to perform CPU NUMA affinity operation based on the number of CPU NUMA affinity initialization cores to obtain the affinity result;

[0043] An initial CPU core determination module is used to determine the initial CPU core to be bound when the CPU core binding conditions are met based on the initial number of CPU cores and the affinity result.

[0044] An application creation module is used to bind the target application to the initial CPU core, so as to create the target application using the initial CPU core.

[0045] An application creates a device, comprising:

[0046] Memory, used to store computer programs;

[0047] A processor for executing the computer program to implement the steps of the application creation method as described above.

[0048] A computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the application creation method as described above.

[0049] The application creation method provided by this invention, when creating a target application using BestEffort Pod, obtains the initial number of CPU cores to be allocated to the target application; obtains the preset number of CPU NUMA affinity initialization cores; performs CPU NUMA affinity operation based on the number of CPU NUMA affinity initialization cores to obtain affinity results; when it is determined that the CPU core binding conditions are met based on the initial number of CPU cores and the affinity results, determines the initial CPU core to be bound; and binds the target application to the initial CPU core to create the target application using the initial CPU core.

[0050] As described in the above technical solution, by pre-setting the number of CPU NUMA affinity initialization cores, when an application needs to be created, a CPU NUMA affinity operation is performed based on this number of cores to obtain the affinity result. The initial number of CPU cores to be allocated to the target application when creating the target application using the BestEffort Pod is then obtained. Based on the obtained initial CPU core number and the affinity result, it is determined whether the CPU core binding condition is met. If the condition is met, the initial CPU core to be bound is determined; the target application is then bound to the initial CPU core, thereby creating the target application using the initial CPU core. By performing CPU NUMA affinity operations on Pods with a service quality of BestEffort, the ability of the BestEffort Pod to efficiently execute business logic is improved, request latency is reduced, and application running efficiency is increased.

[0051] Accordingly, the present invention also provides an application creation apparatus, device, and computer-readable storage medium corresponding to the above-described application creation method, which have the aforementioned technical effects, and will not be elaborated further here. Attached Figure Description

[0052] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0053] Figure 1 This is a flowchart illustrating one implementation of the creation method in this invention.

[0054] Figure 2 This is a flowchart illustrating another implementation of the creation method in this invention.

[0055] Figure 3 This is a framework diagram of a method for performing CPU NUMA affinity operation on a BestEffort Pod according to an embodiment of the present invention;

[0056] Figure 4 This is a structural block diagram of an application creation device according to an embodiment of the present invention;

[0057] Figure 5 This is a structural block diagram of an application creation device according to an embodiment of the present invention;

[0058] Figure 6 This is a schematic diagram of the specific structure of an application creation device provided in this embodiment. Detailed Implementation

[0059] To enable those skilled in the art to better understand the present invention, the invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. Obviously, the described embodiments are merely some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0060] See Figure 1 , Figure 1 This is a flowchart illustrating one implementation of the creation method in this invention. The method may include the following steps:

[0061] S101: When creating a target application using the BestEffort Pod, obtain the initial number of CPU cores to be allocated to the target application.

[0062] When creating a target application using a BestEffort Pod, obtain the initial number of CPU cores to be allocated to the target application. For example, you can determine the amount of CPU resources required for the target application to run normally based on its basic configuration information, and then determine the initial number of CPU cores to be allocated to the target application based on the determined amount of CPU resources required.

[0063] S102: Get the preset number of CPU NUMA affinity initialization cores.

[0064] Pre-set the number of CPU NUMA affinity initialization cores for the application, such as setting it to 1. After obtaining the initial number of CPU cores to be allocated to the target application, obtain the preset number of CPU NUMA affinity initialization cores.

[0065] NUMA (Non-Uniform Memory Access) architecture is a state-of-the-art computer architecture designed to improve computing performance. Taking memory as an example, this architecture is divided into local memory and remote memory. Local memory is considered to be shared with a group of CPUs, referred to as being on the same NUMA. If a CPU on one NUMA accesses memory on another NUMA, it can be considered to be accessing remote memory. Therefore, accessing local memory is significantly more efficient.

[0066] The deployed application will eventually run in the form of Pods. The role of CPU NUMA affinity is to ensure that the resources used by the running Pod are on a NUMA node as much as possible, and to run on a fixed CPU as much as possible.

[0067] S103: Perform CPU NUMA affinity operation based on the number of CPU NUMA affinity initialization cores to obtain the affinity result.

[0068] After obtaining the preset number of CPU NUMA affinity initialization cores, CPU NUMA affinity operations are performed based on these cores. This can be done by calling the cgroups interface to obtain the affinity results. For example, the number of idle CPU cores within the target NUMA to be allocated can be found based on the CPU NUMA affinity initialization cores.

[0069] cgroups interface: cgroups provides two mechanisms for system resource management, cgroupfs and systemd; systemd is the way to expose system resource management by providing an interface for external calls.

[0070] S104: When the CPU core binding conditions are met based on the initial number of CPU cores and the affinity results, determine the initial CPU cores to be bound.

[0071] After obtaining the initial number of CPU cores to be allocated to the target application and acquiring the affinity result, it is determined whether the CPU core binding conditions are met based on the initial number of CPU cores and the affinity result. If the CPU core binding conditions are met based on the initial number of CPU cores and the affinity result, the initial CPU core to be bound is determined. If an allocation priority is pre-set for each idle CPU core in the target NUMA to be allocated, the CPU core with the highest initial number of CPU cores can be selected from the idle CPU cores in the target NUMA to be allocated according to the pre-set allocation priority.

[0072] CPU core binding conditions can be set to ensure that the number of idle CPU cores in the target NUMA to be allocated meets the number of CPU cores required for the creation of the target application.

[0073] In one specific embodiment of the present invention, step S104 may include the following steps:

[0074] Step 1: Determine the number of idle CPU cores within the target NUMA to be allocated based on the affinity results;

[0075] Step 2: Determine if the number of idle CPU cores is greater than or equal to the initial number of CPU cores. If yes, proceed to Step 3; otherwise, do not perform core binding.

[0076] Step 3: Determine the initial CPU core to be bound from the idle CPU cores within the NUMA.

[0077] For ease of description, the three steps above can be combined for explanation.

[0078] When determining whether the CPU core binding condition is met based on the initial number of CPU cores and the affinity result, the number of idle CPU cores in the target NUMA to be allocated is determined according to the affinity result. It is then determined whether the number of idle CPU cores is greater than or equal to the initial number of CPU cores. If so, it means that the number of idle CPU cores in the target NUMA to be allocated can meet the number of CPU cores required for the creation of the target application. The initial CPU core to be bound is then determined from the idle CPU cores in the NUMA. If not, it means that the number of idle CPU cores in the target NUMA to be allocated cannot meet the number of CPU cores required for the creation of the target application, and core binding is not performed.

[0079] S105: Bind the target application to the initial CPU core to create the target application using the initial CPU core.

[0080] After determining the CPU core binding conditions based on the initial number of CPU cores and affinity results, and identifying the initial CPU cores to be bound, the target application is bound to the initial CPU core, thereby creating the target application using the initial CPU core. By performing CPU NUMA affinity operations on Pods with a service quality of BestEffort, and binding the target application to the CPU core when the binding conditions are met, the target application's ability to execute business logic is improved, request latency is reduced, and application running efficiency is increased.

[0081] Core binding refers to the practice of limiting an application to run on a fixed number of CPUs in order to improve its processing performance.

[0082] As described in the above technical solution, by pre-setting the number of CPU NUMA affinity initialization cores, when an application needs to be created, a CPU NUMA affinity operation is performed based on this number of cores to obtain the affinity result. The initial number of CPU cores to be allocated to the target application when creating the target application using the BestEffort Pod is then obtained. Based on the obtained initial CPU core number and the affinity result, it is determined whether the CPU core binding condition is met. If the condition is met, the initial CPU core to be bound is determined; the target application is then bound to the initial CPU core, thereby creating the target application using the initial CPU core. By performing CPU NUMA affinity operations on Pods with a service quality of BestEffort, the ability of the BestEffort Pod to efficiently execute business logic is improved, request latency is reduced, and application running efficiency is increased.

[0083] It should be noted that, based on the above embodiments, the present invention also provides corresponding improvements. In subsequent embodiments, steps identical or corresponding to those in the above embodiments can be referenced interchangeably, and their respective beneficial effects can also be referred to each other. These improvements will not be elaborated upon in the following improved embodiments.

[0084] See Figure 2 , Figure 2 This is a flowchart illustrating another implementation of the application creation method in this invention. The method may include the following steps:

[0085] S201: When creating a target application using the BestEffort Pod, obtain the initial number of CPU cores to be allocated to the target application.

[0086] S202: Get the preset number of CPU NUMA affinity initialization cores.

[0087] The number of CPU NUMA affinity cores for application initialization can be preset using the following YAML file:

[0088] S203: Perform CPU NUMA affinity operation based on the number of CPU NUMA affinity initialization cores to obtain the affinity result.

[0089] S204: When the initial number of CPU cores and affinity results determine that the CPU core binding conditions are met, determine the initial CPU cores to be bound.

[0090] S205: Bind the target application to the initial CPU core to create the target application using the initial CPU core.

[0091] S206: Collect CPU usage data of the target application.

[0092] After creating the target application using the initial CPU cores, collect the CPU usage data of the target application. This can be done by continuously collecting CPU usage data over a period of time.

[0093] S207: Calculate the number of target CPU cores to be allocated to the target application based on CPU usage data.

[0094] After collecting CPU usage data from the target application, the number of target CPU cores to be allocated to the target application is calculated based on this data. This yields the number of target CPU cores required for the target application to currently run.

[0095] In one specific embodiment of the present invention, step S207 may include the following steps:

[0096] Step 1: Construct the target histogram corresponding to CPU usage data using the half-life exponent histogram model;

[0097] Step 2: Calculate the estimated number of CPU cores to be allocated to the target application based on the target peak value of the target histogram;

[0098] Step 3: Calculate the confidence level of the CPU usage data to obtain the target confidence level;

[0099] Step 4: Calculate the target number of CPU cores based on the estimated number of CPU cores and the target confidence level.

[0100] For ease of description, the four steps above can be combined for explanation.

[0101] After collecting CPU usage data of the target application, the target number of CPU cores to be allocated to the target application is calculated based on the CPU usage data. The estimated number of CPU cores to be allocated to the target application is calculated based on the target peak value of the target histogram. The confidence level of the CPU usage data is calculated to obtain the target confidence level. The target number of CPU cores is calculated based on the estimated number of CPU cores and the target confidence level.

[0102] In one specific embodiment of the present invention, calculating the confidence level of CPU usage data to obtain a target confidence level may include the following steps:

[0103] Step 1: Obtain the first sampling time corresponding to the first sampling within the preset time period;

[0104] Step 2: Obtain the second sampling time corresponding to the last sampling within the preset time period;

[0105] Step 3: Calculate the difference between the second sampling time and the first sampling time;

[0106] Step 4: Obtain the total number of CPU usage data samples collected within the preset time period;

[0107] Step 5: Calculate the number of subsamples of CPU usage data collected within a preset unit of time based on the total number of samples; the preset unit of time is consistent with the time unit of the difference.

[0108] Step 6: Select the smaller of the difference and the number of subsamples as the target confidence level.

[0109] For ease of description, the above six steps can be combined for explanation.

[0110] After acquiring CPU usage data, the first sampling time corresponding to the first sample within the preset time period is obtained, the second sampling time corresponding to the last sample within the preset time period is obtained, the difference between the second sampling time and the first sampling time is calculated, the total number of CPU usage data samples collected within the preset time period is obtained, and the smaller of the difference and the number of samples is selected as the target confidence level.

[0111] In a specific application instance, the process of calculating the target number of CPU cores to be allocated to the target application based on CPU usage data may include:

[0112] (1) The collected CPU usage data is used with a half-life exponential histogram model to prioritize the proportion of current CPU usage data used to predict future data. That is, the closer the CPU usage data is to the current target CPU core count calculation time, the higher the proportion. The formula is as follows:

[0113]

[0114] Where cdf is the cumulative distribution function, p x (j) represents the probability of the occurrence of time series data, which follows an exponential distribution, P(x<k=1-e -λx , where x is the collected CPU usage data sample.

[0115] (2) Estimate based on the different peak values ​​in the histogram using quantiles.

[0116] estimator percent =Percent*Peaks*(1+margnFrac);

[0117] Percent has three possible values: 0.9 for the target Estimator, 0.5 for the lower Bound Estimator, and 0.95 for the upper Bound Estimator. margnFrac is the harmonic parameter, with an empirical value of 0.15. Peaks represent the peak values ​​of a given interval in the histogram distribution. percent This is an estimate of the number of CPU cores.

[0118] This calculation method takes into account the influence of the peak value within the sampling time period. In this embodiment of the invention, Percent = 0.9 is selected.

[0119] (3) Calculate the confidence level of the currently collected CPU usage data.

[0120]

[0121] Among them, Time last_smaple Time is the time of the last observed sampling within a day. first_smaple The sampling time is the first observation within a day, and life_span_in_day is the difference between the first and last sampling times within a day.

[0122]

[0123] Among them, Total samplesThis represents the total number of samples collected within one day, while sample_amount represents the number of samples collected within one minute.

[0124] Confidence=Min(life_span_in_day,sampl_amount);

[0125] The smaller value between life_span_in_day and sample_amount is used as the coefficient (confidence level) for the current sample to participate in the calculation of future data.

[0126] (4) The estimated value is processed according to the confidence level harmonic coefficient, and finally the number of CPU cores to be used in the future is calculated.

[0127] scale = estimator percent *(1+mul / confidence) exp ;

[0128] Where mul is set to the empirical value of 0.001 and exp is set to the empirical value of -2.

[0129] S208: Compare the target number of CPU cores with the initial number of CPU cores to obtain the comparison result.

[0130] After calculating the target number of CPU cores to be allocated to the target application based on CPU usage data, the target number of CPU cores is compared with the initial number of CPU cores to obtain the comparison result. By comparing the target number of CPU cores with the initial number of CPU cores, the size relationship between the target number of CPU cores and the initial number of CPU cores is obtained.

[0131] S209: When it is determined from the comparison results that rebinding is required, rebind the target application to the core.

[0132] After comparing the target number of CPU cores with the initial number of CPU cores, and obtaining the comparison result, if it is determined that rebinding of cores is necessary, the core binding operation is re-performed for the target application. If it is determined that the target number of CPU cores is greater than the initial number of CPU cores, it means that the target application needs additional CPU cores to ensure that the target application can run normally. In this case, the core binding operation is re-performed for the target application. This achieves adaptive adjustment of the number of CPU cores for the target application.

[0133] In one specific embodiment of the present invention, step S209 may include the following steps:

[0134] After comparing the target number of CPU cores with the initial number of CPU cores, if the target number of CPU cores is greater than the initial number of CPU cores, it means that the target application needs to add CPU cores to ensure that the target application can run normally, and the core binding operation of the target application is re-performed.

[0135] If the comparison result shows that the target number of CPU cores is greater than the initial number of CPU cores, the core binding operation is re-performed on the target application.

[0136] In one specific embodiment of the present invention, step S209 may include the following steps:

[0137] When the comparison results determine that rebinding is necessary and there are available CPU resources for rebinding, the target application is re-binded.

[0138] After determining that rebinding of CPU cores is necessary based on a comparison between the target number of CPU cores and the initial number of CPU cores, it is necessary to check whether there are any available CPU resources for rebinding. If the comparison determines that rebinding is necessary and available CPU resources exist, the core binding operation is performed again on the target application. By checking for available CPU resources in advance, the accuracy of the core binding operation is improved.

[0139] In a specific application example, see Figure 3 , Figure 3 This is a framework diagram for performing CPU NUMA affinity operations on BestEffortPod in an embodiment of the present invention. When a Kubernetes application is generated through a management device, the target application is created using BestEffortPod based on the workload of the target application. Containers share a network namespace (ns). When the CPU core binding conditions are met based on the initial number of CPU cores and the affinity result, the initial CPU cores to be bound are determined, and the Pod core binding annotation data is obtained. This Pod core binding annotation data is sent to the CPU data acquisition and computing device. The CPU data acquisition and computing device performs CPU core binding based on the cgroups kernel mechanism, and calculates the optimal number of CPU cores to be allocated for binding based on the current Kubernetes CPU core binding algorithm. If there is no optimal number of CPU cores to be allocated, core binding is not performed temporarily. The physical layer senses the CPU physical resources and sends the sensed CPU physical resources to the operating system. The operating system sends instructions to the CPU data acquisition and computing device to collect CPU data used by the application. The CPU data acquisition and computing device continuously collects CPU usage data consumed by the application, and calculates the amount of CPU that the application will use in the future through built-in algorithms, updates the Pod core binding annotation data, and then rebinds the cores.

[0140] The cgroups (Control Groups) mechanism is a mechanism provided by the Linux kernel. This mechanism can integrate or separate a series of system tasks and their subtasks into different groups based on resource levels, thereby providing a unified framework for system resource management.

[0141] The existing CPU core binding algorithm in Kubernetes refers to the algorithm used by the existing cpuManager component to calculate the number of CPUs before binding them. It prioritizes allocating CPUs for the entire socket, followed by the CPUs for the entire core, and finally allocates CPUs based on Logical Cores.

[0142] Socket (a physical CPU): Multiple cores are packaged together, and this package is generally called a socket.

[0143] Core (physical core): Each core in a socket is called a Core.

[0144] Logical Core: When a core enables hyper-threading, it appears as multiple "cores" at the system level, typically two. This core is called a Logical Core.

[0145] Corresponding to the above method embodiments, the present invention also provides an application creation apparatus, the application creation apparatus described below and the application creation method described above can be referred to in correspondence.

[0146] See Figure 4 , Figure 4 This is a structural block diagram of an application creation device according to an embodiment of the present invention. The device may include:

[0147] The initial CPU core acquisition module 41 is used to acquire the initial CPU cores to be allocated to the target application when the target application is created using BestEffort Pod.

[0148] The NUMA affinity initialization core number acquisition module 42 is used to acquire the preset CPU NUMA affinity initialization core number;

[0149] The affinity result acquisition module 43 is used to perform CPU NUMA affinity operation based on the number of CPU NUMA affinity initialization cores and obtain the affinity result;

[0150] The initial CPU core determination module 44 is used to determine the initial CPU core to be bound when the CPU core binding conditions are met based on the initial number of CPU cores and the affinity result.

[0151] Application creation module 45 is used to bind the target application to the initial CPU core so as to create the target application using the initial CPU core.

[0152] As described in the above technical solution, by pre-setting the number of CPU NUMA affinity initialization cores, when an application needs to be created, a CPU NUMA affinity operation is performed based on this number of cores to obtain the affinity result. The initial number of CPU cores to be allocated to the target application when creating the target application using the BestEffort Pod is then obtained. Based on the obtained initial CPU core number and the affinity result, it is determined whether the CPU core binding condition is met. If the condition is met, the initial CPU core to be bound is determined; the target application is then bound to the initial CPU core, thereby creating the target application using the initial CPU core. By performing CPU NUMA affinity operations on Pods with a service quality of BestEffort, the ability of the BestEffort Pod to efficiently execute business logic is improved, request latency is reduced, and application running efficiency is increased.

[0153] In one specific embodiment of the present invention, the initial CPU core determination module 44 includes:

[0154] The idle CPU cores determination submodule is used to determine the number of idle CPU cores in the target NUMA to be allocated based on the affinity result;

[0155] The judgment submodule is used to determine whether the number of idle CPU cores is greater than or equal to the initial number of CPU cores;

[0156] The initial CPU core determination submodule is used to determine the initial CPU core to be bound from the idle CPU cores in NUMA when the number of idle CPU cores is greater than or equal to the initial number of CPU cores.

[0157] In one specific embodiment of the present invention, the device may further include:

[0158] The CPU uses a data acquisition module to collect CPU usage data of the target application after it has been created using the initial CPU cores.

[0159] The CPU cores to be allocated calculation module is used to calculate the target CPU cores to be allocated to the target application based on CPU usage data;

[0160] The comparison result acquisition module is used to compare the target number of CPU cores with the initial number of CPU cores to obtain the comparison result;

[0161] The rebinding module is used to rebind the target application to the core when it is determined from the comparison results that rebinding is necessary.

[0162] In one specific embodiment of the present invention, the re-binding module is a module that re-binds the target application when the comparison result shows that the number of target CPU cores is greater than the number of initial CPU cores.

[0163] In one specific embodiment of the present invention, the re-binding module is specifically a module that re-binds the target application when it is determined from the comparison results that re-binding is required and there are available CPU resources for binding.

[0164] In one specific embodiment of the present invention, the CPU core count calculation module to be allocated includes:

[0165] The histogram construction submodule is used to construct the target histogram corresponding to CPU usage data using the half-life exponential histogram model.

[0166] The core count estimation calculation submodule is used to calculate the estimated number of CPU cores to be allocated to the target application based on the target peak value of the target histogram;

[0167] The confidence calculation submodule is used to calculate the confidence score of CPU usage data to obtain the target confidence score.

[0168] The CPU core count calculation submodule is used to calculate the target CPU core count based on the estimated CPU core count and the target confidence level.

[0169] In one specific embodiment of the present invention, the confidence calculation submodule includes:

[0170] The first sampling time acquisition unit is used to acquire the first sampling time corresponding to the first sampling within a preset time period;

[0171] The second sampling time acquisition unit is used to acquire the second sampling time corresponding to the last sampling within a preset time period;

[0172] The time difference calculation unit is used to calculate the difference between the second sampling time and the first sampling time;

[0173] The total sample size acquisition unit is used to acquire the total number of CPU usage data samples collected within a preset time period;

[0174] The fractional sample count calculation unit is used to calculate the fractional sample count of CPU usage data collected within a preset unit of time based on the total number of samples; wherein the preset unit of time is consistent with the time unit of the difference.

[0175] The confidence calculation unit is used to select the smaller of the difference and the number of subsamples as the target confidence level.

[0176] For the method embodiments described above, see [link to relevant documentation]. Figure 5 , Figure 5A schematic diagram of an application creation device provided by the present invention, the device may include:

[0177] Memory 332 is used to store computer programs;

[0178] The processor 322 is used to implement the steps of the application creation method described in the above method embodiments when executing a computer program.

[0179] For details, please refer to Figure 5 , Figure 5 This is a schematic diagram illustrating the specific structure of an application creation device provided in this embodiment. The application creation device can vary significantly due to differences in configuration or performance. It may include a processor (central processing unit, CPU) 322 (e.g., one or more processors) and a memory 332. The memory 332 stores one or more computer application programs 342 or data 344. The memory 332 can be temporary or persistent storage. The program stored in the memory 332 may include one or more modules (not shown in the diagram), each module including a series of instruction operations on the data processing device. Furthermore, the processor 322 may be configured to communicate with the memory 332 and execute the series of instruction operations stored in the memory 332 on the application creation device 301.

[0180] The application creation device 301 may also include one or more power supplies 326, one or more wired or wireless network interfaces 350, one or more input / output interfaces 358, and / or one or more operating systems 341.

[0181] The steps in the application creation method described above can be implemented by the structure of the application creation device.

[0182] Corresponding to the above method embodiments, the present invention also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, can perform the following steps:

[0183] When creating a target application using the BestEffort Pod, the following steps are taken: First, obtain the initial number of CPU cores to be allocated to the target application. Second, obtain the preset number of CPU NUMA affinity initialization cores. Third, perform CPU NUMA affinity operations based on the CPU NUMA affinity initialization cores to obtain the affinity result. Fourth, if the CPU core binding conditions are met based on the initial number of CPU cores and the affinity result, determine the initial CPU core to be bound. Finally, bind the target application to the initial CPU core to create the target application using the initial CPU core.

[0184] The computer-readable storage medium may include various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0185] For a description of the computer-readable storage medium provided by the present invention, please refer to the above method embodiments; the present invention will not be described in detail here.

[0186] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatuses, devices, and computer-readable storage media disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple; relevant parts can be referred to the method section.

[0187] This article uses specific examples to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the technical solutions and core ideas of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made to the present invention without departing from the principles of the present invention, and these improvements and modifications also fall within the protection scope of the claims of the present invention.

Claims

1. An application creation method, characterized in that, include: When creating a target application using the BestEffort Pod, obtain the initial number of CPU cores to be allocated to the target application; Obtain the preset number of CPU NUMA affinity initialization cores; Perform CPU NUMA affinity operation based on the number of CPU NUMA affinity initialization cores to obtain the affinity result; When it is determined that the CPU core binding conditions are met based on the initial number of CPU cores and the affinity result, the initial CPU cores to be bound are determined. The target application is bound to the initial CPU core to create the target application using the initial CPU core; After creating the target application using the initial CPU core, the process also includes: Collect CPU usage data of the target application; Calculate the number of target CPU cores to be allocated to the target application based on the CPU usage data; The target number of CPU cores is compared with the initial number of CPU cores to obtain the comparison result; When it is determined from the comparison results that rebinding of cores is necessary, the core binding operation is performed again on the target application. Calculate the target number of CPU cores to be allocated to the target application based on the CPU usage data, including: Construct a target histogram corresponding to the CPU usage data using a half-life exponential histogram model; Calculate the estimated number of CPU cores to be allocated to the target application based on the target peak value of the target histogram; The confidence level is calculated by performing a confidence score calculation on the CPU usage data to obtain the target confidence level; The target number of CPU cores is calculated based on the estimated number of CPU cores and the target confidence level. The confidence level of the CPU usage data is calculated to obtain the target confidence level, including: Obtain the first sampling time corresponding to the first sampling within a preset time period; Obtain the second sampling time corresponding to the last sampling within the preset time period; Calculate the difference between the second sampling time and the first sampling time; Obtain the total number of CPU usage data samples collected within the preset time period; The number of subsamples of CPU usage data collected within a preset unit of time is calculated based on the total number of samples; wherein the preset unit of time is consistent with the time unit of the difference. The smaller of the difference and the number of subsamples is selected as the target confidence level.

2. The application creation method according to claim 1, characterized in that, When it is determined that the CPU core binding conditions are met based on the initial number of CPU cores and the affinity result, the initial CPU cores to be bound are determined, including: The number of idle CPU cores within the target NUMA to be allocated is determined based on the affinity results. Determine whether the number of idle CPU cores is greater than or equal to the initial number of CPU cores; If so, the initial CPU core to be bound is determined from the idle CPU cores within the NUMA.

3. The application creation method according to claim 1 or 2, characterized in that, When it is determined based on the comparison results that re-binding of cores is necessary, the core binding operation is re-performed on the target application, including: When the comparison result shows that the target number of CPU cores is greater than the initial number of CPU cores, the core binding operation is re-performed on the target application.

4. The application creation method according to claim 1 or 2, characterized in that, When it is determined based on the comparison results that re-binding of cores is necessary, the core binding operation is re-performed on the target application, including: When it is determined from the comparison results that rebinding of cores is required and there are available CPU resources for binding, the core binding operation is performed again on the target application.

5. An application creation apparatus, characterized in that, include: The initial CPU core acquisition module is used to acquire the initial number of CPU cores to be allocated to the target application when the target application is created using BestEffort Pod. The NUMA affinity initialization core number acquisition module is used to obtain the preset CPU NUMA affinity initialization core number; The affinity result acquisition module is used to perform CPU NUMA affinity operation based on the number of CPU NUMA affinity initialization cores to obtain the affinity result; An initial CPU core determination module is used to determine the initial CPU core to be bound when the CPU core binding conditions are met based on the initial number of CPU cores and the affinity result. An application creation module is used to bind the target application to the initial CPU core, so as to create the target application using the initial CPU core; Also includes: The CPU uses a data acquisition module to collect CPU usage data of the target application after it has been created using the initial CPU cores. The CPU cores to be allocated calculation module is used to calculate the target CPU cores to be allocated to the target application based on CPU usage data; The comparison result acquisition module is used to compare the target number of CPU cores with the initial number of CPU cores to obtain the comparison result; The rebinding module is used to rebind the target application with the core when it is determined from the comparison results that rebinding is necessary. The CPU core count calculation module includes: The histogram construction submodule is used to construct the target histogram corresponding to CPU usage data using the half-life exponential histogram model. The core count estimation calculation submodule is used to calculate the estimated number of CPU cores to be allocated to the target application based on the target peak value of the target histogram; The confidence calculation submodule is used to calculate the confidence score of CPU usage data to obtain the target confidence score. The CPU core count calculation submodule is used to calculate the target CPU core count based on the estimated CPU core count and the target confidence level. The confidence calculation submodule includes: The first sampling time acquisition unit is used to acquire the first sampling time corresponding to the first sampling within a preset time period; The second sampling time acquisition unit is used to acquire the second sampling time corresponding to the last sampling within a preset time period; The time difference calculation unit is used to calculate the difference between the second sampling time and the first sampling time; The total sample size acquisition unit is used to acquire the total number of CPU usage data samples collected within a preset time period; The fractional sample count calculation unit is used to calculate the fractional sample count of CPU usage data collected within a preset unit of time based on the total number of samples; wherein the preset unit of time is consistent with the time unit of the difference. The confidence calculation unit is used to select the smaller of the difference and the number of subsamples as the target confidence level.

6. An application creation device, characterized in that, include: Memory, used to store computer programs; A processor for executing the computer program to implement the steps of the application creation method as described in any one of claims 1 to 4.

7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the application creation method as described in any one of claims 1 to 4.

Citation Information

Patent Citations

  • Virtual machine anomaly detection method and device, equipment and computer readable storage medium

    CN110046054A

  • Method and device for binding kernel of CPU of Kubernetes container platform

    CN112052068A