A method and device for dynamically allocating large pages for cloud native applications

Through the large page device plug-in, the free memory of the working node is monitored and large pages are dynamically allocated, which solves the memory waste and planning difficulty caused by pre-allocation of large page memory in Kubernetes nodes, improves memory usage efficiency and avoids business impact.

CN117251286BActive Publication Date: 2024-11-29CHINA ELECTRONICS CLOUD DIGITAL INTELLIGENCE TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202311282584.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-28
Publication Date
2024-11-29
Estimated Expiration
2043-09-28

AI Technical Summary

Technical Problem

The prior art is wasted memory and difficult to plan when pre-allocating large page memory in Kubernetes nodes, and restarting nodes with large page memory changes will affect services.

Method used

Monitor the free memory of the working node through the large page device plug-in, dynamically select and create large pages, avoid the hassle of allocating large page memory in advance, improve memory usage efficiency, save planning workload, and avoid system large page memory changes and restart nodes affecting business.

Benefits of technology

It effectively improves memory usage efficiency, saves planning workload, and avoids the impact of restarting nodes on the business by changing the memory on the system on large pages.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117251286B_ABST
    Figure CN117251286B_ABST
Patent Text Reader

Abstract

The present application relates to a method and device for dynamically allocating large pages for cloud native applications, and to the field of resource configuration technology. The method includes: configuring a large page device plug-in in each working node; using the large page device plug-in to obtain the node memory information of the corresponding working node, and reporting it to the management node; receiving a Pod creation request, identifying the large page memory requirement information in the Pod creation request; based on the large page memory requirement information and the node memory information of each working node, selecting one of the working nodes as the target working node; calling the target working node, creating a Pod and the corresponding large page. The present application monitors the free memory of the working node based on the large page device plug-in, so as to select the working node and create large pages according to the demand, effectively improve the memory usage efficiency, save planning workload, and avoid the system large page memory change restarting the node and affecting the business.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of resource configuration, and in particular to a method and device for dynamically allocating large pages for cloud native applications. Background Art

[0002] In the field of resource allocation, huge pages are a way to organize and manage the host physical memory in units of 2M, 64M or 1G. The process applies for and releases huge pages in units of 2M, 64M or 1G, so fewer Translation Lookaside Buffers (TLBs) are required.

[0003] Currently, huge page memory is widely used in high-performance scenarios such as DPDK, SPDK, and vDPA. At present, when pre-allocating huge page memory in Kubernetes nodes, the existing technical means will cause certain memory waste and is difficult to implement. Therefore, in order to meet technical requirements, a related technical means for dynamically allocating huge pages for cloud native applications is now provided. Summary of the invention

[0004] The present application provides a method and device for dynamically allocating huge pages for cloud native applications. The method monitors the free memory of working nodes based on huge page device plug-ins, so as to select working nodes and create huge pages according to needs, effectively improve memory usage efficiency, save planning workload, and avoid system huge page memory changes and restart nodes to affect business.

[0005] To achieve the above objectives, this application provides the following solutions.

[0006] In a first aspect, the present application provides a method for dynamically allocating large pages for cloud native applications, the method comprising the following steps:

[0007] Configure the large page device plug-in in each working node;

[0008] Utilize the large page device plug-in to obtain the node memory information of the corresponding working node, and report it to the management node;

[0009] Receive a Pod creation request, and identify large page memory requirement information in the Pod creation request;

[0010] Based on the large page memory requirement information and the node memory information of each of the working nodes, selecting one of the working nodes as a target working node;

[0011] The target working node is called to create the Pod and the corresponding huge page.

[0012] Further, the using the large page device plug-in to obtain the node memory information of the corresponding working node and report it to the management node includes the following steps:

[0013] Utilize the large page device plug-in to calculate the free memory information of the corresponding working node;

[0014] Based on the memory information and the preset large page memory specifications, obtaining the number of large page creation permissions for the working node corresponding to each of the large page memory specifications;

