A method, device, equipment, and medium for generating NUMA topology of a virtual machine

By dynamically determining the number of NUMA nodes of virtual machines and generating the best NUMA topology, the problems of virtual machine performance and creation success rate are solved, the user configuration difficulty and cost are reduced, and the user configuration is adapted to different host hardware scenarios.

CN116069447BActive Publication Date: 2025-08-22JINAN INSPUR DATA TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310112889.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-10
Publication Date
2025-08-22
Estimated Expiration
2043-02-10

AI Technical Summary

Technical Problem

In virtualization scenarios, the virtual machine does not specify a NUMA topology, resulting in poor performance, and user configuration errors lead to memory scramble, increasing usage costs. The existing technology cannot automatically generate the best NUMA topology to ensure virtual machine performance and creation success rate.

Method used

By receiving virtual machine scheduling requests, the number of NUMA nodes is judged, the number of target NUMA nodes is dynamically determined based on the relationship between resource size and standard resource size, the optimal NUMA topology is generated and the target host is selected, and the number of NUMA nodes is dynamically adjusted to cover different hardware scenarios.

Benefits of technology

It realizes the improvement of creation success rate while ensuring the performance of virtual machines, reduces the difficulty and cost of user configuration, solves the problem of memory competition, and adapts to the hardware situation of different hosts.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116069447B_ABST
    Figure CN116069447B_ABST
Patent Text Reader

Abstract

This application discloses a method, apparatus, device, and medium for generating a virtual machine NUMA topology, relating to the field of virtualization technology. The method comprises: upon receiving a scheduling request for a virtual machine, determining whether the virtual machine resource model specifies the number of NUMA nodes for the virtual machine based on the scheduling request; if the virtual machine resource model does not specify the number of NUMA nodes for the virtual machine, determining the target number of NUMA nodes for the virtual machine based on the relationship between the virtual machine resource size and the standard resource size; generating the virtual machine's NUMA topology according to the target number of NUMA nodes and selecting the corresponding target host. A process for dynamically selecting the virtual machine's NUMA topology during scheduling has been added, and the NUMA topology ultimately used for virtual creation is the optimal NUMA topology for the virtual machine. This method can prioritize the highest performance for the virtual machine while ensuring the success rate of virtual machine creation, and can cover complex scenarios where the hardware conditions of the candidate host list vary.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of virtualization technology, and in particular to a method, device, equipment, and medium for generating a NUMA topology of a virtual machine. Background Art

[0002] In virtualization scenarios, a virtual machine achieves the best CPU and memory performance under the same hardware conditions when bound to a single NUMA node on the host. Currently, in OpenStack nova, a NUMA topology is not specified for a virtual machine by default when it is created, unless the user specifies hw:numa_nodes in the specification metadata. Therefore, the default performance of a virtual machine created without a specified NUMA topology is poor. Furthermore, since users can set whether to specify a NUMA topology in the specification metadata, in actual production environments, virtual machines with and without a specified NUMA topology may run simultaneously on the same host. However, since the memory usage of virtual machines without a specified NUMA topology is actually randomly distributed across the host's NUMA nodes and cannot be controlled by the management side, memory contention may occur when the two types of virtual machines coexist on the same host, impacting business stability. The community needs to specify hw:numa_nodes in the specification metadata to create a virtual machine with a specified NUMA topology, which is prone to configuration errors and high cost of use.

[0003] The OpenStack community recommends specifying hw:mem_page_size=any in the specification metadata to assign a NUMA topology with one NUMA node to VMs by default when they are created. However, this can cause VM creation to fail for certain larger specifications. Publicly available resources have not yet revealed a solution that automatically generates the optimal NUMA topology for VMs, reduces costs, and prioritizes maximum performance while ensuring a high VM creation success rate.

[0004] In summary, how to enable the system to select the optimal NUMA topology based on the availability of alternative hosts by default without the user having to specify the number of NUMA nodes in the specification metadata, thereby reducing user usage difficulty and cost, is a technical problem to be solved in this field. Summary of the Invention

[0005] In view of this, the purpose of the present invention is to provide a method, apparatus, device, and medium for generating a virtual machine NUMA topology, which can eliminate the need for users to specify the number of NUMA nodes in the specification metadata. The system can also select the optimal NUMA topology based on the availability of alternative hosts by default, thereby reducing user difficulty and cost. The specific solution is as follows:

[0006] In a first aspect, the present application discloses a method for generating a virtual machine NUMA topology, comprising:

[0007] After receiving a scheduling request for a virtual machine, determining, based on the scheduling request, whether a virtual machine resource model specifies a NUMA node number for the virtual machine;

[0008] If the virtual machine resource model does not specify the number of NUMA nodes of the virtual machine, determining the target number of NUMA nodes of the virtual machine based on the relationship between the resource size of the virtual machine and the standard resource size;

