A container creation method, device, equipment and medium

By obtaining container creation requests and using the topology structure and resource usage information of CPU and memory to determine the target resources, the problem of high CPU and memory latency in containerized intensive computing is solved, and the effect of reducing memory access latency and avoiding performance degradation is achieved. .

CN112685174BActive Publication Date: 2025-02-14BEIJING INSPUR DATA TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202011551453.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-24
Publication Date
2025-02-14
Estimated Expiration
2040-12-24

AI Technical Summary

Technical Problem

In application scenarios based on containerized intensive computing, there is a problem of high CPU and memory latency, resulting in performance degradation.

Method used

By obtaining container creation requests, obtaining the topology of CPU and memory and resource usage information, determine the target CPU resources and target memory resources required to start the container, and bind the container to these resources to start.

Benefits of technology

Reduces memory access latency for containerized intensive computing and avoids performance degradation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112685174B_ABST
    Figure CN112685174B_ABST
Patent Text Reader

Abstract

The present application discloses a container creation method, apparatus, device and medium, including: obtaining a container creation request; wherein the container creation request includes the required number of CPU cores and the required memory size for starting the container; obtaining the topological structure of the CPU and memory and the resource usage information of the current CPU and memory; based on the container creation request, using the topological structure and the resource usage information to determine the target CPU resources and target memory resources required to start the container; binding the container with the target CPU resources and the target memory resources and starting it. That is, the present application takes into account the topological structure of the CPU and memory in the process of determining the target CPU resources and the target memory resources corresponding to the container, so that the determined target CPU resources and the target memory resources can reduce the memory access latency of containerized intensive computing, thereby avoiding performance degradation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of containerization technology, and in particular to a container creation method, device, equipment and medium. Background Art

[0002] Container technology is widely used because it can better meet resource usage requirements and improve work efficiency. At present, in application scenarios based on container-based intensive computing, there is a problem of high CPU and memory latency. Therefore, how to reduce the memory access latency of container-based intensive computing and avoid performance degradation is a problem that needs to be solved at present. Summary of the invention

[0003] In view of this, the purpose of this application is to provide a container creation method, device, equipment and medium, which can reduce the memory access latency of container-intensive computing, thereby avoiding performance degradation. The specific scheme is as follows:

[0004] In a first aspect, the present application discloses a container creation method, comprising:

[0005] Obtain a container creation request; wherein the container creation request includes the required number of CPU cores and the required memory size to start the container;

[0006] Get the CPU and memory topology and current CPU and memory resource usage information;

[0007] Determine the target CPU resources and target memory resources required to start the container based on the container creation request by using the topology structure and the resource usage information;

[0008] The container is bound to the target CPU resources and the target memory resources and started.

[0009] Optionally, determining target CPU resources and target memory resources required to start the container by using the topology structure and the resource usage information based on the container creation request includes:

[0010] For any CPU Socket, if the number of available CPU cores on any CPU die on the CPU Socket is greater than or equal to the required number of CPU cores, and the available memory of the memory closest to the CPU Socket is greater than or equal to the required memory size, then the CPU die is determined as a candidate CPU die, and the memory is determined as a candidate memory corresponding to the CPU die;

[0011] Determine a first candidate node based on the candidate CPU die and the candidate memory corresponding to all the CPU Sockets, determine a first target node from all the first candidate nodes, and obtain target CPU resources and target memory resources;

[0012] Among them, the first candidate node includes the required number of CPU cores on the same candidate CPU die and memory resources of the required memory size in the candidate memory corresponding to the candidate CPU die.

[0013] Optionally, determining target CPU resources and target memory resources required to start the container by using the topology structure and the resource usage information based on the container creation request includes:

[0014] If the number of available CPU cores on any CPU die in any CPU Socket is less than the required number of CPU cores, the number of available CPU cores in the CPU Socket is greater than or equal to the required number of CPU cores, and the available memory of the memory closest to the CPU Socket is greater than or equal to the required memory size, then the CPU Socket is determined as a candidate CPU Socket, and the memory is determined as the candidate memory corresponding to the CPU Socket;