[0015] The node memory information is formed based on the free memory information and the large page creation permission quantity of each large page memory specification.

[0016] Furthermore, the large page memory requirement information includes a total large page memory requirement, a large page memory specification, and a large page quantity.

[0017] Further, based on the large page memory requirement information and the node memory information of each of the working nodes, one of the working nodes is selected as a target working node, including the following steps:

[0018] Compare the large page memory requirement information with the node memory information of each of the working nodes, and filter to obtain each of the working nodes that meets the large page memory requirement information;

[0019] One of the working nodes that meets the large page memory requirement information is selected as a target working node.

[0020] Furthermore, the method further comprises the following steps:

[0021] The creation information of each of the target working nodes that have created the Pod and the large page is recorded.

[0022] In a second aspect, the present application provides a device for dynamically allocating large pages for cloud native applications, the device comprising:

[0023] The plugin configuration module is used to configure the large page device plugin in each working node;

[0024] A quantity statistics module, which is used to obtain the node memory information of the corresponding working node by using the large page device plug-in, and report it to the management node;

[0025] A request response module, which is used to receive a Pod creation request and identify large page memory requirement information in the Pod creation request;

[0026] A node selection module, which is used to select one of the working nodes as a target working node based on the large page memory requirement information and the node memory information of each working node;

[0027] A request execution module is used to call the target working node and create the Pod and the corresponding large page.

[0028] Furthermore, the quantity statistics module is also used to calculate the free memory information of the corresponding working node using the large page device plug-in;

[0029] The quantity statistics module is further used to obtain the number of large page creation permissions of the working node corresponding to each large page memory specification based on the memory information and the preset multiple large page memory specifications;

[0030] The quantity statistics module is further used to form the node memory information based on the free memory information and the number of large page creation permissions of each large page memory specification.

[0031] Furthermore, the large page memory requirement information includes a total large page memory requirement, a large page memory specification, and a large page quantity.

[0032] Furthermore, the node selection module is further used to compare the large page memory requirement information with the node memory information of each of the working nodes, and filter and obtain each of the working nodes that meets the large page memory requirement information;

[0033] The node selection module is also used to select one of the working nodes that meet the large page memory requirement information as a target working node.

[0034] Furthermore, a recording module is created, which is used to record the creation information of each target working node that has created the Pod and the large page.

[0035] The beneficial effects of the technical solution provided by this application include:

[0036] This application monitors the free memory of working nodes based on the large page device plug-in, so as to select working nodes and create large pages according to needs, effectively improve memory usage efficiency, save planning workload, and avoid system large page memory changes and restart nodes to affect business. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] Terminology explanation:

[0038] TLB: Translation Lookaside Buffers, high-speed transmission cache;

[0039] DPDK: Data Plane Development Kit, data plane development kit;

[0040] SPDK: Storage Performance Development Kit, storage high-performance development kit;

[0041] vDPA: Virtual Data Path Acceleration, virtual data path acceleration;

[0042] API: Application Programming Interface, application programming interface.

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

[0044] Figure 1 A flowchart of the steps of the method for dynamically allocating large pages for cloud native applications provided in an embodiment of the present application;

[0045] Figure 2 A technical schematic diagram of a method for dynamically allocating large pages for cloud native applications provided in an embodiment of the present application;

[0046] Figure 3 This is a structural block diagram of an apparatus for dynamically allocating large pages for cloud native applications provided in an embodiment of the present application. DETAILED DESCRIPTION

[0047] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are 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 making creative work are within the scope of protection of this application.

[0048] The embodiments of the present application are further described in detail below in conjunction with the accompanying drawings.

[0049] The embodiments of the present application provide a method and device for dynamically allocating large pages for cloud native applications. The method monitors the free memory of working nodes based on large page device plug-ins, so as to select working nodes and create large pages according to needs, effectively improve memory utilization efficiency, save planning workload, and avoid system large page memory changes and restart nodes to affect business.