[0009] Generate a NUMA topology for the virtual machine according to the target NUMA node number and select a corresponding target host.

[0010] Optionally, after determining, based on the scheduling request, whether the virtual machine resource model specifies the number of NUMA nodes for the virtual machine, the method further includes:

[0011] If the virtual machine resource model specifies the NUMA node number of the virtual machine, the target NUMA node number of the virtual machine specified in the virtual machine resource model is obtained, and a corresponding target host is selected according to the target NUMA node number.

[0012] Optionally, determining the target NUMA node number of the virtual machine based on the relationship between the resource size of the virtual machine and the standard resource size includes:

[0013] Comparing the number of central processing units to be created and the memory resource size of the virtual machine with the standard number of central processing units of a single NUMA node and the standard memory resource size of a single NUMA node to obtain corresponding comparison results;

[0014] If the comparison result is that the number of central processing units to be created and the memory resource size are both less than and / or equal to the standard number of central processing units of a single NUMA node and the standard memory resource size of a single NUMA node, the target NUMA node number of the virtual machine is set to the preset number.

[0015] Optionally, after respectively comparing the number of central processing units to be created and the memory resource size of the virtual machine with the standard number of central processing units of a single NUMA node and the standard memory resource size of a single NUMA node to obtain corresponding comparison results, the method further includes:

[0016] If the comparison result is that the number of central processing units to be created is greater than the standard number of central processing units of a single NUMA node and / or the memory resource size is greater than the standard memory resource size of a single NUMA node, the preset number is adjusted and the target NUMA node number of the virtual machine is set to the adjusted preset number.

[0017] Optionally, after receiving the scheduling request for the virtual machine and before determining whether the virtual machine resource model specifies the number of NUMA nodes for the virtual machine, the method further includes:

[0018] The arrangement order of the filter queue composed of resource filters is adjusted, and the target filter for filtering NUMA resources is placed at the end of the filter queue.

[0019] Optionally, generating a NUMA topology for the virtual machine according to the target number of NUMA nodes and selecting a corresponding target host includes:

[0020] The target filter is used to generate a NUMA topology of the virtual machine based on the target NUMA node number, and a corresponding target host is selected from a host list.

[0021] Optionally, the selecting a corresponding target host from a host list using the target filter and based on the number of target NUMA nodes includes:

[0022] Based on the target NUMA node number, determine whether there is a corresponding target host in the host list. If not, adjust the target NUMA node number, determine the newly added target NUMA node number, and use the newly added target NUMA node number to select the corresponding target host.

[0023] In a second aspect, the present application discloses a virtual machine NUMA topology generation device, comprising:

[0024] A determination module, configured to, after receiving a scheduling request for a virtual machine, determine, based on the scheduling request, whether the virtual machine resource model specifies the number of NUMA nodes for the virtual machine;

[0025] a resource determination module, configured to determine a target NUMA node number for the virtual machine based on a relationship between a resource size of the virtual machine and a standard resource size if the virtual machine resource model does not specify a NUMA node number for the virtual machine;

[0026] A topology generation module is used to generate a NUMA topology of the virtual machine according to the target NUMA node number and select a corresponding target host.

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

[0028] Memory, used to store computer programs;

[0029] The processor is configured to execute the computer program to implement the steps of the aforementioned method for generating a NUMA topology of a virtual machine.

[0030] In a fourth aspect, the present application discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the steps of the aforementioned virtual machine NUMA topology generation method are implemented.

[0031] It can be seen that the present application discloses a method for generating a NUMA topology for a virtual machine, comprising: after receiving a scheduling request for a virtual machine, judging whether the virtual machine resource model specifies the number of NUMA nodes for the virtual machine based on the scheduling request; if the virtual machine resource model does not specify the number of NUMA nodes for the virtual machine, determining the target number of NUMA nodes for the virtual machine based on the relationship between the resource size of the virtual machine and the standard resource size; generating the NUMA topology for the virtual machine according to the target number of NUMA nodes and selecting the corresponding target host. It can be seen that by adding the step of judging the scheduling request for the virtual machine, compared to the process of directly allocating the corresponding NUMA topology in a default manner after receiving the scheduling request, the present application adds a process of dynamically selecting the NUMA topology of the virtual machine during the scheduling process. The NUMA topology used for the final virtual creation is the optimal NUMA topology for the virtual machine, which can ensure the success rate of virtual machine creation while giving priority to ensuring that the virtual machine has the highest performance, and can cover complex scenarios where the hardware conditions of the alternative host list are not the same. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0033] Figure 1 This is a flow chart of a method for generating a virtual machine NUMA topology disclosed in this application;

[0034] Figure 2 This is a flowchart of a specific virtual machine NUMA topology generation method disclosed in this application;

[0035] Figure 3 A schematic diagram of a virtual machine NUMA topology device structure disclosed in this application;

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