[0015] Determine a second candidate node based on all the CPU Sockets and the candidate memories, determine a second target node from all the second candidate nodes, and obtain a target CPU resource and a target memory resource;

[0016] The second candidate node includes the required number of CPU cores on the same candidate CPU Socket and memory resources of the required memory size in the candidate memory corresponding to the candidate CPU Socket.

[0017] Optionally, determining target CPU resources and target memory resources required to start the container by using the topology structure and the resource usage information based on the container creation request includes:

[0018] If the number of available CPU cores in any CPU Socket is less than the required number of CPU cores, and / or the available memory of the memory closest to the CPU Socket is less than the required memory size, determining the target CPU resources and the target memory resources according to a first preset condition;

[0019] The first preset condition is that the number of CPU Sockets used is the least, and the number of available CPU cores in the CPU Socket and the available memory size of the memory closest to the CPU Socket meet a preset ratio relationship.

[0020] Optionally, determining target CPU resources and target memory resources required to start the container by using the topology structure and the resource usage information based on the container creation request includes:

[0021] If the target CPU resource and the target memory resource cannot be determined according to the first preset condition, determining the target CPU resource and the target memory resource according to the second preset condition;

[0022] The second preset condition is that the sum of the number of used CPU Sockets and the number of memories to be bound that are not the closest to the corresponding CPU Socket is the smallest.

[0023] Optionally, determining a first target node from all the first candidate nodes to obtain target CPU resources and target memory resources includes:

[0024] The first target node is determined from all the first candidate nodes according to the CPU die utilization rate and the memory utilization rate, and the target CPU resources and the target memory resources are obtained.

[0025] Optionally, the method further includes:

[0026] When the container creation request is obtained, it is determined whether a preset resource information file exists locally. If not, the resource information file is created, and the topological structure of the CPU and memory and the resource usage information of the current CPU and memory are added to the resource information file;

[0027] If so, verifying the resource usage information, and updating the resource usage information based on the verification result;

[0028] Accordingly, the acquisition of the topological structure of the CPU and memory and the current resource usage information of the CPU and memory includes:

[0029] The topological structure of the CPU and memory and the resource usage information of the current CPU and memory are obtained from the preset resource information file.

[0030] In a second aspect, the present application discloses a container creation device, comprising:

[0031] A request acquisition module is used to obtain a container creation request; wherein the container creation request includes the required number of CPU cores and the required memory size to start the container;

[0032] Information acquisition module, used to obtain the topological structure of CPU and memory and the current resource usage information of CPU and memory;

[0033] A resource determination module, configured to determine target CPU resources and target memory resources required to start a container based on the container creation request by using the topology structure and the resource usage information;

[0034] The container startup module is used to bind and start the container with the target CPU resources and the target memory resources.

[0035] In a third aspect, the present application discloses an electronic device, comprising:

[0036] Memory, used to store computer programs;

[0037] The processor is used to execute the computer program to implement the aforementioned container creation method.

[0038] In a fourth aspect, the present application discloses a computer-readable storage medium for storing a computer program, wherein the computer program implements the aforementioned container creation method when executed by a processor.

[0039] It can be seen that the present application first obtains a container creation request, wherein the container creation request includes the required number of CPU cores and the required memory size for starting the container, then obtains the topological structure of the CPU and memory and the resource usage information of the current CPU and memory, and then determines the target CPU resources and target memory resources required to start the container based on the container creation request using the topological structure and the resource usage information, and finally binds and starts the container with the target CPU resources and the target memory resources. That is, the present application takes into account the topological structure of the CPU and memory in the process of determining the target CPU resources and the target memory resources corresponding to the container, so that the target CPU resources and the target memory resources determined in this way can reduce the memory access delay of container-intensive computing, thereby avoiding performance degradation. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.

[0041] Figure 1 A flow chart of a container creation method disclosed in this application;

[0042] Figure 2 A topological structure diagram of a specific CPU and memory disclosed in this application;