[0050] In order to achieve the above technical effects, the overall idea of ​​this application is as follows:

[0051] A method for dynamically allocating large pages for a cloud native application, the method comprising the following steps:

[0052] S1. Configure the large page device plug-in in each working node;

[0053] S2. Use the large page device plug-in to obtain the node memory information of the corresponding working node and report it to the management node;

[0054] S3. Receive a Pod creation request and identify large page memory requirement information in the Pod creation request.

[0055] S4. Based on the large page memory requirement information and the node memory information of each working node, one working node is selected as the target working node from each working node;

[0056] S5. Call the target working node to create a Pod and the corresponding large page.

[0057] The embodiments of the present application are further described in detail below in conjunction with the accompanying drawings.

[0058] First, see Figures 1-2 As shown, an embodiment of the present application provides a method for dynamically allocating large pages for cloud native applications, the method comprising the following steps:

[0059] S1. Configure the large page device plug-in in each working node;

[0060] S2. Use the large page device plug-in to obtain the node memory information of the corresponding working node and report it to the management node;

[0061] S3. Receive a Pod creation request and identify large page memory requirement information in the Pod creation request.

[0062] S4. Based on the large page memory requirement information and the node memory information of each working node, one working node is selected as the target working node from each working node;

[0063] S5. Call the target working node to create a Pod and the corresponding large page.

[0064] It should be noted that huge pages are a way to organize and manage the host physical memory in units of 2M, 64M or 1G. The process applies for and releases huge pages in units of 2M, 64M or 1G, so fewer Translation Lookaside Buffers (TLBs) are needed. Ordinary memory uses 4KB as the memory page management and mapping method. The page table and conversion of the process's virtual address to the physical address are all in this unit. As the host physical memory becomes larger and larger, using the standard 4K page size will bring about problems such as too large system page tables, reduced efficiency, and a large number of TLB Misses, which will affect performance. Huge pages can reduce the page table size and page table levels by increasing the size of the operating system page, effectively avoiding TLB Misses. Usually, huge pages are used in a size of 2M, which can reduce the performance of page table optimization and avoid waste in use due to too large memory pages. At the same time, it also reduces the failure of huge page memory allocation caused by large blocks of memory without continuous addresses after memory fragmentation. Despite this, some scenarios still use 1G huge pages.

[0065] Currently, large page memory is widely used in high-performance scenarios such as DPDK, SPDK, and vDPA. For different applications, it may bring up to 50% performance improvement.

[0066] Kubernetes, a cloud-native application platform, is the de facto standard in the field of container orchestration and a key project in the cloud-native field. It is used to manage containerized applications and resource scheduling including huge pages.

[0067] Pod is the smallest unit in Kubernetes. Virtual machines / containers apply for resources (including huge pages) from Kubernetes and schedule them to run based on Pod.

[0068] Kubernetes supports applying for and using large page memory pre-allocated in the system in Pods, provided that when the Pod is scheduled, Kubernetes first needs to know which nodes have large page memory, and this information is reported by the Kubernetes kubelet component. In order for the node to report large page capacity, the Kubernetes node needs to pre-allocate large pages. When the kubelet component is running, it reads the large page memory configuration in the system through cAdvisor and reports it as a resource available for scheduling.

[0069] First, users need to allocate and create large page memory on the Kubernetes node. Linux supports two methods:

[0070] First, permanent configuration, configure the boot parameters of the Linux kernel in the / boot / grub2 / grub.cfg file, and restart the system to take effect;

[0071] Second, temporary configuration: configuring large pages through the sys interface takes effect immediately, but the configuration is lost after restart.

[0072] Furthermore, cloud native application Pods (virtual machines / containers) use large page memory in the following ways:

[0073] (1) The kubelet component obtains the host information including CPU information, memory information and huge page memory through the cAdvisor monitoring interface MachineInfo(), and reports the host information to the API Server component of the management node; the huge page memory information is recorded in the Huge Pages-XXX field of the host information;

[0074] (2) The API Server component receives a Pod creation request, and the request parameter requests the use of large page memory HugePages-XXX;

[0075] (3) Scheduler filters out invalid work nodes (no huge page memory or insufficient huge page memory) and unschedulable work nodes among valid work nodes based on the information registered in the API Server;

[0076] (4) The Scheduler selects the best node from the list of nodes that meet the Pod scheduling requirements and binds the Pod to the target working node;

[0077] (5) The kubelet component of the target work node creates a virtual machine / container, and the virtual machine / container process applies for and uses large page memory when the target work node is running.

[0078] The existing solution requires pre-allocation of large page memory on the Kubernetes node. This solution has the following disadvantages:

[0079] 1. Memory waste: Large page memory is allocated and created in advance. If no virtual machine or container uses this large page memory, the physical memory occupied by this large page memory cannot be used by other processes.

[0080] 2. Planning is difficult: Because it is impossible to accurately predict the business demand for huge page memory, it is impossible to allocate and reserve enough huge page memory in the early stage; modifying and allocating huge pages in the middle of the project requires restarting the Kubernetes node, which will affect other businesses of the node.

[0081] In an embodiment of the present application, the free memory of the working node is monitored based on the large page device plug-in, so that the working node can be selected and large pages can be created according to demand, which effectively improves the memory utilization efficiency, saves planning workload, and avoids the system large page memory change restarting the node and affecting the business.

[0082] Further, the using the large page device plug-in to obtain the node memory information of the corresponding working node and report it to the management node includes the following steps:

[0083] Utilize the large page device plug-in to calculate the free memory information of the corresponding working node;

[0084] Based on the memory information and the preset large page memory specifications, obtaining the number of large page creation permissions for the working node corresponding to each of the large page memory specifications;

[0085] The node memory information is formed based on the free memory information and the large page creation permission quantity of each large page memory specification.

[0086] Furthermore, the large page memory requirement information includes a total large page memory requirement, a large page memory specification, and a large page quantity.

[0087] Further, based on the large page memory requirement information and the node memory information of each of the working nodes, one of the working nodes is selected as a target working node, including the following steps:

[0088] Compare the large page memory requirement information with the node memory information of each of the working nodes, and filter to obtain each of the working nodes that meets the large page memory requirement information;

[0089] One of the working nodes that meets the large page memory requirement information is selected as a target working node.

[0090] Furthermore, the method further comprises the following steps:

[0091] The creation information of each of the target working nodes that have created the Pod and the large page is recorded.

[0092] It should be noted that a corresponding large page device plug-in is configured in one of the working nodes.

[0093] In order to solve a series of problems caused by the pre-allocation of huge page memory by Kubernetes nodes, this application designs a method and device for dynamically allocating huge pages, which supports Kubernetes nodes to temporarily allocate huge pages from ordinary memory to virtual machines / containers when there is a demand for huge page memory, and release the huge page memory as ordinary memory for other processes after the virtual machine / container exits, eliminating the trouble of advance planning and pre-allocation of huge pages, while improving memory usage efficiency. The specific solution is described as follows:

[0094] Step 1: Deploy the huge page device plug-in (device-plugin) on each working node. The huge page device plug-in registers the custom huge page device (compute.ccos.io / Huge Pages-XXX) to the kubelet component.

[0095] Specifically, step 1 includes the following steps:

[0096] Step 1.1: When the huge page device plug-in is started, the number of huge pages that can be dynamically created is calculated based on the free memory information of the working node, and mapped to the number of huge page devices compute.ccos.io / Huge Pages-XXX.

[0097] Step 1.2: The huge page device plug-in monitors the free memory changes of the working node in a regular or real-time manner, calculates, and continuously reports the number of huge page devices compute.ccos.io / Huge Pages-XXX.