[0037] 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 embodiments described are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.

[0038] In virtualization scenarios, a virtual machine achieves the best CPU and memory performance under the same hardware conditions when bound to a single NUMA node on the host. Currently, in OpenStack nova, a NUMA topology is not specified for a virtual machine by default when it is created, unless the user specifies hw:numa_nodes in the specification metadata. Therefore, the default performance of a virtual machine created without a specified NUMA topology is poor. Furthermore, since users can set whether to specify a NUMA topology in the specification metadata, in actual production environments, virtual machines with and without a specified NUMA topology may run simultaneously on the same host. However, since the memory usage of virtual machines without a specified NUMA topology is actually randomly distributed across the host's NUMA nodes and cannot be controlled by the management side, memory contention may occur when the two types of virtual machines coexist on the same host, impacting business stability. The community needs to specify hw:numa_nodes in the specification metadata to create a virtual machine with a specified NUMA topology, which is prone to configuration errors and high cost of use.

[0039] The OpenStack community recommends specifying hw:mem_page_size=any in the specification metadata to assign a NUMA topology with one NUMA node to VMs by default when they are created. However, this can cause VM creation to fail for certain larger specifications. Publicly available resources have not yet revealed a solution that automatically generates the optimal NUMA topology for VMs, reduces costs, and prioritizes maximum performance while ensuring a high VM creation success rate.

[0040] To this end, this application provides a virtual machine NUMA topology generation solution that does not require users to specify the number of NUMA nodes in the specification metadata. The system can also select the optimal NUMA topology by default based on the alternative host situation, reducing user difficulty and cost.

[0041] Reference Figure 1 As shown, an embodiment of the present invention discloses a method for generating a virtual machine NUMA topology, including:

[0042] Step S11: After receiving a scheduling request for a virtual machine, it is determined based on the scheduling request whether the virtual machine resource model specifies the number of NUMA nodes of the virtual machine.

[0043] In this embodiment, in a virtualization scenario, multiple virtual machines are created by a host to process corresponding business requests, wherein each virtual machine is isolated from the other, that is, the memory and central processing unit resources occupied by each virtual machine are also separated and do not affect each other. In the OpenStack project, the virtual machine computing resources are managed by nova. The OpenStack is an open source cloud computing management platform project and a combination of a series of open source software projects. When managing the resources of the virtual machine, NUMA is involved. The NUMA has multiple nodes, each node can have multiple CPUs, and a shared memory controller is used within the node. Therefore, all memory access delays of the node are the same for all central processing units of the node. Therefore, after receiving a scheduling request for a virtual machine, the resources in the virtual machine resource model are first judged, that is, whether the specification contains the number of local NUMA nodes. Specifically, when executing a scheduling request, the resource scheduling component nova-scheduler first determines whether the hw:numa_nodes metadata is specified in the specification. The nova-scheduler is the component responsible for scheduling in the nova project and is used to select the best target host for creating a virtual machine. Specifically, it uses multiple filters to filter different resources, and finally selects the host whose various resources meet the preset conditions as the target host.

[0044] In this embodiment, after determining whether the virtual machine resource model specifies the number of NUMA nodes for the virtual machine based on the scheduling request, the method further includes: if the virtual machine resource model specifies the number of NUMA nodes for the virtual machine, obtaining the target number of NUMA nodes for the virtual machine specified in the virtual machine resource model, and selecting a corresponding target host according to the target number of NUMA nodes. It is understandable that if the specification has already specified the number of NUMA nodes for the virtual machine, that is, specified the hw:numa_nodes metadata, then the target host with appropriate resources is selected according to the specified hw:numa_nodes metadata, and subsequent operations are not triggered. That is, the virtual machine to be created at this time defaults to a virtual machine with a specified NUMA topology.

[0045] Step S12: If the virtual machine resource model does not specify the NUMA node number of the virtual machine, then determine the target NUMA node number of the virtual machine based on the relationship between the resource size of the virtual machine and the standard resource size.

[0046] In this embodiment, if the virtual machine resource model does not specify the number of NUMA nodes of the virtual machine, the operation of dynamically generating and adjusting the virtual machine NUMA topology is triggered, and the resource size of the virtual machine is compared with the preset standard resource size, wherein the virtual machine resources to be compared can specifically be the central processing unit to be created, memory resources, etc. Specifically, the number of central processing units to be created and the memory resource size of the virtual machine are compared with the standard number of central processing units of a single NUMA node and the standard memory resource size of a single NUMA node to obtain corresponding comparison results; it can be understood that the maximum number of NUMA nodes of a single host in the list of alternative hosts is recorded as max_node_num; the maximum memory size of a single NUMAnode of the host is recorded as max_node_mem; wherein the maximum number of CPUs of a single host NUMA node is recorded as max_node_cpu; max_node_mem is generally used in pair with max_node_cpu. The maximum memory of the largest NUMAnode of the single host is the standard memory resource of a single NUMA node, and the maximum CPU of the largest NUMA node of the single host is the central processing unit of a single NUMA node.