[0043] Figure 3 A flowchart of a specific container creation method disclosed in this application;

[0044] Figure 4 A flowchart of a specific container creation method disclosed in this application;

[0045] Figure 5 A schematic diagram of a container creation device structure disclosed in this application;

[0046] Figure 6 This is a structural diagram of an electronic device disclosed in this application. DETAILED DESCRIPTION

[0047] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0048] At present, in the application scenarios based on containerized intensive computing, there is a problem of high CPU and memory latency. Therefore, how to reduce the memory access latency of containerized intensive computing and avoid performance degradation is a problem that needs to be solved. To this end, this application provides a container creation solution that can reduce the memory access latency of containerized intensive computing, thereby avoiding performance degradation.

[0049] See also Figure 1 As shown, the embodiment of the present application discloses a container creation method, including:

[0050] Step S11: Obtain a container creation request; wherein the container creation request includes the required number of CPU cores and the required memory size for starting the container.

[0051] Step S12: Acquire the topological structure of the CPU and memory and the current resource usage information of the CPU and memory.

[0052] In a specific implementation, the step S12 may specifically include:

[0053] Step 121: for any CPU Socket, if the number of available CPU cores on any CPU die on the CPU Socket is greater than or equal to the required number of CPU cores, and the available memory of the memory closest to the CPU Socket is greater than or equal to the required memory size, then the CPU die is determined as a candidate CPU die, and the memory is determined as a candidate memory corresponding to the CPU die;

[0054] Step 122: determining a first candidate node based on the candidate CPU dies and the candidate memories corresponding to all the CPU Sockets, determining a first target node from all the first candidate nodes, and obtaining a target CPU resource and a target memory resource;

[0055] The first candidate node includes the number of CPU cores required on the same candidate CPU die and the memory resources of the required memory size in the candidate memory corresponding to the candidate CPU die. Specifically, the first candidate node also includes the CPU core, the topological structure of the memory and the location information.

[0056] For example, the required number of cores is 4, the required memory is 16G, the number of available CPU cores in CPU die1 and die3 in CPU Socket1 is equal to 4, which are core1, core2, core3, core4 in their respective dies, and the available memory of memory1 closest to Socket1 is greater than 16G, then candidate node 1 (core1, core2, core3, core4 in die1, memory1(16G)) and candidate node 2 (core1, core2, core3, core4 in die3, memory1(16G)) are listed.

[0057] In a specific implementation, the first target node can be determined from all the first candidate nodes according to the CPU die utilization rate and the memory utilization rate to obtain the target CPU resources and the target memory resources.

[0058] Specifically, the first candidate node with the highest CPU die utilization and memory utilization can be determined as the first target node. If the CPU die utilization and memory utilization are the same, they are randomly selected. In this way, the same task can be executed on the same CPU die and memory as much as possible.

[0059] That is, the present application first determines the target CPU resources and the target memory resources based on the principle of selecting a CPU core from the same CPU die and the closest memory to the CPUSocket where the current CPU die is located meeting the memory size requirement, thereby avoiding the CPU core from crossing the CPU die.

[0060] Step 123: If the number of available CPU cores on any CPU die in any CPU Socket is less than the required number of CPU cores, the number of available CPU cores in the CPU Socket is greater than or equal to the required number of CPU cores, and the available memory of the memory closest to the CPU Socket is greater than or equal to the required memory size, then the CPU Socket is determined as a candidate CPU Socket, and the memory is determined as a candidate memory corresponding to the CPU Socket;

[0061] Step 124: determining a second candidate node based on all the CPU Sockets and the candidate memories, determining a second target node from all the second candidate nodes, and obtaining a target CPU resource and a target memory resource;

[0062] The second candidate node includes the required number of CPU cores on the same candidate CPU Socket and memory resources of the required memory size in the candidate memory corresponding to the candidate CPU Socket.

[0063] In a specific implementation manner, the second candidate node with the highest CPU Socket usage rate and memory usage rate may be determined as the second target node. If the CPU Socket usage rate and the memory usage rate are the same, a random selection is performed.