[0098] Step 2: The kubelet component on the working node receives the data reported by the large page device plug-in (device-plugin), and then reports the number of large page devices compute.ccos.io / Huge Pages-XXX to the API Server component of the management node. This information is counted in the compute.ccos.io / Huge Pages-XXX field of the node information.

[0099] Step 3: The API Server component receives the Pod creation request and applies for a specified number of huge page devices compute.ccos.io / Huge Pages-XXX in the creation request parameters, which is equivalent to applying for the same number of huge page memories.

[0100] Step 4: Scheduler filters out invalid working nodes and unschedulable working nodes among valid working nodes based on the information registered in the API Server.

[0101] Step 5: Scheduler selects the best node from the list of nodes that meet the Pod scheduling requirements and binds the Pod to the target working node.

[0102] Step 6: The kubelet component of the target working node calls the Allocate() interface of the huge page device plug-in to apply for a specified number of huge page devices compute.ccos.io / Huge Pages-XXX. The huge page device plug-in allocates huge page memory corresponding to the number of compute.ccos.io / Huge Pages-XXX.

[0103] Specifically, step 6 includes the following steps:

[0104] Step 6.1, allocate large pages, the specific method is as follows:

[0105] A typical example is: Linux platform temporarily applies for huge pages through the sys interface:

[0106] echo xxx> / sys / kernel / mm / Huge Pages / Huge Pages-XXX / nr_Huge Pages.

[0107] For scenarios where a large number of large pages are allocated at one time, use the step-by-step method to avoid failure:

[0108] The initial step size is 64, and the number of applications is increased or decreased in multiples of 2.

[0109] After successfully allocating 64 huge pages, the next time the number of huge pages is increased by 1 to 128, otherwise, after a failure, the next time the number of huge pages is reduced by 1 to 32.

[0110] Step 6.2: Handle the failure of allocating large pages due to memory fragmentation. The specific method is as follows:

[0111] After the system has been running for a while, although a lot of free memory is observed, large pages cannot be allocated. This is caused by two reasons: one is that the cache occupies memory space, and the other is memory fragmentation. The following methods can be used to solve this problem:

[0112] Clean and release cache space, echo 1> / proc / sys / vm / drop_caches,

[0113] Compact the memory to obtain the physical memory of consecutive addresses, echo 1> / proc / sys / vm / compact_memory.

[0114] In step 7, the kubelet component of the target working node creates a virtual machine / container. When the virtual machine / container process runs on the target working node, it uses the large page memory allocated in step 6.

[0115] It should be noted that the technical solution of the embodiment of the present application includes the following technical advantages:

[0116] First, the huge page device plug-in (device-plugin) maps the huge page memory to the huge page device. Taking a 2M huge page as an example, the 2M huge page memory is mapped to 1 huge page device.

[0117] Second, the huge page device plug-in calculates the total amount of allocatable huge page memory based on the free memory information, and reports it as the corresponding number of available huge page devices for the node;

[0118] Third, the application of huge page memory size by the virtual machine / container becomes the application of the corresponding number of huge page devices. For example, if you apply for a huge page memory of 512 Mi, if it is a 2M huge page, you will apply for 256 huge page devices.

[0119] Fourth, when the VM / container is scheduled to a worker node, the huge page device plug-in allocates the required huge page memory from normal memory (delayed allocation).

[0120] Based on the above technical solution, it is possible to effectively improve memory usage efficiency, save planning workload, and avoid the impact of system large page memory changes on node restarts and business.

[0121] Second, see Figure 3 As shown, based on the same inventive concept as the method embodiment, the embodiment of the present application provides a device for dynamically allocating large pages for cloud native applications, the device comprising:

[0122] The plugin configuration module is used to configure the large page device plugin in each working node;

[0123] A quantity statistics module, which is used to obtain the node memory information of the corresponding working node by using the large page device plug-in, and report it to the management node;