[0047] In a specific embodiment, if the comparison result is that the number of central processing units to be created and the size of the memory resources are both less than and / or equal to the standard number of central processing units of a single NUMA node and the standard memory resource size of a single NUMA node, the target number of NUMA nodes of the virtual machine is set to a preset number. It is understandable that when the comparison result is that the number of central processing units to be created is not greater than max_node_cpu, and the size of the memory resources is not greater than max_node_mem, it indicates that the resources required by the virtual machine at this time can work under a default number of nodes, that is, the number of NUMA nodes is set to a preset number. Specifically, the preset number is set to 1, then when the comparison results of the two resources of the virtual machine are both less than the preset two resources, the number of NUMA nodes of the NUMA topology of the virtual machine can be set to 1. When the preset number is set to 1, it is mainly considered to improve the performance when the virtual machine is deployed within a NUMA node.

[0048] In another specific embodiment, if the comparison result is that the number of central processors to be created is greater than the standard number of central processors of a single NUMA node and / or the memory resource size is greater than the standard memory resource size of a single NUMA node, the preset number is adjusted, and the target NUMA node number of the virtual machine is set to the adjusted preset number. It can be understood that when any of the following three situations occurs, the operation of adjusting the number of NUMA nodes is triggered, wherein the three situations are specifically: the comparison result is that the number of central processors to be created is greater than max_node_cpu, and the memory resource size is not greater than max_node_mem; the comparison result is that the number of central processors to be created is not greater than max_node_cpu, and the memory resource size is greater than max_node_mem; the comparison result is that the number of central processors to be created is greater than max_node_cpu, and the memory resource size is also greater than max_node_mem; when the NUMA node number adjustment operation is triggered, since the preset number of NUMA nodes is set If it is 1, it indicates that the number of CPUs and memory requirements of the deployed virtual machine are relatively large. In this case, setting it to 1 is not appropriate. The virtual machine needs to use 2 nodes or more nodes. Specifically, set the number of NUMA nodes to max(mem / max_node_mme,cpu / max_node_cpu) (take the smallest even number), that is, calculate the number of central processing units to be created for the virtual machine divided by the first value of the standard number of central processing units of a single NUMA node, calculate the memory resource size of the virtual machine divided by the second value of the standard memory resource size of a single NUMA node, take the maximum value of the first and second values, where the maximum value taken must also meet the minimum even number condition, and use the updated maximum value as the adjusted preset number.

[0049] Step S13: Generate a NUMA topology for the virtual machine according to the target NUMA node quantity and select a corresponding target host.

[0050] In this embodiment, a NUMA topology is generated based on the target NUMA node number determined above, and the corresponding target host is selected from the host list. Specifically, the strategy of evenly distributing CPU and memory as much as possible is as follows:

[0051] If the number of CPUs in a virtual machine is divisible by the number of NUMA nodes, for example, if the number of CPUs is 32 and the number of NUMA nodes is 2, the resulting NUMA topology is evenly distributed, i.e., [node0:{vcpu=16,memory=mem / 2}, node1:{vcpu=16,memory=mem / 2}]

[0052] Otherwise, for example, if the number of CPUs is 22 and the number of NUMA nodes is set to 4, the generated NUMA topology is as evenly distributed as possible, that is, [node0: {vcpu=6, memory=mem / 4}, node1: {vcpu=6, memory=mem / 4}, node2: {vcpu: 5, memory=mem / 4}, node3: {vcpu: 5, memory=mem / 4}].

[0053] It can be seen that the present application discloses a method for generating a NUMA topology for a virtual machine, comprising: after receiving a scheduling request for a virtual machine, judging whether the virtual machine resource model specifies the number of NUMA nodes for the virtual machine based on the scheduling request; if the virtual machine resource model does not specify the number of NUMA nodes for the virtual machine, determining the target number of NUMA nodes for the virtual machine based on the relationship between the resource size of the virtual machine and the standard resource size; generating the NUMA topology for the virtual machine according to the target number of NUMA nodes and selecting the corresponding target host. It can be seen that by adding the step of judging the scheduling request for the virtual machine, compared to the process of directly allocating the corresponding NUMA topology in a default manner after receiving the scheduling request, the present application adds a process of dynamically selecting the NUMA topology of the virtual machine during the scheduling process. The NUMA topology used for the final virtual creation is the optimal NUMA topology for the virtual machine, which can ensure the success rate of virtual machine creation while giving priority to ensuring that the virtual machine has the highest performance, and can cover complex scenarios where the hardware conditions of the alternative host list are not the same.