[0064] That is, when the CPU core cannot be selected from the same CPU die, the target CPU resources and the target memory resources are determined based on the principle of selecting the CPU core from the same CPU Socket and the memory closest to the current CPU Socket meets the memory size requirement, thereby avoiding the CPU core from crossing the CPU Socket.

[0065] Step 125: If the number of available CPU cores in any CPU Socket is less than the required number of CPU cores, and / or the available memory of the memory closest to the CPU Socket is less than the required memory size, determine the target CPU resources and the target memory resources according to a first preset condition;

[0066] The first preset condition is that the number of CPU Sockets used is the least, and the number of available CPU cores in the CPU Socket and the available memory size of the memory closest to the CPU Socket meet a preset ratio relationship.

[0067] Specifically, the third candidate node can be determined according to the first preset condition, and then the third candidate node with the highest CPU Socket usage and memory usage can be determined as the third target node. If the CPU Socket usage and memory usage are the same, a random selection is performed. The concept of the third candidate node can refer to the first candidate node and the second candidate node mentioned above.

[0068] For example, the requested number of CPU cores is 8, the memory is 32G, the total resources of each Socket are 16Cores, 32GMemory, and the remaining resources are Socket1: 4Cores, 4G Memory; Socket2: 6Cores, 28G Memory; Socket3: 4Cores, 16G Memory; Socket4: 2Cores, 10G Memory; the preset ratio is the requested number of CPU cores: memory size is 1:4G; Socket1 does not meet the ratio, and the alternative nodes can be determined by Socket2+Socket3 and Socket2+Socket4. Because the CPU memory usage of Socket2+Socket4 is greater than that of Socket2+Socket3, the container will be scheduled to the alternative node determined based on Socket2+Socket4.

[0069] Step 126: If the target CPU resource and the target memory resource cannot be determined according to the first preset condition, determine the target CPU resource and the target memory resource according to the second preset condition;

[0070] The second preset condition is that the sum of the number of used CPU Sockets and the number of memories to be bound that are not the closest to the corresponding CPU Sockets is the smallest. If the sum is the same, then the number is determined randomly.

[0071] Step S13: Determine the target CPU resources and target memory resources required to start the container based on the container creation request using the topology structure and the resource usage information.

[0072] Step S14: Bind the container with the target CPU resources and the target memory resources and start them.

[0073] For example, see Figure 2 As shown, Figure 2A specific CPU and memory topology diagram disclosed in an embodiment of the present application. Among them, CPU Core: CPU core, the task processing unit of the CPU. CPU Die: a single CPU chip, usually each CPU Die contains multiple CPU Cores, and the CPU Dies are interconnected through an off-chip bus (Infinity Fabric), and the CPU cores on different CPU Dies cannot share the CPU cache. CPU Socket: a single CPU in a CPU slot, each CPU Socket has one or more Dies. Memory: refers to the memory installed on the physical server. Due to the server topology architecture, the delay of Socket accessing the memory closest to the non-current Socket is greater than the delay of Socket accessing the current Socket, that is, the delay of Socket1 accessing Memory2 is greater than the delay of Socket2 accessing Memory2; and because of the cache sharing mechanism in the CPU, the delay of Core data sharing in Die1 is lower than the delay of Core data sharing in Die1 and Die2. The Core communication between cross-Sockets needs to pass through Memory, and the delay will be more serious. Therefore, the aforementioned method based on the present application determines the target CPU resources and the target memory resources based on the topological structure of the CPU and memory, which can reduce the delay.

[0074] In addition, considering the SMT (Simulate MultiThreading) technology, which refers to the simultaneous execution of multiple threads on a CPU core, intensive computing tasks will be assigned to the same physical core, resulting in performance degradation when switching threads. SMT will be turned off by default during initialization, that is, before resource allocation and scheduling, SMT will be turned off, so that only physical cores will be allocated during resource allocation and scheduling.