[0124] A request response module, which is used to receive a Pod creation request and identify large page memory requirement information in the Pod creation request;

[0125] A node selection module, which is used to select one of the working nodes as a target working node based on the large page memory requirement information and the node memory information of each working node;

[0126] A request execution module is used to call the target working node and create the Pod and the corresponding large page.

[0127] In an embodiment of the present application, the free memory of the working node is monitored based on the large page device plug-in, so that the working node can be selected and large pages can be created according to demand, which effectively improves the memory utilization efficiency, saves planning workload, and avoids the system large page memory change restarting the node and affecting the business.

[0128] Furthermore, the quantity statistics module is also used to calculate the free memory information of the corresponding working node using the large page device plug-in;

[0129] The quantity statistics module is further used to obtain the number of large page creation permissions of the working node corresponding to each large page memory specification based on the memory information and the preset multiple large page memory specifications;

[0130] The quantity statistics module is further used to form the node memory information based on the free memory information and the number of large page creation permissions of each large page memory specification.

[0131] Furthermore, the large page memory requirement information includes a total large page memory requirement, a large page memory specification, and a large page quantity.

[0132] Furthermore, the node selection module is further used to compare the large page memory requirement information with the node memory information of each of the working nodes, and filter and obtain each of the working nodes that meets the large page memory requirement information;

[0133] The node selection module is also used to select one of the working nodes that meet the large page memory requirement information as a target working node.

[0134] Furthermore, a recording module is created, which is used to record the creation information of each target working node that has created the Pod and the large page.

[0135] It should be noted that a corresponding large page device plug-in is configured in one of the working nodes.

[0136] In order to solve a series of problems caused by the pre-allocation of huge page memory by Kubernetes nodes, this application designs a method and device for dynamically allocating huge pages, which supports Kubernetes nodes to temporarily allocate huge pages from ordinary memory to virtual machines / containers when there is a demand for huge page memory, and release the huge page memory as ordinary memory for other processes after the virtual machine / container exits, eliminating the trouble of advance planning and pre-allocation of huge pages, while improving memory usage efficiency. The specific solution is described as follows:

[0137] Step 1: Deploy the huge page device plug-in (device-plugin) on each working node. The huge page device plug-in registers the custom huge page device (compute.ccos.io / Huge Pages-XXX) to the kubelet component.

[0138] Specifically, step 1 includes the following steps:

[0139] Step 1.1: When the huge page device plug-in is started, the number of huge pages that can be dynamically created is calculated based on the free memory information of the working node, and mapped to the number of huge page devices compute.ccos.io / Huge Pages-XXX.

[0140] Step 1.2: The huge page device plug-in monitors the free memory changes of the working node in a regular or real-time manner, calculates, and continuously reports the number of huge page devices compute.ccos.io / Huge Pages-XXX.

[0141] Step 2: The kubelet component on the working node receives the data reported by the large page device plug-in (device-plugin), and then reports the number of large page devices compute.ccos.io / Huge Pages-XXX to the API Server component of the management node. This information is counted in the compute.ccos.io / Huge Pages-XXX field of the node information.

[0142] Step 3: The API Server component receives the Pod creation request and applies for a specified number of huge page devices compute.ccos.io / Huge Pages-XXX in the creation request parameters, which is equivalent to applying for the same number of huge page memories.

[0143] Step 4: Scheduler filters out invalid working nodes and unschedulable working nodes among valid working nodes based on the information registered in the API Server.

[0144] Step 5: Scheduler selects the best node from the list of nodes that meet the Pod scheduling requirements and binds the Pod to the target working node.

[0145] Step 6: The kubelet component of the target working node calls the Allocate() interface of the huge page device plug-in to apply for a specified number of huge page devices compute.ccos.io / Huge Pages-XXX. The huge page device plug-in allocates huge page memory corresponding to the number of compute.ccos.io / Huge Pages-XXX.