[0054] Reference Figure 2 As shown, the embodiment of the present invention discloses a specific method for generating a virtual machine NUMA topology. Compared with the previous embodiment, this embodiment further illustrates and optimizes the technical solution. Specifically:

[0055] Step S21: adjusting the arrangement order of the filter queue composed of resource filters, and placing the target filter for filtering NUMA resources at the end of the filter queue.

[0056] In this embodiment, the target filter NUMATopologyFilter for filtering NUMA resources is first placed after all resource filters for performing NUMA resource filtering last, wherein the resource filters are all used to filter whether the corresponding resources of the host meet the filters of the virtual machine.

[0057] Step S22: After receiving the scheduling request for the virtual machine, it is determined based on the scheduling request whether the virtual machine resource model specifies the number of NUMA nodes of the virtual machine.

[0058] Step S23: If the virtual machine resource model does not specify the NUMA node number of the virtual machine, the target NUMA node number of the virtual machine is determined based on the relationship between the resource size of the virtual machine and the standard resource size.

[0059] For more detailed processing procedures in steps S22 and S23, please refer to the aforementioned disclosed embodiments, which will not be described again here.

[0060] Step S24: Generate a NUMA topology for the virtual machine according to the target NUMA node quantity and select a corresponding target host.

[0061] In this embodiment, after determining the target number of NUMA nodes, the target filter is used to generate the NUMA topology of the virtual machine based on the target number of NUMA nodes and the corresponding target host is selected from the host list. Specifically, NUMATopologyFilter is executed to generate the corresponding NUMA topology and select the target host that meets the target number of NUMA nodes from the host list. After determining the target host, the selected host list and the generated NUMA topology are returned, and the process ends here.

[0062] In this embodiment, based on the target NUMA node number, it is determined whether there is a corresponding target host in the host list. If not, the target NUMA node number is adjusted, the newly added target NUMA node number is determined, and the corresponding target host is selected using the newly added target NUMA node number. It is understandable that when executing NUMATopologyFilter and selecting a target host that meets the target NUMA node number from the host list, if there is no target host that meets the target NUMA node number in the host list, the NUMA node number is adjusted again. The adjustment strategy is to increase the NUMA node number (take the smallest even number), and use the current newly added target NUMA node number to re-match the appropriate target host from the host list. If the current newly added target NUMA node number is greater than max_node_num or greater than the number of virtual machine CPUs and still no target host can be selected, the process ends.

[0063] In this embodiment, since the candidate host list when the virtual machine is created may have different hardware structures, such as: the hosts have different numbers of NUMA nodes, and the total amount of CPU or memory of a single NUMA node of the host is different, it is necessary to use the target NUMA node number obtained after processing to select a suitable target host in the host list during the scheduling process, so as to dynamically generate and adjust the virtual machine NUMA topology to achieve the purpose of selecting the optimal NUMA topology.

[0064] As can be seen, virtual machines created in the environment are all virtual machines with a specified NUMA topology by default. While improving virtual machine performance, it also solves the possible memory contention problem when running virtual machines with a specified NUMA topology and virtual machines without a specified NUMA topology on the host at the same time. When generating the optimal NUMA topology for the virtual machine, both performance and the success rate of virtual machine creation are taken into account. The optimal NUMA topology solution is automatically selected for the virtual machine, and the created virtual machine has the best performance by default, while also ensuring the success rate of virtual machine creation. This is implemented in conjunction with the OpenStack nova scheduling process, so that the optimal NUMA topology can be selected even if the hardware conditions of the alternative host list are different.

[0065] Reference Figure 3 As shown, the embodiment of the present invention also correspondingly discloses a virtual machine NUMA topology generation device, including:

[0066] The judging module 11 is configured to, after receiving a scheduling request for a virtual machine, determine, based on the scheduling request, whether the virtual machine resource model specifies the number of NUMA nodes for the virtual machine;

[0067] a resource determination module 12, configured to determine the target NUMA node number of the virtual machine based on the relationship between the resource size of the virtual machine and the standard resource size if the virtual machine resource model does not specify the NUMA node number of the virtual machine;

[0068] The topology generation module 13 is configured to generate a NUMA topology of the virtual machine according to the target NUMA node quantity and select a corresponding target host.