[0075] It can be seen that the embodiment of the present application first obtains a container creation request, wherein the container creation request includes the required number of CPU cores and the required memory size for starting the container, then obtains the topological structure of the CPU and memory and the resource usage information of the current CPU and memory, and then determines the target CPU resources and target memory resources required to start the container based on the container creation request using the topological structure and the resource usage information, and finally binds the container to the target CPU resources and the target memory resources and starts it. That is, the embodiment of the present application takes into account the topological structure of the CPU and memory in the process of determining the target CPU resources and the target memory resources corresponding to the container, so that the determined target CPU resources and the target memory resources can reduce the memory access delay of containerized intensive computing, thereby avoiding performance degradation.

[0076] See also Figure 3As shown, the embodiment of the present application discloses a container creation method, including:

[0077] Step S21: Obtain a container creation request; wherein the container creation request includes the required number of CPU cores and required memory size for starting the container;

[0078] Step S22: Determine whether there is a preset resource information file locally. If not, create the resource information file and add the topological structure of the CPU and memory and the resource usage information of the current CPU and memory to the resource information file; if it exists, verify the resource usage information and update the resource usage information based on the verification result.

[0079] It should be noted that when creating the resource information file, the resource usage information added to the resource information file is that all CPUs and memories are available. Specifically, verifying the resource usage information includes: reading the resource usage information in the preset resource information file, judging whether the container previously bound to the CPU and memory exists based on the resource usage information, and if not, updating the resource usage information and marking the corresponding CPU resources and memory resources as available.

[0080] Step S23: Acquire the topological structure of the CPU and memory and the resource usage information of the current CPU and memory from the preset resource information file.

[0081] In a specific implementation, it is determined based on the resource usage information whether the current available CPU resources and available memory resources meet the requirements. If they do, step 24 is started; otherwise, information indicating insufficient resources and scheduling failure is returned.

[0082] Step S24: Determine the target CPU resources and target memory resources required to start the container based on the container creation request using the topology structure and the resource usage information;

[0083] Step S25: Bind the container to the target CPU resources and the target memory resources and start them.

[0084] If the startup is successful, the preset resource information file is updated based on the target CPU resources and the target memory resources, and the target CPU resources and the target memory resources are marked as unavailable; otherwise, failure log information is output.

[0085] Furthermore, the embodiment of the present application writes the corresponding Numa (i.e., Non Uniform Memory Access) controller, Numa scheduler, and Numa launcher based on the aforementioned method, obtains the container creation request through the Numa controller, obtains the topological structure of the CPU and memory and the resource usage information of the current CPU and memory through the Numa scheduler; based on the container creation request, determines the target CPU resources and target memory resources required to start the container using the topological structure and the resource usage information; binds the container to the target CPU resources and the target memory resources through the Numa launcher and starts it.

[0086] For example, see Figure 4 As shown, an embodiment of the present application discloses a specific flow chart of a container creation method.

[0087] 1) After receiving the container creation request, the Numa controller determines whether there is a NumaList file. If there is no NumaList file, it creates a NumaList file, turns off hyperthreading (i.e., SMT technology), and writes the CPU memory topology and whether it can be called into the file. By default, all CPUs and memories can be called. If a NumaList file exists, the CPU and memory information is checked to determine whether the container previously bound to the CPU exists, and the available CPU and memory information is updated. Finally, the startup information, including the required number of CPU cores and the required memory size for starting the container, is passed to the Numa scheduler.

[0088] 2) After receiving the startup information, the Numa scheduler queries the available resources in NumaList. If the CPU and memory resources can meet the startup requirements, the CPU resources and memory resources of the startup container are determined through the scheduling priority algorithm, that is, the method for determining the target CPU resources and target memory resources disclosed in the aforementioned embodiment, and the corresponding information is passed to the Numa launcher; if any of the CPU and memory resources cannot meet the startup requirements, the startup fails and returns insufficient resource information;

[0089] 3) After receiving the information sent by the Numa scheduler, the Numa launcher binds the container with the target CPU resources and target memory resources and starts it. If the container can be started, the successful startup information is returned to the Numa controller; if the startup fails, the log information is output.