[0146] Specifically, step 6 includes the following steps:

[0147] Step 6.1, allocate large pages, the specific method is as follows:

[0148] A typical example is: Linux platform temporarily applies for huge pages through the sys interface:

[0149] echo xxx> / sys / kernel / mm / Huge Pages / Huge Pages-XXX / nr_Huge Pages.

[0150] For scenarios where a large number of large pages are allocated at one time, use the step-by-step method to avoid failure:

[0151] The initial step size is 64, and the number of applications is increased or decreased in multiples of 2.

[0152] After successfully allocating 64 huge pages, the next time the number of huge pages is increased by 1 to 128, otherwise, after a failure, the next time the number of huge pages is reduced by 1 to 32.

[0153] Step 6.2: Handle the failure of allocating large pages due to memory fragmentation. The specific method is as follows:

[0154] After the system has been running for a while, although a lot of free memory is observed, large pages cannot be allocated. This is caused by two reasons: one is that the cache occupies memory space, and the other is memory fragmentation. The following methods can be used to solve this problem:

[0155] Clean and release cache space, echo 1> / proc / sys / vm / drop_caches,

[0156] Compact the memory to obtain the physical memory of consecutive addresses, echo 1> / proc / sys / vm / compact_memory.

[0157] In step 7, the kubelet component of the target working node creates a virtual machine / container. When the virtual machine / container process runs on the target working node, it uses the large page memory allocated in step 6.

[0158] It should be noted that the technical solution of the embodiment of the present application includes the following technical advantages:

[0159] First, the huge page device plug-in (device-plugin) maps the huge page memory to the huge page device. Taking a 2M huge page as an example, the 2M huge page memory is mapped to 1 huge page device.

[0160] Second, the huge page device plug-in calculates the total amount of allocatable huge page memory based on the free memory information, and reports it as the corresponding number of available huge page devices for the node;

[0161] Third, the application of huge page memory size by the virtual machine / container becomes the application of the corresponding number of huge page devices. For example, if you apply for a huge page memory of 512 Mi, if it is a 2M huge page, you will apply for 256 huge page devices.

[0162] Fourth, when the VM / container is scheduled to a worker node, the huge page device plug-in allocates the required huge page memory from normal memory (delayed allocation).

[0163] Based on the above technical solution, it is possible to effectively improve memory usage efficiency, save planning workload, and avoid the impact of system large page memory changes on node restarts and business.

[0164] It should be noted that the device for dynamically allocating large pages for cloud-native applications provided in the embodiment of the present application, and its corresponding technical problems, technical means and technical effects are similar in principle to the principles of the method for dynamically allocating large pages for cloud-native applications.

[0165] It should be noted that, in this application, relational terms such as "compared to" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0166] The above is only a specific implementation of the present application, so that those skilled in the art can understand or implement the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest range consistent with the principles and novel features applied for herein.

Claims

1. A method for dynamically allocating large pages for cloud native applications. It is characterized in that The method comprises the following steps: Configure the large page device plug-in in each working node; Utilize the large page device plug-in to obtain the node memory information of the corresponding working node, and report it to the management node; Receive a Pod creation request, and identify large page memory requirement information in the Pod creation request; Based on the large page memory requirement information and the node memory information of each of the working nodes, selecting one of the working nodes as a target working node; Call the target working node to create the Pod and the corresponding huge page; Allocate the corresponding large page; The specific method of allocating the corresponding large pages includes: for a scenario where a large number of large pages are allocated at one time, a step-by-step method is used to avoid failure, with 64 as the initial step length, and the application quantity is increased or decreased by a multiple of 2; If memory fragmentation causes large page allocation failure, clean up and release cache space, organize memory to obtain physical memory with continuous addresses; The method of using the large page device plug-in to obtain the node memory information of the corresponding working node and reporting it to the management node includes the following steps: Utilize the large page device plug-in to calculate the free memory information of the corresponding working node; Based on the memory information and the preset large page memory specifications, obtaining the number of large page creation permissions for the working node corresponding to each of the large page memory specifications; The node memory information is formed based on the free memory information and the large page creation permission quantity of each large page memory specification.