[0069] The judgment module 11 is specifically used to create multiple virtual machines through the host in a virtualization scenario to process corresponding business requests, wherein each virtual machine is isolated from each other, that is, the memory and central processing unit resources occupied by each virtual machine are also separated and do not affect each other. In the OpenStack project, the virtual machine computing resources are managed by nova. The OpenStack is an open source cloud computing management platform project and a combination of a series of open source software projects. When managing the resources of the virtual machine, NUMA is involved. The NUMA has multiple nodes, each node can have multiple CPUs, and a shared memory controller is used within the node. Therefore, all memory access delays of the node are the same for all central processing units of the node. Therefore, after receiving the scheduling request of the virtual machine, the resources in the virtual machine resource model are first judged, that is, whether the number of NUMA nodes included in the specification is judged. Specifically, when the resource scheduling component nova-scheduler executes the scheduling request, it first determines whether the hw:numa_nodes metadata is specified in the specification. The nova-scheduler is the component responsible for scheduling in the nova project, and is used to select the best target host for the creation of the virtual machine. Specifically, different resources are filtered through multiple filters, and finally the host whose various resources meet the preset conditions after filtering is used as the target host. After judging whether the virtual machine resource model specifies the number of NUMA nodes of the virtual machine based on the scheduling request, it also includes: if the virtual machine resource model specifies the number of NUMA nodes of the virtual machine, then obtaining the target NUMA node number of the virtual machine specified in the virtual machine resource model, and selecting the corresponding target host according to the target NUMA node number. It is understandable that if the specification has specified the number of NUMA nodes for the virtual machine, that is, the hw:numa_nodes metadata is specified, the target host with appropriate resources is selected according to the specified hw:numa_nodes metadata, and no subsequent operations are triggered. That is, the virtual machine to be created at this time defaults to a virtual machine with the specified NUMA topology.

[0070] The resource determination module 12 is specifically used to trigger the operation of dynamically generating and adjusting the virtual machine NUMA topology if the virtual machine resource model does not specify the number of NUMA nodes of the virtual machine, and compare the resource size of the virtual machine with the preset standard resource size, wherein the virtual machine resources to be compared can specifically be the central processing unit to be created, memory resources, etc. Specifically, the number of central processing units to be created and the memory resource size of the virtual machine are compared with the standard number of central processing units of a single NUMA node and the standard memory resource size of a single NUMA node to obtain corresponding comparison results; it can be understood that the maximum number of NUMA nodes of a single host in the candidate host list is recorded as max_node_num; the maximum memory size of a single NUMA node of the host is recorded as max_node_mem; wherein the maximum number of CPUs of a single host NUMA node is recorded as max_node_cpu; max_node_mem is generally used in pair with max_node_cpu. The maximum memory of the largest NUMA node of the single host is the standard memory resource of a single NUMA node, and the maximum CPU of the largest NUMA node of the single host is the central processing unit of a single NUMA node.

[0071] In a specific embodiment, if the comparison result is that the number of central processing units to be created and the size of the memory resources are both less than and / or equal to the standard number of central processing units of a single NUMA node and the standard memory resource size of a single NUMA node, the target number of NUMA nodes of the virtual machine is set to a preset number. It is understandable that when the comparison result is that the number of central processing units to be created is not greater than max_node_cpu, and the size of the memory resources is not greater than max_node_mem, it indicates that the resources required by the virtual machine at this time can work under a default number of nodes, that is, the number of NUMA nodes is set to a preset number. Specifically, the preset number is set to 1, then when the comparison results of the two resources of the virtual machine are both less than the preset two resources, the number of NUMA nodes of the NUMA topology of the virtual machine can be set to 1. When the preset number is set to 1, it is mainly considered to improve the performance when the virtual machine is deployed within a NUMA node.

[0072] In another specific embodiment, if the comparison result is that the number of central processors to be created is greater than the standard number of central processors of a single NUMA node and / or the memory resource size is greater than the standard memory resource size of a single NUMA node, the preset number is adjusted, and the target NUMA node number of the virtual machine is set to the adjusted preset number. It can be understood that when any of the following three situations occurs, the operation of adjusting the number of NUMA nodes is triggered, wherein the three situations are specifically: the comparison result is that the number of central processors to be created is greater than max_node_cpu, and the memory resource size is not greater than max_node_mem; the comparison result is that the number of central processors to be created is not greater than max_node_cpu, and the memory resource size is greater than max_node_mem; the comparison result is that the number of central processors to be created is greater than max_node_cpu, and the memory resource size is also greater than max_node_mem; when the NUMA node number adjustment operation is triggered, since the preset number of NUMA nodes is set If it is 1, it indicates that the number of CPUs and memory requirements of the deployed virtual machine are relatively large. In this case, setting it to 1 is not appropriate. The virtual machine needs to use 2 nodes or more nodes. Specifically, set the number of NUMA nodes to max(mem / max_node_mme,cpu / max_node_cpu) (take the smallest even number), that is, calculate the number of central processing units to be created for the virtual machine divided by the first value of the standard number of central processing units of a single NUMA node, calculate the memory resource size of the virtual machine divided by the second value of the standard memory resource size of a single NUMA node, take the maximum value of the first and second values, where the maximum value taken must also meet the minimum even number condition, and use the updated maximum value as the adjusted preset number.