[0090] 4) After receiving the successful startup information of the Numa launcher, the Numa controller updates the NumaList file, sets the CPU resources and memory resources used for startup to unavailable, and updates the CPU and memory information.

[0091] See also Figure 5As shown, the embodiment of the present application discloses a container creation device, including:

[0092] The request acquisition module 11 is used to acquire a container creation request; wherein the container creation request includes the required number of CPU cores and the required memory size for starting the container;

[0093] The information acquisition module 12 is used to obtain the topological structure of the CPU and memory and the current resource usage information of the CPU and memory;

[0094] A resource determination module 13, configured to determine target CPU resources and target memory resources required to start a container based on the container creation request using the topology structure and the resource usage information;

[0095] The container startup module 14 is used to bind the container with the target CPU resources and the target memory resources and start them.

[0096] It can be seen that the embodiment of the present application first obtains a container creation request, wherein the container creation request includes the required number of CPU cores and the required memory size for starting the container, then obtains the topological structure of the CPU and memory and the resource usage information of the current CPU and memory, and then determines the target CPU resources and target memory resources required to start the container based on the container creation request using the topological structure and the resource usage information, and finally binds the container to the target CPU resources and the target memory resources and starts it. That is, the embodiment of the present application takes into account the topological structure of the CPU and memory in the process of determining the target CPU resources and the target memory resources corresponding to the container, so that the determined target CPU resources and the target memory resources can reduce the memory access delay of containerized intensive computing, thereby avoiding performance degradation.

[0097] Among them, the resource determination module 13 is specifically used to, for any CPU Socket, if the number of available CPU cores on any CPU die on the CPU Socket is greater than or equal to the required number of CPU cores, and the available memory of the memory closest to the CPU Socket is greater than or equal to the required memory size, then the CPU die is determined as an alternative CPU die, and the memory is determined as the alternative memory corresponding to the CPU die; a first alternative node is determined based on the alternative CPU die and the alternative memory corresponding to all the CPU Sockets, and a first target node is determined from all the first alternative nodes to obtain target CPU resources and target memory resources; wherein the first alternative node includes the required number of CPU cores on the same alternative CPU die and memory resources of the required memory size in the alternative memory corresponding to the alternative CPU die.

[0098] If in any CPU Socket, the number of available CPU cores on any CPU die is less than the required number of CPU cores, the number of available CPU cores in the CPU Socket is greater than or equal to the required number of CPU cores, and the available memory of the memory closest to the CPUSocket is greater than or equal to the required memory size, then the CPU Socket is determined as an alternative CPU Socket, and the memory is determined as the alternative memory corresponding to the CPU Socket; a second alternative node is determined based on all the CPU Sockets and the alternative memories, and a second target node is determined from all the second alternative nodes to obtain target CPU resources and target memory resources; wherein, the second alternative node includes the required number of CPU cores on the same alternative CPU Socket and memory resources of the required memory size in the alternative memory corresponding to the alternative CPU Socket.

[0099] If the number of available CPU cores in any CPU Socket is less than the required number of CPU cores, and / or the available memory of the memory closest to the CPU Socket is less than the required memory size, the target CPU resources and the target memory resources are determined according to a first preset condition; wherein the first preset condition is that the number of CPU Sockets used is the least, and the number of available CPU cores in the CPU Socket used and the available memory size of the memory closest to the CPU Socket satisfy a preset proportional relationship.

[0100] If the target CPU resources and the target memory resources cannot be determined according to the first preset condition, the target CPU resources and the target memory resources are determined according to the second preset condition; wherein the second preset condition is that the sum of the number of CPU Sockets used and the number of memories to be bound that are not closest to the corresponding CPU Socket is the smallest.

[0101] In a specific implementation, the resource determination module 13 is specifically used to determine the first target node from all the first candidate nodes according to the CPU die utilization rate and the memory utilization rate, and obtain the target CPU resources and the target memory resources.