2. The method for dynamically allocating large pages for cloud native applications according to claim 1, Features: The large page memory requirement information includes the total large page memory requirement, large page memory specifications, and the number of large pages.

3. The method for dynamically allocating large pages for cloud native applications according to claim 1, It is characterized in that Based on the large page memory requirement information and the node memory information of each of the working nodes, one of the working nodes is selected as a target working node, including the following steps: Compare the large page memory requirement information with the node memory information of each of the working nodes, and filter to obtain each of the working nodes that meets the large page memory requirement information; One of the working nodes that meets the large page memory requirement information is selected as a target working node.

4. The method for dynamically allocating large pages for cloud native applications according to claim 1, It is characterized in that The method further comprises the following steps: The creation information of each of the target working nodes that have created the Pod and the large page is recorded.

5. A device for dynamically allocating large pages for cloud native applications, It is characterized in that The device comprises: The plugin configuration module is used to configure the large page device plugin in each working node; A quantity statistics module, which is used to obtain the node memory information of the corresponding working node by using the large page device plug-in, and report it to the management node; A request response module, which is used to receive a Pod creation request and identify large page memory requirement information in the Pod creation request; A node selection module, which is used to select one of the working nodes as a target working node based on the large page memory requirement information and the node memory information of each working node; A request execution module is used to call the target working node and create the Pod and the corresponding large page; A large page allocation module, which is used to allocate corresponding large pages; The specific method of allocating the corresponding large pages includes: for a scenario where a large number of large pages are allocated at one time, a step-by-step method is used to avoid failure, with 64 as the initial step length, and the application quantity is increased or decreased by a multiple of 2; If memory fragmentation causes large page allocation failure, clean up and release cache space, organize memory to obtain physical memory with continuous addresses; The method of using the large page device plug-in to obtain the node memory information of the corresponding working node and reporting it to the management node includes the following steps: Utilize the large page device plug-in to calculate the free memory information of the corresponding working node; Based on the memory information and the preset large page memory specifications, obtaining the number of large page creation permissions for the working node corresponding to each of the large page memory specifications; The node memory information is formed based on the free memory information and the large page creation permission quantity of each large page memory specification.

6. The device for dynamically allocating large pages for cloud native applications according to claim 5, Features: The quantity statistics module is also used to calculate the free memory information of the corresponding working node using the large page device plug-in; The quantity statistics module is further used to obtain the number of large page creation permissions of the working node corresponding to each large page memory specification based on the memory information and the preset multiple large page memory specifications; The quantity statistics module is further used to form the node memory information based on the free memory information and the number of large page creation permissions of each large page memory specification.

7. The device for dynamically allocating large pages for cloud native applications according to claim 5, Features: The large page memory requirement information includes the total large page memory requirement, large page memory specifications, and the number of large pages.

8. The device for dynamically allocating large pages for cloud native applications according to claim 5, Features: The node selection module is further used to compare the large page memory requirement information with the node memory information of each working node, and filter and obtain each working node that meets the large page memory requirement information; The node selection module is also used to select one of the working nodes that meet the large page memory requirement information as a target working node.

9. The device for dynamically allocating large pages for cloud native applications according to claim 5, Features: A record module is created, which is used to record the creation information of each target working node that has created the Pod and the large page.

Citation Information

Patent Citations

  • Resource scheduling method, device and system

    CN112866321A

  • Large-page memory configuration method and system in cloud service page table and related device

    CN113687873A

  • Large-page memory dynamic management method and device and computer equipment

    CN114020416A

  • Virtual machine scheduling method, device and equipment

    CN115269118A