[0073] It can be seen that the present application discloses a virtual machine NUMA topology generation device, comprising: after receiving a scheduling request for a virtual machine, judging whether the virtual machine resource model specifies the number of NUMA nodes of the virtual machine based on the scheduling request; if the virtual machine resource model does not specify the number of NUMA nodes of the virtual machine, determining the target number of NUMA nodes of the virtual machine based on the relationship between the resource size of the virtual machine and the standard resource size; generating the NUMA topology of the virtual machine according to the target number of NUMA nodes and selecting the corresponding target host. It can be seen that by adding the step of judging the scheduling request of the virtual machine, compared with the process of directly allocating the corresponding NUMA topology in a default manner after receiving the scheduling request, the present application adds a process of dynamically selecting the virtual machine NUMA topology during the scheduling process. The NUMA topology used for the final virtual creation is the optimal NUMA topology of the virtual machine, which can ensure the success rate of virtual machine creation while giving priority to ensuring that the virtual machine has the highest performance, and can cover complex scenarios where the hardware conditions of the alternative host list are not the same.

[0074] In some specific implementations, the virtual machine NUMA topology generating device may specifically include:

[0075] The host selection unit is configured to obtain the target NUMA node number of the virtual machine specified in the virtual machine resource model if the virtual machine resource model specifies the NUMA node number of the virtual machine, and select a corresponding target host according to the target NUMA node number.

[0076] In some specific implementations, the resource determination module 12 may specifically include:

[0077] A first quantity determination unit is configured to compare the number of central processing units to be created and the memory resource size of the virtual machine with the standard number of central processing units of a single NUMA node and the standard memory resource size of a single NUMA node, respectively, to obtain corresponding comparison results;

[0078] If the comparison result is that the number of central processing units to be created and the memory resource size are both less than and / or equal to the standard number of central processing units of a single NUMA node and the standard memory resource size of a single NUMA node, the target NUMA node number of the virtual machine is set to the preset number.

[0079] In some specific implementations, the virtual machine NUMA topology generating device may specifically include:

[0080] The second quantity determination unit is used to adjust the preset quantity and set the target NUMA node number of the virtual machine to the adjusted preset quantity if the comparison result is that the number of central processing units to be created is greater than the standard number of central processing units of a single NUMA node and / or the memory resource size is greater than the standard memory resource size of a single NUMA node.

[0081] In some specific implementations, the virtual machine NUMA topology generating device may specifically include:

[0082] The sequence adjustment unit is used to adjust the arrangement sequence of the filter queue composed of resource filters, and place the target filter for filtering NUMA resources at the end of the filter queue.

[0083] In some specific implementations, the topology generation module 13 may specifically include:

[0084] The topology generation submodule is configured to generate a NUMA topology of the virtual machine based on the target NUMA node number by using the target filter and selecting a corresponding target host from a host list.

[0085] In some specific implementations, the topology generation submodule may specifically include:

[0086] The host determination unit is used to determine whether there is a corresponding target host in the host list based on the target NUMA node number. If not, the target NUMA node number is adjusted, the new target NUMA node number is determined, and the corresponding target host is selected using the new target NUMA node number.

[0087] Furthermore, the embodiment of the present application also discloses an electronic device, Figure 4 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content in the diagram should not be considered as any limitation to the scope of application of the present application.

[0088] Figure 4 This is a schematic diagram of the structure of an electronic device 20 provided in an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps of the virtual machine NUMA topology generation method disclosed in any of the aforementioned embodiments. Furthermore, the electronic device 20 in this embodiment may specifically be an electronic computer.

[0089] In this embodiment, the power supply 23 is used to provide operating 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 the external device. The communication protocol it follows is any communication protocol that can be applied to the technical solution of this application and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world. Its specific interface type can be selected according to specific application needs and is not specifically limited here.

[0090] Among them, the processor 21 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 21 can be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 21 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 21 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 21 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.

[0091] In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, random access memory, disk or CD, etc. The resources stored thereon can include an operating system 221, a computer program 222, etc., and the storage method can be temporary storage or permanent storage.

[0092] The operating system 221 is used to manage and control the hardware devices and computer programs 222 on the electronic device 20, so as to enable the processor 21 to calculate and process the massive amount of data 223 in the memory 22. The operating system 221 can be Windows Server, NetWare, Unix, Linux, etc. In addition to including computer programs capable of implementing the virtual machine NUMA topology generation method performed by the electronic device 20 as disclosed in any of the aforementioned embodiments, the computer programs 222 can further include computer programs capable of performing other specific tasks. The data 223 can include not only data received by the electronic device and transmitted from external devices, but also data collected by its own input and output interface 25.

[0093] Furthermore, this application also discloses a computer-readable storage medium for storing a computer program; wherein, when executed by a processor, the computer program implements the aforementioned method for generating a virtual machine NUMA topology. The specific steps of this method can be found in the corresponding contents disclosed in the aforementioned embodiments and will not be further described here.