[0102] Furthermore, when the request acquisition module 11 obtains the container creation request, it determines whether there is a preset resource information file locally. If not, it creates the resource information file and adds the topological structure of the CPU and memory and the resource usage information of the current CPU and memory to the resource information file; if it exists, it verifies the resource usage information and updates the resource usage information based on the verification result;

[0103] Correspondingly, the information acquisition module 13 is specifically used to acquire the topological structure of the CPU and memory and the current resource usage information of the CPU and memory from the preset resource information file.

[0104] See also Figure 6 The embodiment of the present application discloses an electronic device 20, including a processor 21 and a memory 22; wherein the memory 22 is used to store a computer program; and the processor 21 is used to execute the computer program to implement the container creation method disclosed in the aforementioned embodiment.

[0105] For the specific process of the above container creation method, reference may be made to the corresponding contents disclosed in the above embodiments, which will not be described in detail here.

[0106] Furthermore, the memory 22 as a carrier for storing resources may be a read-only memory, a random access memory, a magnetic disk or an optical disk, etc., and the storage method may be temporary storage or permanent storage.

[0107] In addition, the electronic device 20 also includes a power supply 23, a communication interface 24, an input / output interface 25 and a communication bus 26; wherein the power supply 23 is used to provide working voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and an external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input / output interface 25 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs, and is not specifically limited here.

[0108] Furthermore, an embodiment of the present application also discloses a computer-readable storage medium for storing a computer program, wherein the computer program, when executed by a processor, implements the container creation method disclosed in the aforementioned embodiment.

[0109] For the specific process of the above container creation method, reference may be made to the corresponding contents disclosed in the above embodiments, which will not be described in detail here.

[0110] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0111] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0112] The above is a detailed introduction to a container creation method, device, equipment and medium provided by the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for general technical personnel in this field, according to the idea of ​​the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A container creation method, characterized in that: include: Obtain a container creation request; wherein the container creation request includes the required number of CPU cores and the required memory size to start the container; Get the CPU and memory topology and current CPU and memory resource usage information; Determine the target CPU resources and target memory resources required to start the container based on the container creation request by using the topology structure and the resource usage information; Bind the container to the target CPU resources and the target memory resources and start the container; The determining of the target CPU resources and target memory resources required to start the container based on the container creation request by using the topology structure and the resource usage information includes: For any CPU Socket, if the number of available CPU cores on any CPU die on the CPU Socket is greater than or equal to the required number of CPU cores, and the available memory of the memory closest to the CPU Socket is greater than or equal to the required memory size, then the CPU die is determined as an alternative CPU die, and the memory is determined as the alternative memory corresponding to the CPU die; a first alternative node is determined based on the alternative CPU dies and the alternative memories corresponding to all the CPU Sockets, and a first target node is determined from all the first alternative nodes to obtain target CPU resources and target memory resources; wherein, the first alternative node includes the required number of CPU cores on the same alternative CPU die and memory resources of the required memory size in the alternative memory corresponding to the alternative CPU die; If the number of available CPU cores on any CPU die in any CPU Socket is less than the required number of CPU cores, the number of available CPU cores in the CPU Socket is greater than or equal to the required number of CPU cores, and the available memory of the memory closest to the CPU Socket is greater than or equal to the required memory size, then the CPU Socket is determined as an alternative CPUSocket, and the memory is determined as the alternative memory corresponding to the CPU Socket; a second candidate node is determined based on all the CPU Sockets and the alternative memories, and a second target node is determined from all the second candidate nodes to obtain a target CPU resource and a target memory resource; wherein the second candidate node includes the required number of CPU cores on the same alternative CPU Socket and memory resources of the required memory size in the alternative memory corresponding to the alternative CPU Socket; If the number of available CPU cores in any CPU Socket is less than the required number of CPU cores, and / or the available memory of the memory closest to the CPU Socket is less than the required memory size, the target CPU resources and the target memory resources are determined according to a first preset condition; wherein the first preset condition is that the number of CPU Sockets used is the least, and the number of available CPU cores in the CPU Socket used and the available memory size of the memory closest to the CPU Socket satisfy a preset proportional relationship.

