Memory adjustment method and device, electronic equipment and medium
By adjusting the vNUMA structure of virtual machines online, the interruption problem when the virtual machine service type changes is resolved, the virtual machine memory performance is improved, and it is suitable for server environments with multiple physical NUMAs.
Patent Information
- Application Number
- CN202511030865.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-25
- Publication Date
- 2025-11-18
AI Technical Summary
In existing technologies, the vNUMA structure cannot be changed after the virtual machine starts up, which causes the virtual machine service to be interrupted when the service type changes, and the vNUMA structure cannot be adjusted online.
A memory adjustment method is provided, which determines the resource load of the target vNUMA node by allocating the original virtual memory of the virtual machine, binds it to the local CPU of the target physical NUMA node, migrates the resources of the target physical NUMA node, and migrates the target virtual memory to the target physical NUMA node, thereby realizing online adjustment of the vNUMA structure.
It enables adjustments to the vNUMA structure while the virtual machine is online, improving virtual machine memory performance. It is applicable to virtual machines with and without vNUMA partitioning and optimizes memory access performance.
Smart Images

Figure CN120973469A_ABST
Abstract
Description
Technical Field
[0001] This specification relates to the field of cloud computing technology, and in particular to memory adjustment methods, devices, electronic devices and media. Background Technology
[0002] With the continuous improvement of hardware speed and server performance, the utilization rate of some servers in data centers has declined. In order to improve the utilization rate of server hardware and reduce the operation and maintenance costs of data centers, virtualization technology has been greatly developed in recent years.
[0003] vNUMA (Virtual Non-Uniform Memory Access) is a virtualization technology used to simulate the NUMA architecture of a physical server in a virtual machine to optimize the scheduling efficiency of CPU (Central Processing Unit) and memory resources.
[0004] In related technologies, the vNUMA structure needs to be determined and manually configured before the virtual machine starts. Once the virtual machine starts, the vNUMA structure cannot be changed. If the internal service type of the virtual machine changes, adjustments to the vNUMA structure can only be made after shutting down the virtual machine. However, shutting down the virtual machine will interrupt its services. Summary of the Invention
[0005] To overcome the problems existing in related technologies, this specification provides memory adjustment methods, devices, electronic devices, and media.
[0006] According to a first aspect of the embodiments of this specification, a memory adjustment method is provided, applied to a virtualization platform, the virtualization platform including multiple physical NUMA nodes, the method comprising: dividing the original virtual memory of a virtual machine to obtain target virtual memory for multiple vNUMA nodes; determining a target physical NUMA node among the multiple physical NUMA nodes based on resource load information of the multiple physical NUMA nodes; determining a target vCPU for each vNUMA node among the multiple vNUMA nodes based on the original virtual CPU (vCPU) of the virtual machine; binding the target vCPU of each vNUMA node to the local CPU of the target physical NUMA node; and migrating the multiple target virtual memory to the target physical NUMA node.
[0007] According to a second aspect of the embodiments of this specification, a memory adjustment apparatus is provided, comprising: a partitioning module for partitioning the original virtual memory of a virtual machine to obtain target virtual memory for multiple vNUMA nodes; a node determination module for determining a target physical NUMA node among the multiple physical NUMA nodes based on resource load information of the multiple physical NUMA nodes; a virtual processor determination module for determining a target vCPU for each of the multiple vNUMA nodes based on the original virtual central processing unit (vCPU) of the virtual machine; a virtual processor binding module for binding the target vCPU of each vNUMA node to the local CPU of the target physical NUMA node; and a migration module for migrating the multiple target virtual memory to the target physical NUMA node.
[0008] According to a third aspect of the embodiments of this specification, an electronic device is provided, comprising:
[0009] processor;
[0010] Memory used to store processor-executable instructions;
[0011] The processor is configured to execute the memory adjustment method of the first aspect described above or any corresponding embodiment thereof.
[0012] According to a fourth aspect of the embodiments of this specification, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions, the computer instructions being configured to cause a computer to perform the memory adjustment method of the first aspect or any corresponding embodiment described above.
[0013] The technical solutions provided in the embodiments of this specification may include the following beneficial effects:
[0014] In the embodiments described in this specification, the vNUMA structure can be adjusted while the virtual machine is online.
[0015] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this specification. Attached Figure Description
[0016] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this specification and, together with the description, serve to explain the principles of this specification.
[0017] Figure 1 This is a schematic diagram of a system architecture illustrated in this specification according to an exemplary embodiment.
[0018] Figure 2This is a flowchart illustrating a memory adjustment method according to an exemplary embodiment of this specification.
[0019] Figure 3A This is a flowchart illustrating a memory adjustment method according to another exemplary embodiment of this specification.
[0020] Figure 3B This is a schematic diagram illustrating a memory address translation according to an exemplary embodiment of this specification.
[0021] Figure 3C This is a schematic diagram illustrating a virtual machine configured with NUMA according to an exemplary embodiment of this specification.
[0022] Figure 3D This is a schematic diagram illustrating a virtual machine configured with vNUMA according to an exemplary embodiment.
[0023] Figure 3E This is a schematic diagram illustrating a memory address space according to an exemplary embodiment of this specification.
[0024] Figure 3F This is a schematic diagram illustrating a vNUMA information according to an exemplary embodiment of this specification.
[0025] Figure 4 This is a hardware structure diagram of a computer device in which the memory adjustment device is located, as described in the embodiments of this specification.
[0026] Figure 5 This is a block diagram illustrating a memory adjustment device according to an exemplary embodiment of this specification. Detailed Implementation
[0027] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this specification. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this specification as detailed in the appended claims.
[0028] The terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to be limiting of this specification. The singular forms “a,” “the,” and “the” as used in this specification and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used herein refers to and includes any and all possible combinations of one or more of the associated listed items.
[0029] It should be understood that although the terms first, second, third, etc., may be used in this specification to describe various information, this information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, without departing from the scope of this specification, first information may also be referred to as second information, and similarly, second information may also be referred to as first information. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to determination."
[0030] The terminology used in this disclosure is explained below.
[0031] KVM (Kernel-based Virtual Machine) is a full-featured virtualization solution for the x86 hardware platform under Linux, consisting of a loadable kernel module kvm.ko. It has been integrated into all major Linux distributions since Linux 2.6.20. It uses Linux's own scheduler for management and has become one of the mainstream VMMs (Virtual Machine Monitors) in academia.
[0032] KVM virtualization requires hardware support (such as Intel VT technology or AMD V technology). It is a hardware-based full virtualization. Early versions of Xen were based on software-emulated para-virtualization, while newer versions are based on hardware-supported full virtualization. However, Xen has its own process scheduler, memory management module, etc., making its codebase quite large.
[0033] QEMU is a software emulation technology that can emulate different hardware devices for virtualization. QEMU can emulate virtual machine peripherals such as disks, graphics cards, and USB ports, as well as CPUs and memory. KVM is a kernel acceleration module.
[0034] The page table is a data structure model of the virtual memory system in an operating system, used to store the mapping between virtual addresses and physical addresses. When accessing memory, the page table is accessed first, and then Linux accesses the actual physical memory through the page table mapping.
[0035] TLB is a fixed-size buffer (or cache) allocated in the CPU to store part of the "page table" content, enabling the CPU to access and perform address translation faster.
[0036] NUMA (Non-Uniform Memory Access) is a computer physical memory design architecture primarily used in multiprocessor systems.
[0037] In a NUMA architecture, multiple processors (CPUs) are grouped into different nodes, each with its own local memory. Processors access local memory quickly, while accessing remote memory on other nodes is slower. Therefore, memory access time depends on the memory location, which is the meaning of "non-uniform".
[0038] NUMA is characterized by its use of local memory and remote memory.
[0039] Local memory: Located on the same node as the processor, it offers fast access speeds.
[0040] Remote memory: Located on other nodes, access speed is slower.
[0041] CFS stands for Completely Fair Scheduler. It is an algorithm in the Linux kernel used for process scheduling, designed to fairly allocate CPU time to all running processes.
[0042] The design goal of CFS is to ensure that each process can get CPU time fairly, and to prevent some processes from occupying the CPU for a long time, causing other processes to be "starved".
[0043] The embodiments described in this specification will now be described in detail.
[0044] The following combination Figure 1 The system architecture of a virtualization platform to which the memory adjustment methods and apparatus can be applied, as described in the embodiments of this specification, will be explained. It should be noted that... Figure 1 The examples shown are merely examples of system architectures that can be applied to the embodiments of this disclosure, in order to help those skilled in the art understand the technical content of this disclosure, but do not mean that the embodiments of this disclosure cannot be used in other devices, systems, environments or scenarios.
[0045] Figure 1 This is a schematic diagram of a system architecture illustrated in this specification according to an exemplary embodiment.
[0046] like Figure 1 As shown, the CPU in this virtualization platform can be a multi-core CPU architecture, and the memory can be a NUMA architecture.
[0047] For KVM virtual machines, the virtual machine can simulate a NUMA architecture. The virtual machine's memory can be pre-divided into multiple vNUMA nodes according to business needs to simulate the physical NUMA structure of the server. Different vNUMA memory nodes of the virtual machine reside in different physical NUMA nodes, which can accelerate the access performance of virtual machine memory.
[0048] For example, in this embodiment, the virtualization platform may include a physical server. The physical server may include four physical NUMAs, namely node1, node2, node3, and node4, and may also include two virtual machines, VM#1 and VM#2. VM#1 and VM#2 may each include two vNUMAs (vNUMA nodeA and vNUMA nodeB), and the memory of the vNUMAs may reside in different physical NUMAs.
[0049] The memory adjustment method provided in the embodiments of this disclosure will be described in detail below. For example... Figure 2 As shown, Figure 2 This is a flowchart illustrating a memory adjustment method according to another exemplary embodiment of this specification. The method can be applied to a virtualization platform, which includes virtual machines and multiple physical NUMA nodes. The memory adjustment method provided in this disclosure embodiment may include the following steps.
[0050] In step 210, the original virtual memory of the virtual machine is divided to obtain multiple target virtual memory vNUMAs.
[0051] According to embodiments of this disclosure, for example, the memory granularity of the original virtual memory can be obtained; the original virtual memory is divided into multiple target virtual memories according to the memory granularity, and the vNUMA address and memory size of each target virtual memory are obtained, wherein the memory size of each target virtual memory is an integer multiple of the memory granularity. Optionally, the memory can be in page granularity, and the size of each page can be set as needed, for example, it can be 4K (4096 bytes).
[0052] In step 220, the target physical NUMA node is determined from among the multiple physical NUMA nodes based on the resource load information of the multiple physical NUMA nodes.
[0053] According to embodiments of this disclosure, for example, the physical NUMA node with the lowest load among multiple physical NUMA nodes can be determined as the target physical NUMA node based on the resource load information of multiple physical NUMA nodes. The resource load information may include, for example, CPU load information and / or memory load information.
[0054] In step 230, the target vCPU for each vNUMA in the multiple vNUMAs is determined based on the original virtual central processing unit (vCPU) of the virtual machine.
[0055] According to embodiments of this disclosure, the target vCPU is the vCPU allocated to a vNUMA. For example, the total number of vCPUs of a virtual machine can be divided by the number of vNUMAs to obtain the number of vCPUs per vNUMA, and each vNUMA is allocated that number of vCPUs.
[0056] In step 240, the target vCPU of each vNUMA is bound to the local CPU of the target physical NUMA node.
[0057] According to embodiments of this disclosure, for example, the physical CPU under the target physical NUMA node can be determined based on the physical CPU topology of the virtualization platform; then, the target vCPU can be bound to the physical CPU. The physical CPU topology can be used to record the affiliation between CPUs and NUMA nodes. For example, taking a Linux system as an example, a kernel interface can be called to bind the virtual machine's vCPU to the physical CPU.
[0058] In step 250, multiple target virtual memories are migrated to target physical NUMA nodes.
[0059] According to embodiments of this disclosure, for example, each target virtual memory can be migrated to a target physical NUMA node based on its vNUMA address and memory size. For example, using a Linux system, the migrate_pages interface can be called to migrate to a specified physical NUMA. migrate_pages is a NUMA memory migration interface provided by the Linux kernel, used to dynamically migrate the physical memory pages of a process between NUMA nodes to optimize memory access performance.
[0060] Alternatively, the memory allocation strategy for each target virtual memory can be set to be consistent with the memory strategy of the target physical NUMA node.
[0061] For example, in a Linux system, you can call `mbind_policy` to re-specify the NUMA memory policy for VMA. `mbind` is a NUMA memory binding interface provided by the Linux kernel, used to control the memory allocation strategy of processes (such as binding to a specific NUMA node, cross-node allocation, etc.).
[0062] The memory adjustment method according to embodiments of this disclosure allows for vNUMA structure adjustment while the virtual machine is online. It is applicable not only to virtual machines with pre-defined vNUMA partitions but also to virtual machines without pre-defined vNUMA partitions, enabling online memory partitioning and vNUMA configuration. In physical servers with multiple physical NUMAs, online vNUMA configuration via virtual machines can significantly improve system memory performance within the virtual machine.
[0063] like Figure 3A The diagram shown is a flowchart illustrating another memory adjustment method according to an exemplary embodiment. This embodiment describes a memory adjustment process based on the foregoing embodiments, including the following steps:
[0064] Step 301: Divide the entire memory segment of the virtual machine and record the information.
[0065] like Figure 3B The diagram illustrates a memory address translation method according to an exemplary embodiment. According to embodiments of this disclosure, in the operating system of a physical server, the operating system can classify memory addresses into virtual addresses and physical addresses. Correspondingly, in a virtualization environment, these can be categorized as virtual machine virtual addresses, virtual machine physical addresses, host machine virtual addresses, and host machine physical addresses.
[0066] In this embodiment, the virtual machine's (Guest) internal operating system can implement the translation from virtual machine virtual address to virtual machine physical address. The physical server's (Host) operating system can implement the translation from physical server virtual address to physical server physical address. The VMM can be responsible for mapping from virtual machine physical address to physical server virtual address. Therefore, when the virtual machine performs memory access, its memory access will ultimately access the corresponding physical memory of the physical host.
[0067] Taking KVM as an example, the virtual machine hardware simulation in KVM is implemented through the QEMU emulator. On the host physical server, one QEMU process corresponds to one virtual machine. The QEMU process is a user-space process, and it uses virtual memory addresses.
[0068] For virtual machine memory devices, QEMU requests a segment of memory from the host operating system and provides it to the virtual machine as its memory device.
[0069] like Figure 3CThe diagram illustrates a virtual machine configured with NUMA according to an exemplary embodiment. By default, the memory requested by the virtual machine does not distinguish between physical NUMA nodes (e.g., it does not distinguish between physical NUMA nodes NUMA1 and NUMA2), and there is no NUMA affinity. NUMA affinity refers to binding processes to specific CPU cores and NUMA nodes to optimize memory access speed and reduce latency in cross-node memory access.
[0070] like Figure 3D The diagram illustrates a virtual machine configured with vNUMA according to an exemplary embodiment. In QEMU, when memory (RAM) is requested, the kernel returns the starting address of the requested virtual memory, which is recorded in the QEMU process. Exemplarily, in this embodiment, the starting address of the virtual memory is ram_addr.
[0071] According to embodiments of this disclosure, operating system memory can be managed in pages. A page can be, for example, 4KB in size; that is, all allocated memory exists in page form and is address-aligned to 4KB.
[0072] like Figure 3E The diagram illustrates a memory address space according to an exemplary embodiment. According to an embodiment of this disclosure, the page table stores the mapping between virtual addresses and physical addresses and is managed by the MMU (Memory Management Unit). When accessing memory, the page table is accessed first, and then mapped to the physical address through the page table. Based on this, when the virtual machine requests memory from the operating system kernel, the kernel returns the starting address of the requested memory, i.e., ram_addr. Because this memory space is aligned to 4KB at its underlying level, the size of the requested memory is also in 4KB granularity.
[0073] According to embodiments of this disclosure, for QEMU, a single memory block can be divided as needed in 4K granularity. For example, a single memory block can be divided into 2 or 4 parts, each part being 4K, and its address (vnuma_add) and size (size) after division are recorded.
[0074] When configuring vNUMA, you also need to configure the number of virtual machine vCPUs, vcpus. Since CPU access to local memory offers higher performance, in this embodiment, vcpus = total number of virtual machine vCPUs / number of vNUMA instances.
[0075] like Figure 3FThe diagram shown illustrates vNUMA information according to an exemplary embodiment. Each vNUMA can be configured with vNUMA information. The vNUMA information may include the partitioned addresses of the vNUMA (e.g., vnuma_add1, vnuma_add2, vnuma_add3, etc.), its size (RAM size), and the number of vCPUs (vcpus1, vcpus2, vcpus3, etc.).
[0076] Step 302: The physical server performs CPU / memory load calculations and selects a suitable physical NUMA node.
[0077] According to embodiments of this disclosure, for example, the physical NUMA with the lowest load or optimal performance can be calculated based on the virtual machine service vNUMA requirements and the CPU and / or memory load of the physical server. For example, the physical NUMA with the optimal load can be obtained.
[0078] Based on the server's CPU physical topology, obtain the local CPU information under physical NUMA1.
[0079] Based on the information obtained above, the kernel interface is called to bind the virtual machine vCPU to the physical CPU.
[0080] Step 303: Determine whether the selected physical NUMA node resources are sufficient. If sufficient, proceed to step 304. Otherwise, it means that the virtual machine memory space allocation cannot be satisfied, and return to step 301 to reallocate.
[0081] Step 304: The virtual machine's vCPU is bound to the physical CPU according to the partition.
[0082] Step 305: Move the memory pages of the divided sub-memory space to the appropriate physical NUMA node calculated in step 302.
[0083] According to embodiments of this disclosure, for each vNUMA node's virtual memory, migration_pages is invoked to migrate to the specified physical NUMA based on the vnuma_addr and size of the virtual memory.
[0084] Step 306: After moving the memory, set a preferred policy for the moved memory to ensure that subsequent allocations are also made from that physical NUMA.
[0085] According to embodiments of this disclosure, for the virtual memory of each vNUMA node, the virtual machine's NUMA memory policy can be re-specified by calling mbind_policy based on the vnuma_addr and size of the virtual memory, so that its memory NUMA location and NUMA memory policy are consistent.
[0086] According to embodiments of this disclosure, the memory management of the QEMU virtual machine process on the host machine is performed through the `vm_area_struct` data structure, which is a wrapper around a kernel page. The `vm_area_struct` contains a `vm_policy` field, which describes the memory policy of the virtual machine.
[0087]
[0088] Thus, the online setup of the virtual machine vNUMA is complete.
[0089] Corresponding to the embodiments of the aforementioned methods, this specification also provides embodiments of a memory adjustment device and a terminal in which it is applied.
[0090] The embodiments of the memory adjustment device described in this specification can be applied to computer devices, such as servers or terminal devices. The device embodiments can be implemented in software, hardware, or a combination of both. Taking software implementation as an example, as a logical device, it is formed by the processor reading the corresponding computer program instructions from non-volatile memory into memory for execution. From a hardware perspective, such as... Figure 4 The diagram shown is a hardware structure diagram of a computer device containing the memory adjustment device as described in this specification, except... Figure 4 In addition to the processor 410, memory 430, network interface 420, and non-volatile memory 440 shown, the server or electronic device where the device 431 is located in the embodiment may also include other hardware depending on the actual function of the computer device, which will not be described in detail here.
[0091] like Figure 5 As shown, Figure 5 This specification is a block diagram illustrating a memory adjustment device according to an exemplary embodiment, applied to a virtualization platform including multiple physical NUMA nodes. The device includes:
[0092] The partitioning module 510 is used to partition the original virtual memory of the virtual machine to obtain the target virtual memory of multiple vNUMA nodes.
[0093] The node determination module 520 is used to determine the target physical NUMA node among multiple physical NUMA nodes based on the resource load information of multiple physical NUMA nodes.
[0094] Virtual processor determination module 530 is used to determine the target vCPU of each vNUMA node among multiple vNUMA nodes based on the original virtual central processing unit (vCPU) of the virtual machine.
[0095] Virtual processor binding module 540 is used to bind the target vCPU of each vNUMA node to the local CPU of the target physical NUMA node;
[0096] Migration module 550 is used to migrate multiple target virtual memories to target physical NUMA nodes.
[0097] Optionally, the division into modules may include:
[0098] The granularity acquisition submodule is used to obtain the memory granularity of the raw virtual memory;
[0099] The memory partitioning submodule is used to divide the original virtual memory into multiple target virtual memory according to the memory granularity, and obtain the vNUMA address and memory size of each target virtual memory. The memory size of each target virtual memory is an integer multiple of the memory granularity.
[0100] Optionally, the virtual processor binding module may include:
[0101] The physical CPU determination submodule is used to determine the physical CPU under the target physical NUMA node based on the physical CPU topology of the virtualization platform.
[0102] The binding submodule is used to bind the target vCPU to the physical CPU.
[0103] Optionally, the migration module may include:
[0104] The virtual memory migration submodule is used to migrate each target virtual memory to the target physical NUMA node based on the vNUMA address and memory size of each target virtual memory.
[0105] Optionally, the device may further include:
[0106] Set the memory allocation policy for each target virtual memory to be consistent with the memory policy of the target physical NUMA node.
[0107] Optionally, the node determination module may include:
[0108] The target node determination submodule is used to determine the physical NUMA node with the lowest load among multiple physical NUMA nodes based on the resource load information of multiple physical NUMA nodes, and to select the target physical NUMA node. The resource load information includes CPU load information and / or memory load information.
[0109] The memory adjustment apparatus according to embodiments of the present disclosure can perform structural adjustments on vNUMA while the virtual machine is online.
[0110] Accordingly, this specification also provides an electronic device including a processor; a memory for storing processor-executable instructions; wherein the processor is configured to: partition the raw virtual memory of a virtual machine to obtain target virtual memory for multiple vNUMA nodes; determine a target physical NUMA node among the multiple physical NUMA nodes based on the resource load information of the multiple physical NUMA nodes; determine the target vCPU of each vNUMA node among the multiple vNUMA nodes based on the raw virtual central processing unit (vCPU) of the virtual machine; bind the target vCPU of each vNUMA node to the local CPU of the target physical NUMA node; and migrate the multiple target virtual memories to the target physical NUMA node.
[0111] The specific implementation process of the functions and roles of each module in the above device can be found in the implementation process of the corresponding steps in the above method, and will not be repeated here.
[0112] For the device embodiments, since they basically correspond to the method embodiments, the relevant parts can be referred to in the description of the method embodiments. The device embodiments described above are merely illustrative. The modules described as separate components may or may not be physically separate, and the components shown as modules may or may not be physical modules, that is, they may be located in one place or distributed across multiple network modules. Some or all of the modules can be selected to achieve the purpose of the solution in this specification according to actual needs. Those skilled in the art can understand and implement this without creative effort.
[0113] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.
[0114] Other embodiments of this specification will readily occur to those skilled in the art upon consideration of the specification and practice of the invention claimed herein. This specification is intended to cover any variations, uses, or adaptations that follow the general principles of this specification and include common knowledge or customary techniques in the art not claimed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this specification are indicated by the following claims.
[0115] It should be understood that this specification is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this specification is limited only by the appended claims.
[0116] The above description is merely a preferred embodiment of this specification and is not intended to limit this specification. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this specification should be included within the scope of protection of this specification.
Claims
1. A memory tuning method applied to a virtualization platform, the virtualization platform comprising virtual machines and multiple physical non-uniform memory access (NUMA) nodes, characterized in that, The method includes: The original virtual memory of the virtual machine is divided to obtain the target virtual memory of multiple virtual non-uniform memory access vNUMA nodes; Based on the resource load information of the plurality of physical NUMA nodes, the target physical NUMA node among the plurality of physical NUMA nodes is determined; Based on the original virtual central processing unit (vCPU) of the virtual machine, determine the target vCPU of each vNUMA node among the plurality of vNUMA nodes; Bind the target vCPU of each vNUMA node to the local CPU of the target physical NUMA node; The multiple target virtual memories are migrated to the target physical NUMA node.
2. The method according to claim 1, characterized in that, The process of dividing the virtual machine's raw virtual memory to obtain target virtual memory for multiple vNUMA nodes includes: Obtain the memory granularity of the original virtual memory; The original virtual memory is divided into multiple target virtual memories according to the memory granularity, and the vNUMA address and memory size of each target virtual memory are obtained. The memory size of each target virtual memory is an integer multiple of the memory granularity.
3. The method according to claim 1, characterized in that, The step of binding the target vCPU of each vNUMA node to the local CPU of the target physical NUMA node includes: Based on the physical CPU topology of the virtualization platform, determine the physical CPU under the target physical NUMA node; Bind the target vCPU to the physical CPU.
4. The method according to claim 2, characterized in that, The step of migrating the plurality of target virtual memories to the target physical NUMA node includes: Based on the vNUMA address and memory size of each target virtual memory, each target virtual memory is migrated to the target physical NUMA node.
5. The method according to claim 4, characterized in that, The method further includes: The memory allocation strategy for each target virtual memory is set to be consistent with the memory strategy for the target physical NUMA node.
6. The method according to claim 1, characterized in that, The step of determining the target physical NUMA node among the plurality of physical NUMA nodes based on the resource load information of the plurality of physical NUMA nodes includes: Based on the resource load information of multiple physical NUMA nodes, the physical NUMA node with the lowest load among the multiple physical NUMA nodes is determined as the target physical NUMA node, wherein the resource load information includes CPU load information and / or memory load information.
7. A memory adjustment device applied to a virtualization platform, the virtualization platform comprising virtual machines and multiple physical NUMA nodes, characterized in that, The device includes: The partitioning module is used to partition the virtual machine's raw virtual memory to obtain the target virtual memory for multiple vNUMA nodes; The node determination module is used to determine the target physical NUMA node among the multiple physical NUMA nodes based on the resource load information of the multiple physical NUMA nodes; The virtual processor determination module is used to determine the target vCPU of each vNUMA node among the plurality of vNUMA nodes based on the original virtual central processing unit (vCPU) of the virtual machine. A virtual processor binding module is used to bind the target vCPU of each vNUMA node to the local CPU of the target physical NUMA node; The migration module is used to migrate the plurality of target virtual memories to the target physical NUMA node.
8. The apparatus according to claim 7, characterized in that, The partitioning module includes: The granularity acquisition submodule is used to acquire the memory granularity of the original virtual memory; The memory partitioning submodule is used to divide the original virtual memory into multiple target virtual memories according to the memory granularity, and obtain the vNUMA address and memory size of each target virtual memory, wherein the memory size of each target virtual memory is an integer multiple of the memory granularity.
9. An electronic device, comprising: processor; Memory used to store processor-executable instructions; The processor is configured to perform the method of any one of claims 1 to 6.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions for causing a computer to perform the method of any one of claims 1 to 6.