[0094] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from the other embodiments. Reference can be made to the descriptions of the identical or similar parts between the various embodiments. For the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple, and the relevant parts can be referred to the descriptions of the methods.

[0095] Professionals can also further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented with electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application. The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly with hardware, a software module executed by a processor, or a combination of the two. The software module can 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.

[0096] Finally, it should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or device comprising the element.

[0097] The above describes in detail the virtual machine NUMA topology generation method, apparatus, device, and medium provided by the present invention. Specific examples are used herein to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only intended to help understand the method and core concept of the present invention. At the same time, for those skilled in the art, based on the concept of the present invention, there may be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as limiting the present invention.

Claims

1. A method for generating a virtual machine NUMA topology, characterized in that: include: After receiving a scheduling request for a virtual machine, determining, based on the scheduling request, whether a virtual machine resource model specifies a NUMA node number for the virtual machine; If the virtual machine resource model does not specify the number of NUMA nodes of the virtual machine, determining the target number of NUMA nodes of the virtual machine based on the relationship between the resource size of the virtual machine and the standard resource size; Generate a NUMA topology for the virtual machine according to the target NUMA node number and select a corresponding target host; After determining whether the virtual machine resource model specifies the number of NUMA nodes of the virtual machine based on the scheduling request, the method further includes: If the virtual machine resource model specifies the NUMA node number of the virtual machine, the target NUMA node number of the virtual machine specified in the virtual machine resource model is obtained, and a corresponding target host is selected according to the target NUMA node number.

2. The method for generating a virtual machine NUMA topology according to claim 1, wherein: The determining the target NUMA node number of the virtual machine based on the relationship between the resource size of the virtual machine and the standard resource size includes: Comparing the number of central processing units to be created and the memory resource size of the virtual machine with the standard number of central processing units of a single NUMA node and the standard memory resource size of a single NUMA node to obtain corresponding comparison results; If the comparison result is that the number of central processing units to be created and the memory resource size are both less than and / or equal to the standard number of central processing units of a single NUMA node and the standard memory resource size of a single NUMA node, the target NUMA node number of the virtual machine is set to the preset number.

3. The method for generating a virtual machine NUMA topology according to claim 2, wherein: After respectively comparing the number of central processing units to be created and the memory resource size of the virtual machine with the standard number of central processing units of a single NUMA node and the standard memory resource size of a single NUMA node to obtain corresponding comparison results, the method further includes: If the comparison result is that the number of central processing units to be created is greater than the standard number of central processing units of a single NUMA node and / or the memory resource size is greater than the standard memory resource size of a single NUMA node, the preset number is adjusted and the target NUMA node number of the virtual machine is set to the adjusted preset number.

4. The method for generating a virtual machine NUMA topology according to any one of claims 1 to 3, wherein: After receiving the scheduling request for the virtual machine and before determining whether the virtual machine resource model specifies the number of NUMA nodes for the virtual machine, the method further includes: The arrangement order of the filter queue composed of resource filters is adjusted, and the target filter for filtering NUMA resources is placed at the end of the filter queue.

5. The method for generating a virtual machine NUMA topology according to claim 4, wherein: Generating the NUMA topology of the virtual machine according to the target NUMA node number and selecting a corresponding target host includes: The target filter is used to generate a NUMA topology of the virtual machine based on the target NUMA node number, and a corresponding target host is selected from a host list.

6. The method for generating a virtual machine NUMA topology according to claim 5, wherein: The selecting a corresponding target host from a host list by using the target filter and based on the target NUMA node quantity includes: Based on the target NUMA node number, determine whether there is a corresponding target host in the host list. If not, adjust the target NUMA node number, determine the newly added target NUMA node number, and use the newly added target NUMA node number to select the corresponding target host.

7. A virtual machine NUMA topology generation device, characterized in that: include: A determination module, configured to, after receiving a scheduling request for a virtual machine, determine, based on the scheduling request, whether the virtual machine resource model specifies the number of NUMA nodes for the virtual machine; a resource determination module, configured to determine a target NUMA node number for the virtual machine based on a relationship between a resource size of the virtual machine and a standard resource size if the virtual machine resource model does not specify a NUMA node number for the virtual machine; A topology generation module is used to generate a NUMA topology for the virtual machine according to the target number of NUMA nodes and select a corresponding target host; The host selection unit is configured to obtain the target NUMA node number of the virtual machine specified in the virtual machine resource model if the virtual machine resource model specifies the NUMA node number of the virtual machine, and select a corresponding target host according to the target NUMA node number.

8. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor, configured to execute the computer program to implement the steps of the method for generating a virtual machine NUMA topology according to any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that Used to store a computer program; wherein, when the computer program is executed by a processor, the steps of the virtual machine NUMA topology generation method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Virtual machine scheduling method and device, equipment and medium

    CN114020405A

  • Virtual machine creating method and related equipment

    CN114153549A