2. The container creation method according to claim 1, characterized in that: The determining the target CPU resources and target memory resources required to start the container based on the container creation request by using the topology structure and the resource usage information includes: If the target CPU resource and the target memory resource cannot be determined according to the first preset condition, determining the target CPU resource and the target memory resource according to the second preset condition; The second preset condition is that the sum of the number of used CPU Sockets and the number of memories to be bound that are not the closest to the corresponding CPUSocket is the smallest.

3. The container creation method according to claim 1, characterized in that: The step of determining a first target node from all the first candidate nodes and obtaining target CPU resources and target memory resources includes: The first target node is determined from all the first candidate nodes according to the CPU die utilization rate and the memory utilization rate, and the target CPU resources and the target memory resources are obtained.

4. The container creation method according to any one of claims 1 to 3, characterized in that: Also includes: When the container creation request is obtained, it is determined whether a preset resource information file exists locally. If not, the resource information file is created, and the topological structure of the CPU and memory and the resource usage information of the current CPU and memory are added to the resource information file; If so, verifying the resource usage information, and updating the resource usage information based on the verification result; Accordingly, the acquisition of the topological structure of the CPU and memory and the current resource usage information of the CPU and memory includes: The topological structure of the CPU and memory and the resource usage information of the current CPU and memory are obtained from the preset resource information file.

5. A container creation device, characterized in that: include: A request acquisition module is used to obtain a container creation request; wherein the container creation request includes the required number of CPU cores and the required memory size to start the container; Information acquisition module, used to obtain the topological structure of CPU and memory and the current resource usage information of CPU and memory; A resource determination module, configured to determine target CPU resources and target memory resources required to start a container based on the container creation request by using the topology structure and the resource usage information; A container startup module, used to bind the container with the target CPU resources and the target memory resources and start the container; Wherein, the resource determination module is specifically used to: For any CPU Socket, if the number of available CPU cores on any CPU die on the CPU Socket is greater than or equal to the required number of CPU cores, and the available memory of the memory closest to the CPU Socket is greater than or equal to the required memory size, then the CPU die is determined as an alternative CPU die, and the memory is determined as the alternative memory corresponding to the CPU die; a first alternative node is determined based on the alternative CPU dies and the alternative memories corresponding to all the CPU Sockets, and a first target node is determined from all the first alternative nodes to obtain target CPU resources and target memory resources; wherein, the first alternative node includes the required number of CPU cores on the same alternative CPU die and memory resources of the required memory size in the alternative memory corresponding to the alternative CPU die; If the number of available CPU cores on any CPU die in any CPU Socket is less than the required number of CPU cores, the number of available CPU cores in the CPU Socket is greater than or equal to the required number of CPU cores, and the available memory of the memory closest to the CPU Socket is greater than or equal to the required memory size, then the CPU Socket is determined as an alternative CPUSocket, and the memory is determined as the alternative memory corresponding to the CPU Socket; a second candidate node is determined based on all the CPU Sockets and the alternative memories, and a second target node is determined from all the second candidate nodes to obtain a target CPU resource and a target memory resource; wherein the second candidate node includes the required number of CPU cores on the same alternative CPU Socket and memory resources of the required memory size in the alternative memory corresponding to the alternative CPU Socket; If the number of available CPU cores in any CPU Socket is less than the required number of CPU cores, and / or the available memory of the memory closest to the CPU Socket is less than the required memory size, the target CPU resources and the target memory resources are determined according to a first preset condition; wherein the first preset condition is that the number of CPU Sockets used is the least, and the number of available CPU cores in the CPU Socket used and the available memory size of the memory closest to the CPU Socket satisfy a preset proportional relationship.

6. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor, configured to execute the computer program to implement the container creation method according to any one of claims 1 to 4.

7. A computer-readable storage medium, characterized in that: Used to store a computer program, which, when executed by a processor, implements the container creation method according to any one of claims 1 to 4.

Citation Information

Patent Citations

  • Container-based server resource supply method

    CN105245617A

  • CPU resource allocation method and device, electronic equipment and storage medium

    CN111694658A