CN116880965B - Node distribution method, system, device and medium - Google Patents

Node distribution method, system, device and medium Download PDF

Info

Publication number
CN116880965B
CN116880965B CN202311154278.XA CN202311154278A CN116880965B CN 116880965 B CN116880965 B CN 116880965B CN 202311154278 A CN202311154278 A CN 202311154278A CN 116880965 B CN116880965 B CN 116880965B
Authority
CN
China
Prior art keywords
memory
allocation
memory access
virtual machine
uniform
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202311154278.XA
Other languages
Chinese (zh)
Other versions
CN116880965A (en
Inventor
解琰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Suzhou Inspur Intelligent Technology Co Ltd
Original Assignee
Suzhou Inspur Intelligent Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Suzhou Inspur Intelligent Technology Co Ltd filed Critical Suzhou Inspur Intelligent Technology Co Ltd
Priority to CN202311154278.XA priority Critical patent/CN116880965B/en
Publication of CN116880965A publication Critical patent/CN116880965A/en
Application granted granted Critical
Publication of CN116880965B publication Critical patent/CN116880965B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5061Partitioning or combining of resources
    • G06F9/5077Logical partitioning of resources; Management or configuration of virtualized resources
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45583Memory management, e.g. access or allocation

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Memory System (AREA)
  • Memory System Of A Hierarchy Structure (AREA)

Abstract

The application discloses a node allocation method, a system, a device and a medium, which relate to the field of computer memory scheduling and are used for solving the problem that the traditional virtualization platform only pays attention to overall resource allowance and possibly performs memory allocation on certain nodes, so that memory resources of other nodes are wasted. In the scheme, when a virtual machine is created, the memory specification of the virtual machine and the first residual memory of each physical non-uniform memory access node in a host are obtained; and distributing memory for the virtual machine according to the first residual memory and the memory specification. Therefore, the node allocation method considers the residual memory condition of each node, allocates the memory which can be accessed in the same node for the virtual machine, and improves the performance of the virtual machine; by allocating the memory by considering the first residual memory and the memory specification of each physical non-uniform memory access node, the resources of the host can be more reasonably and uniformly utilized, so that the resource utilization rate of the host is improved, and the resource waste is avoided.

Description

Node distribution method, system, device and medium
Technical Field
The present invention relates to the field of computer memory scheduling, and in particular, to a node allocation method, system, device, and medium.
Background
The development of virtualization technology provides flexible and changeable resource allocation methods for various application scenarios, and particularly, the flexible allocation of CPUs (Central Processing Unit, central processing units) and memories is more prominent. The virtualized host integrates a large amount of computing resources, so that the resources are integrated and uniformly managed, the virtual machine is conveniently established, the CPU and the memory resources of the host are used as required, and diversified virtual machine configuration is realized so as to adapt to the requirements of different application scenes on the CPU and the memory resources. This feature significantly reduces the daily maintenance effort of the informationized department.
However, the conventional virtualization platform only pays attention to the overall resource allowance when allocating the CPU and the memory resources, so long as the allowance resources are enough in the allocation process, the underlying virtualization software automatically allocates the CPU and the memory nodes for the virtual machine to use, and ignores the residual resources of the host NUMA (Non-Uniform Memory Access ) node, thereby ignoring the problem of reduced performance of the virtual machine, which may be caused by the aspect. The NUMA node divides the CPU and the memory resource of the host into independent nodes, and the CPU in each node accesses the memory in the node at the highest speed. When the memory of the node is insufficient, the CPU accesses the memory of other nodes across the node, but this increases the performance loss and reduces the performance of the application on the host.
Disclosure of Invention
The purpose of the application is to provide a node allocation method, a system, a device and a medium, which consider the residual memory condition of each node and allocate memory for a virtual machine, thereby improving the performance of the virtual machine; by considering the first residual memory and the memory specification of each physical NUMA node to allocate the memory, the resources of the host can be utilized more reasonably and uniformly, and the situation that the traditional virtualization platform only pays attention to the total resource allowance and possibly allocates the memory on certain nodes, so that the memory resources of other nodes are wasted is avoided, so that the resource utilization rate of the host is improved, and the resource waste is avoided.
In order to solve the above technical problems, the present application provides a node allocation method, including:
when a virtual machine is created, acquiring the memory specification of the virtual machine and the first residual memory of each physical non-uniform memory access node in a host;
and distributing memory for the virtual machine according to each first residual memory and the memory specification.
In one embodiment, allocating memory for the virtual machine according to each of the first remaining memory and the memory specification includes:
determining a target allocation strategy according to the first residual memory and the memory specification;
And distributing memory for the virtual machine from the first residual memory of each physical non-uniform memory access node according to the target distribution strategy.
In one embodiment, after determining the target allocation policy according to the first remaining memory and the memory specification, the method further includes:
determining a plurality of target physical non-uniform memory access nodes and memories to be allocated corresponding to each target physical non-uniform memory access node according to the target allocation policy;
creating a plurality of virtual non-uniform memory access nodes, wherein the virtual non-uniform memory access nodes are in one-to-one correspondence with the physical non-uniform memory access nodes, and the memory configuration information of the virtual non-uniform memory access nodes is the same as the memory to be allocated of the target physical non-uniform memory access nodes corresponding to the virtual non-uniform memory access nodes;
and when the virtual machine is started, binding the virtual non-uniform memory access node with a target physical non-uniform memory access node corresponding to the virtual non-uniform memory access node.
In one embodiment, the target allocation policy satisfies a preset condition, where the preset condition is:
and after the memory is allocated to the virtual machine from the first residual memories of each physical non-uniform memory access node according to the target allocation strategy, the difference value of the second residual memories of each two physical non-uniform memory access nodes is within a preset range.
In one embodiment, the target allocation policy is determined in the following manner:
presetting a plurality of distribution strategies to be determined;
calculating a second residual memory of each physical non-uniform memory access node after memory is allocated to the virtual machine according to each allocation policy to be determined;
and determining an allocation strategy to be determined, which is used for enabling the second residual memory of each physical non-uniform memory access node to meet the preset condition after the memory is allocated for the virtual machine, as the target allocation strategy.
In one embodiment, after calculating the second remaining memory of each of the physically non-uniform memory access nodes after allocating memory for the virtual machine according to each allocation policy to be determined, the method further includes:
calculating the dispersion of the second residual memory of each physical non-uniform memory access node according to the second residual memory of each physical non-uniform memory access node;
determining an allocation policy to be determined, which satisfies the preset condition, of the second remaining memory of each of the physical non-uniform memory access nodes after the memory is allocated to the virtual machine as the target allocation policy, including:
and determining an allocation strategy to be determined, of which the dispersion of the second residual memory of each physical non-uniform memory access node is within a dispersion threshold range after the memory is allocated for the virtual machine, as the target allocation strategy.
In one embodiment, determining, as the target allocation policy, an allocation policy to be determined that a dispersion of a second remaining memory of each of the physically non-coherent memory access nodes after allocating memory for the virtual machine is within a dispersion threshold range includes:
and determining an allocation policy to be determined, which is to be determined and has minimum dispersion of the second residual memory of each physical non-uniform memory access node after the memory is allocated for the virtual machine, as the target allocation policy.
In one embodiment, calculating the dispersion of the second remaining memory of each of the physically non-coherent memory access nodes according to the second remaining memory of each of the physically non-coherent memory access nodes includes:
calculating the variance of the second residual memory of each physical non-uniform memory access node according to the second residual memory of each physical non-uniform memory access node;
determining an allocation policy to be determined, which is within a dispersion threshold range, of second remaining memory of each of the physical non-uniform memory access nodes after memory allocation for the virtual machine as the target allocation policy, including:
and determining an allocation strategy to be determined, wherein the allocation strategy to be determined is used for determining that the variance of the second residual memory of each physical non-uniform memory access node is within a variance threshold range after the memory is allocated for the virtual machine, as the target allocation strategy.
In one embodiment, determining, as the target allocation policy, an allocation policy to be determined that a variance of a second remaining memory of each of the physically non-coherent memory access nodes after allocating memory for the virtual machine is within a variance threshold range includes:
and determining an allocation policy to be determined, which is the smallest in variance of the second residual memory of each of the physical non-uniform memory access nodes after the memory is allocated to the virtual machine, as the target allocation policy.
In one embodiment, after obtaining the memory specification of the virtual machine and the remaining memory of each physical non-uniform memory access node in the host, the method further includes:
and eliminating the physical non-uniform memory access nodes which do not meet the preset requirements.
In one embodiment, rejecting a physical non-coherent memory access node that does not meet a preset requirement includes:
and eliminating the physical non-uniform memory access nodes of which the first residual memory is smaller than a preset memory threshold value.
In one embodiment, rejecting a physical non-coherent memory access node that does not meet a preset requirement includes:
and eliminating the physical non-uniform memory access nodes which do not correspond to the memory stripes connected with the host.
In one embodiment, rejecting a physical non-coherent memory access node that does not meet a preset requirement includes:
And eliminating the physical non-uniform memory access node with abnormal running state.
In one embodiment, after rejecting the physically non-uniform memory access nodes that do not meet the preset requirement, the method further includes:
if the number of the physical non-uniform memory access nodes after eliminating the physical non-uniform memory access nodes which do not meet the preset requirements is smaller than the preset number, outputting prompt information, and after receiving an allocation instruction, allocating memory for the virtual machine by using the first residual memory of the physical non-uniform memory access nodes after eliminating the physical non-uniform memory access nodes which do not meet the preset requirements.
In one embodiment, after allocating memory for the virtual machine according to each of the first remaining memory and the memory specification, the method further includes:
outputting an allocation log, wherein the allocation log at least comprises the time for allocating the memory and the allocation condition of the first residual memory of each physical non-uniform memory access node.
In one embodiment, a plurality of allocation policies to be determined are preset, including:
determining the number of the physical non-uniform memory access nodes on the host;
and determining a plurality of allocation strategies to be determined according to the number of the physical non-uniform memory access nodes.
In one embodiment, determining a number of allocation policies to be determined according to the number of the physically non-coherent memory access nodes includes:
selecting partial physical non-uniform memory access nodes from the physical non-uniform memory access nodes respectively as target physical non-uniform memory access nodes, and allocating memory for the virtual machine by using first residual memory of the target physical non-uniform memory access nodes;
and each time the target physical non-uniform memory access node is selected, one allocation strategy to be determined corresponds to the target physical non-uniform memory access node.
In one embodiment, the number of the physical non-uniform memory access nodes is 2 N And selecting part of the physical non-uniform memory access nodes from the physical non-uniform memory access nodes as target physical non-uniform memory access nodes, and allocating memory for the virtual machine by using the first residual memory of the target physical non-uniform memory access nodes, wherein the method comprises the following steps:
respectively from 2 N The physical non-uniform memory access nodes select 2 respectively 0 、2 1 Up to 2 m The target physical non-uniform memory access nodes are selected, N is more than or equal to m is more than or equal to 2, and N and m are integers;
according to the selection of 2 0 、2 1 Up to 2 m And allocating memory for the virtual machine by the first residual memory of each target physical non-uniform memory access node.
In one embodiment, allocating memory for the virtual machine using the first remaining memory of the target physical non-coherent memory access node includes:
and using the first residual memory average of the target physical non-uniform memory access node to allocate memory for the virtual machine.
In order to solve the above technical problem, the present application further provides a node allocation system, including:
the system comprises an acquisition unit, a storage unit and a storage unit, wherein the acquisition unit is used for acquiring the memory specification of the virtual machine and a first residual memory of each physical non-uniform memory access node in a host when the virtual machine is created;
and the allocation unit is used for allocating memory for the virtual machine according to each of the first residual memory and the memory specification.
In order to solve the above technical problem, the present application further provides a node allocation device, including:
a memory for storing a computer program;
a processor for implementing the steps of the node allocation method as described above when storing a computer program.
To solve the above technical problem, the present application further provides a computer readable storage medium, on which a computer program is stored, which when executed by a processor, implements the steps of the node allocation method as described above.
The application provides a node allocation method, a system, a device and a medium, and relates to the field of computer memory scheduling. In the scheme, when a virtual machine is created, the memory specification of the virtual machine and the first residual memory of each physical non-uniform memory access node in a host are obtained; and distributing memory for the virtual machine according to the first residual memory and the memory specification. Therefore, the node allocation method in the application can consider the residual memory condition of each node and allocate the memory for the virtual machine, so that the performance of the virtual machine is improved; by considering the first residual memory and the memory specification of each physical non-uniform memory access node to allocate the memory, the resources of the host can be utilized more reasonably and uniformly, and the situation that the traditional virtualization platform only pays attention to the total resource allowance and possibly allocates the memory on certain nodes, so that the memory resources of other nodes are wasted is avoided, so that the resource utilization rate of the host is improved, and the resource waste is avoided.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following description will briefly explain the drawings needed in the prior art and embodiments, and it is obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings can be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a schematic flow chart of a node allocation method provided in the present application;
FIG. 2 is a schematic diagram of a node distribution system provided herein;
fig. 3 is a schematic diagram of a node allocation apparatus provided in the present application;
fig. 4 is a schematic diagram of a computer readable storage medium provided in the present application.
Detailed Description
The core of the application is to provide a node allocation method, a system, a device and a medium, and consider the residual memory condition of each node to allocate memory for the virtual machine, so as to improve the performance of the virtual machine; by considering the first residual memory and the memory specification of each physical non-uniform memory access node to allocate the memory, the resources of the host can be utilized more reasonably and uniformly, and the situation that the traditional virtualization platform only pays attention to the total resource allowance and possibly allocates the memory on certain nodes, so that the memory resources of other nodes are wasted is avoided, so that the resource utilization rate of the host is improved, and the resource waste is avoided.
For the purposes of making the objects, technical solutions and advantages of the embodiments of the present application more clear, the technical solutions of the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is apparent that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments, which can be made by one of ordinary skill in the art without undue burden from the present disclosure, are within the scope of the present disclosure.
In order to solve the above technical problems, the present application provides a node allocation method, as shown in fig. 1, including:
s11: when a virtual machine is created, acquiring the memory specification of the virtual machine and the first residual memory of each physical non-uniform memory access node in a host;
first, a virtual machine is a software emulated computer system that runs on a physical server host, typically with a separate operating system and application programs. Virtual machines may share computing resources of a host, such as CPU, memory, and storage. The memory specification refers to the memory capacity required by the virtual machine, and represents the memory size required by the virtual machine when running on the host. The physical NUMA node divides the CPU and the memory resource of the host into independent nodes, and the CPU in each node accesses the memory in the node at the highest speed. Such an organization is typically used to improve performance in multiprocessor systems. The first remaining memory refers to the amount of available memory remaining in each physical NUMA node before memory resources are allocated.
The first step of the node allocation method in this embodiment is to obtain the memory specification of the virtual machine and the first remaining memory of each physical NUMA node in the host when the virtual machine is created. This may be accomplished by communicating with host virtualization software. First, the memory specification of the virtual machine needs to be obtained, which can provide it with the required memory capacity information by communicating with the software that manages the virtualization platform. Second, a first remaining memory of each physical NUMA node in the host needs to be obtained. This may be done by communicating with the host virtualization software and querying the memory margin information for each physical node. Once the memory specification of the virtual machine and the first remaining memory of each physical NUMA node in the host are obtained, the next operation, i.e., allocating memory for the virtual machine based on the information, may be continued. The particular node allocation method may vary from implementation to implementation.
In general, this step describes the first operation in the node allocation method, namely, obtaining the memory specification of the virtual machine and the first remaining memory of each physical NUMA node in the host. This step is to consider the resource utilization of the host when allocating memory, so as to improve the performance of the virtual machine.
S12: and distributing memory for the virtual machine according to the first residual memory and the memory specification.
Specifically, in conventional virtualized platforms, memory resources are typically allocated with only a total resource margin in mind, while the remaining resources of the host's NUMA node are ignored. In this embodiment, the remaining memory condition of the NUMA node of the host is considered, so as to more intelligently allocate the memory, thereby improving the performance of the virtual machine. Specifically, the embodiment first obtains the memory specification of the virtual machine, that is, the memory size required by the virtual machine. It then obtains a first remaining amount of memory for each physical NUMA node in the host that is the amount of memory in each node that has not been allocated to other virtual machines. When the memory is allocated to the virtual machine, the memory is allocated by a certain algorithm in combination with the memory specification of the virtual machine and the first residual memory quantity of each node in the host. Possible algorithms include nodes that are preferentially allocated to the first remaining memory most, evenly allocated to individual nodes, etc.
By the method, memory resources can be more reasonably allocated, the residual memory of NUMA nodes of the host is fully utilized, and cross-node access to the memory is avoided, so that the performance of the virtual machine is improved. This is particularly important for applications that have high memory performance requirements, as accessing memory across nodes can result in performance loss.
In one embodiment, allocating memory for the virtual machine according to each of the first remaining memory and the memory specification includes:
determining a target allocation strategy according to the first residual memory and the memory specification;
and distributing memory for the virtual machine from the first residual memory of each physical non-uniform memory access node according to the target distribution strategy.
In such an embodiment, the method for allocating memory for a virtual machine according to each of the first remaining memory and the memory specification includes the steps of: first, a target allocation policy is determined: and determining a target allocation strategy according to the first residual memory and the memory specification. The target allocation policy is to determine how to allocate memory resources according to the first remaining memory of each physical NUMA node in the host and the memory specification of the virtual machine. That is, a target allocation policy first needs to be determined before starting to allocate memory. This ensures that the virtual machine gets sufficient memory resources to provide good performance. Second, memory is allocated for the virtual machine from the first remaining memory of each physical NUMA node: and performing memory allocation for the virtual machine in the first residual memory of each physical NUMA node according to the obtained target allocation strategy. That is, once the target allocation policy is determined, memory allocation may be performed for the virtual machine from the first remaining memory of each physical NUMA node. This means that a specific physical NUMA node is selected to allocate memory to the virtual machine according to the target allocation policy. To ensure that the virtual machine is allocated memory resources on the appropriate NUMA node, which may improve the performance of the virtual machine.
By the method, a target allocation strategy can be formulated according to the first residual memory of each physical NUMA node in the host and the memory specification of the virtual machine, and memory allocation can be carried out for the virtual machine from proper NUMA node memory according to the strategy. In this way, the virtual machine can obtain sufficient and appropriate memory resources, thereby improving its performance.
In one embodiment, after determining the target allocation policy according to the first remaining memory and the memory specification, the method further includes:
determining a plurality of target physical non-uniform memory access nodes and memories to be allocated corresponding to each target physical non-uniform memory access node according to a target allocation strategy;
creating a plurality of virtual non-uniform memory access nodes, wherein the virtual non-uniform memory access nodes are in one-to-one correspondence with the physical non-uniform memory access nodes, and the memory configuration information of the virtual non-uniform memory access nodes is the same as the memory to be allocated of the target physical non-uniform memory access nodes corresponding to the virtual non-uniform memory access nodes;
when the virtual machine is started, binding the virtual non-uniform memory access node with a target physical non-uniform memory access node corresponding to the virtual non-uniform memory access node.
In this embodiment, after the target allocation policy is determined based on the first remaining memory and the memory specification. Firstly, determining a plurality of target physical NUMA nodes and memories to be allocated corresponding to each target physical NUMA node according to a target allocation strategy. The target physical NUMA nodes are physical nodes in the host, and some target nodes are selected for memory allocation by analyzing the first remaining memory and the memory specification. Next, a plurality of virtual NUMA nodes are created. The virtual NUMA nodes are in one-to-one correspondence with the physical NUMA nodes, i.e., each virtual NUMA node corresponds to a target physical NUMA node. And the memory configuration information of the virtual NUMA node is the same as the memory to be allocated of the corresponding target physical NUMA node. And finally, when the virtual machine is started, binding the virtual NUMA node with the corresponding target physical NUMA node. Thus, the virtual machine can run on the corresponding target physical NUMA node and can enjoy the memory to be allocated of the node.
By the method, the node allocation method for determining the target allocation strategy according to the first residual memory and the memory specification and binding the virtual NUMA node with the target physical NUMA node is realized.
In one embodiment, the target allocation policy satisfies a preset condition, where the preset condition is:
after memory is allocated to the virtual machine from the first residual memory of each physical non-uniform memory access node according to the target allocation policy, the difference value of the second residual memory of each two physical non-uniform memory access nodes is within a preset range.
The present embodiment further describes a preset condition of the target allocation policy. The allocation mode selected by the target allocation policy must satisfy a preset condition, that is, after allocating memory for the virtual machine, the difference between the second remaining memories of each two physical NUMA nodes must be within a preset range.
NUMA nodes are a non-uniform memory access structure that divide computing resources and memory into multiple nodes, each with its own local memory. The nodes may communicate via an interconnection network. The above embodiments refer to a first remaining memory of each physical NUMA node in the host. The first remaining memory refers to the remaining memory that is still available on each physical NUMA node before memory is allocated for the virtual machine.
In this embodiment, the target allocation policy should be able to ensure that the difference between the second remaining memories of each two physical NUMA nodes does not exceed the preset range after allocating the memory for the virtual machine. The second remaining memory refers to the remaining memory that is still available on each physical NUMA node after the memory is allocated for the virtual machine.
The purpose of this preset condition is to keep the load balance of each physical NUMA node, and avoid over-allocation of memory on some nodes, resulting in load imbalance between nodes. By limiting the difference between the second remaining memories to be within a reasonable range, the relative balance of memory usage between the nodes can be ensured, thereby improving the performance and efficiency of the system.
In summary, this embodiment defines that when the target allocation policy allocates memory for the virtual machine, the first remaining memory and the memory specification of each physical NUMA node need to be considered, and ensures that the difference between the second remaining memories of every two physical NUMA nodes is within a preset range, so as to achieve load balancing and optimization of system performance.
In one embodiment, the target allocation policy is determined in the following manner:
presetting a plurality of distribution strategies to be determined;
calculating a second residual memory of each physical non-uniform memory access node after memory is allocated to the virtual machine according to each allocation strategy to be determined;
And determining the allocation strategy to be determined, which satisfies the preset condition, of the second residual memory of each physical non-uniform memory access node after the memory is allocated for the virtual machine as a target allocation strategy.
The present embodiment describes a method of determining a target allocation policy in an embodiment. Firstly, a plurality of allocation strategies to be determined are preset in the method. And then, after memory is allocated to the virtual machine according to each allocation strategy to be determined, calculating the second residual memory of each physical NUMA node. Next, the allocation policy to be determined that satisfies the preset condition is determined as the target allocation policy.
Specifically, the determination of the target allocation policy is divided into the following steps: firstly, after memory is allocated to the virtual machine according to each allocation strategy to be determined, calculating second residual memory of each physical NUMA node. Then, checking whether the calculated second residual memory meets the preset condition, namely, the difference value of the second residual memory of every two physical NUMA nodes is within the preset range. And if the calculation result of a certain allocation strategy to be determined meets the preset condition, determining the allocation strategy to be determined as a target allocation strategy.
The method can ensure that the second residual memory condition caused by each allocation strategy to be determined is considered when the target allocation strategy is selected, and the allocation strategy which is most in accordance with the preset condition is selected as the target allocation strategy. This helps to optimize memory allocation and improve system performance and resource utilization.
In one embodiment, after calculating the second remaining memory of each physical non-uniform memory access node after allocating memory for the virtual machine according to each allocation policy to be determined, the method further includes:
calculating the dispersion of the second residual memory of each physical non-uniform memory access node according to the second residual memory of each physical non-uniform memory access node;
determining an allocation policy to be determined that a second remaining memory of each physical non-uniform memory access node satisfies a preset condition after allocating memory for the virtual machine as a target allocation policy, including:
and determining the allocation strategy to be determined, which is within a dispersion threshold range, of the second residual memory of each physical non-uniform memory access node after the memory is allocated for the virtual machine as a target allocation strategy.
The embodiment describes a calculation method for determining a dispersion of a second remaining memory of each physical NUMA node after memory allocation by a virtual machine, and selecting a target allocation policy according to a threshold range of the dispersion. Firstly, after memory is allocated to the virtual machine according to each allocation strategy to be determined, calculating second residual memory of each physical NUMA node. The second remaining memory refers to the remaining available memory of the physical NUMA node after the memory has been allocated for the virtual machine. And secondly, calculating the memory values according to the calculated second residual memories of the physical NUMA nodes to determine the dispersion of the second residual memories of the physical NUMA nodes. The dispersion refers to the degree of difference between memory values, and can be measured by calculating standard deviation or average absolute deviation. And finally, selecting the allocation strategy to be determined which meets the range of the dispersion threshold as a target allocation strategy. The dispersion threshold is a range set under preset conditions and is used for screening out distribution strategies with dispersion within a reasonable range.
By the calculation method, the allocation strategy to be determined with the dispersion within a reasonable range can be selected as a target allocation strategy, so that the efficiency and performance of memory allocation are improved, the memory allocation is optimized, and the performance and resource utilization efficiency of the system are improved.
In one embodiment, determining, as the target allocation policy, an allocation policy to be determined that a dispersion of a second remaining memory of each of the physically non-coherent memory access nodes after allocating memory for the virtual machine is within a dispersion threshold range includes:
and determining the allocation strategy to be determined with minimum dispersion of the second residual memory of each physical non-uniform memory access node after the memory is allocated for the virtual machine as a target allocation strategy.
In this embodiment, the target allocation policy is determined according to the dispersion of the second remaining memory of each physical NUMA node. In the node allocation method, firstly, memory is allocated to a virtual machine according to a plurality of preset allocation strategies to be determined, and then the dispersion of second residual memory of each physical NUMA node is calculated. The dispersion is an index for measuring the uniformity of memory allocation among the nodes, and the smaller the dispersion is, the more uniform the memory allocation is. Then, according to the set dispersion threshold value range, selecting the distribution strategy to be determined with the dispersion within the range as a target distribution strategy. Specifically, this approach would select the allocation policy to be determined with the smallest dispersion as the target allocation policy, since the smallest dispersion indicates the most uniform memory allocation.
By adopting the target allocation strategy, the second residual memory of each physical NUMA node can be kept uniformly distributed after the memory is allocated by the virtual machine. Therefore, the system performance and the resource utilization efficiency can be improved, and the memory allocation of the virtual machine can be ensured to meet the preset conditions.
In one embodiment, calculating the dispersion of the second remaining memory of each physically non-coherent memory access node from the second remaining memory of each physically non-coherent memory access node comprises:
calculating the variance of the second residual memory of each physical non-uniform memory access node according to the second residual memory of each physical non-uniform memory access node;
determining an allocation policy to be determined, which is to be determined and has a dispersion of a second remaining memory of each physical non-uniform memory access node within a dispersion threshold range after allocating memory for the virtual machine, as a target allocation policy, including:
and determining the allocation strategy to be determined, of which the variance of the second residual memory of each physical non-uniform memory access node is within a variance threshold range after the memory is allocated for the virtual machine, as a target allocation strategy.
In this embodiment, the method of calculating the dispersion is to first calculate the variance of the second remaining memory of each physical NUMA node. Variance is a measure of dispersion that is used to measure how far data deviates from its mean. The allocation policy to be determined then needs to satisfy a variance threshold range, i.e. the variance is within a certain preset range. If the variance of the second remaining memory of each physical NUMA node after allocation of the virtual machine that results from one allocation policy to be determined is within a variance threshold, then the allocation policy is determined to be a target allocation policy.
It can be seen that this embodiment describes the step of evaluating and selecting allocation policies by calculating variances. This can help ensure a relatively even and reasonable distribution among the various physical NUMA nodes that exist within the virtual machine that are allocated to optimize the performance and resource utilization efficiency of the virtual machine.
In one embodiment, determining an allocation policy to be determined, in which a variance of a second remaining memory of each of the physically non-coherent memory access nodes after allocating memory for the virtual machine is within a variance threshold, as the target allocation policy includes:
and determining the allocation strategy to be determined with the minimum variance of the second residual memory of each physical non-uniform memory access node after the memory is allocated for the virtual machine as a target allocation strategy.
In this embodiment, after memory is allocated to the virtual machine, the variance of the second remaining memory of each physical NUMA node is calculated, and the allocation policy to be determined with the smallest variance is selected as the target allocation policy. The purpose of this approach is to minimize the difference in the second remaining memory of each physical NUMA node as much as possible to achieve balance and optimization of memory allocation.
Firstly, calculating the variance of the second residual memory of each physical NUMA node after memory is allocated for the virtual machine according to each allocation strategy to be determined. Variance is a statistical indicator that describes the degree of dispersion of the data distribution and measures the degree of dispersion of the data set trend. Here, the second remaining memory of each physical NUMA node is used as the dataset, and its variance is calculated. The smaller the variance, the closer the second remaining memory distribution representing each physical NUMA node, the smaller the variance. And then, comparing the variance of each allocation strategy to be determined, and selecting the allocation strategy to be determined with the smallest variance as a target allocation strategy. This means that after this allocation policy is selected, the difference between the second remaining memory of each physical NUMA node is minimal, thus achieving balance and optimization of memory allocation.
In summary, this embodiment describes a method for selecting, as a target allocation policy, an allocation policy to be determined that minimizes the variance of the second remaining memory of each physical NUMA node, by using the variance as a measure. The method can realize more balanced and optimized memory allocation and improve the system performance and the resource utilization rate.
In one embodiment, after obtaining the memory specification of the virtual machine and the remaining memory of each physical non-uniform memory access node in the host, the method further includes:
and eliminating the physical non-uniform memory access nodes which do not meet the preset requirements.
In this embodiment, the memory specification of the virtual machine refers to the memory capacity required by the virtual machine. Physical NUMA nodes refer to non-coherent memory access nodes in a computer that each have their own memory and processor. The remaining memory refers to the available memory on each physical NUMA node that has not been allocated to other virtual machines.
In such an embodiment, it is further desirable to cull physical NUMA nodes that do not meet the preset requirements. This means that before allocating memory, each NUMA node needs to be checked for memory condition, and if the memory capacity of a certain node does not meet the preset requirement, it is rejected and not incorporated into the memory allocation process. The preset requirements may be system or user defined criteria such as minimum memory requirements or memory capacity specifications.
By performing these steps, a more efficient memory allocation can be achieved, with appropriate memory allocated according to the virtual machine's memory specification and the remaining memory of each NUMA node. Eliminating physical NUMA nodes that do not meet the preset requirements can ensure that the system does not use nodes that do not meet the requirements for memory allocation, thereby avoiding possible performance problems or resource waste.
In one embodiment, rejecting a physical non-coherent memory access node that does not meet a preset requirement includes:
and eliminating the physical non-uniform memory access nodes of which the first residual memory is smaller than a preset memory threshold value.
In such an embodiment, in addition to obtaining the memory specification of the virtual machine and the remaining memory of each physical NUMA node in the host, the method further includes rejecting physical NUMA nodes that do not meet the preset requirements. Specifically, once the remaining memory of each physical NUMA node in the host is obtained, a memory threshold is set for determining whether the remaining memory of the physical NUMA node meets a preset requirement. The preset memory threshold may be set according to the system requirements. For each physical NUMA node, it is checked whether its remaining memory is less than a preset memory threshold. For those physical NUMA nodes whose remaining memory is less than the preset memory threshold, they are excluded from the memory allocation process. Thus, these undesirable physical NUMA nodes will not be considered in subsequent memory allocations.
By eliminating physical NUMA nodes that do not meet the preset requirements, it can be ensured that only those physical NUMA nodes that have remaining memory that meet the requirements are used for memory allocation. In this way, performance and efficiency of the system can be improved while avoiding performance problems caused by the allocation of virtual machines to insufficient physical NUMA nodes.
In one embodiment, rejecting a physical non-coherent memory access node that does not meet a preset requirement includes:
and eliminating the physical non-uniform memory access nodes which are not connected with the host and correspond to the memory bars.
NUMA nodes are an asymmetric multiprocessor system architecture that allows a host to have multiple physical regions, with a set of processors and a block of memory in each region. In this embodiment, after the memory specification of the virtual machine and the remaining memory of each physical NUMA node in the host are obtained, the physical NUMA nodes that do not meet the preset requirement need to be removed.
Specifically, physical NUMA nodes that do not correspond to memory banks connected to the host are eliminated. This means that if there are some memory banks on the host that are not properly connected to the physical NUMA nodes, the physical NUMA nodes where these incorrectly connected memory banks are located will be rejected, possibly due to hardware problems or other reasons. The purpose of such a culling operation is to ensure that the memory allocation of the virtual machine can be performed in a reliable and stable environment. And the physical NUMA nodes where the incorrectly connected memory stripes are located are eliminated, so that memory access abnormality or other problems of the virtual machine in the running process can be avoided.
In one embodiment, rejecting a physical non-coherent memory access node that does not meet a preset requirement includes:
and eliminating the physical non-uniform memory access node with abnormal running state.
The embodiment describes an operation of eliminating physical NUMA nodes that do not meet preset requirements in a node allocation method. These physical NUMA nodes may have an operating state anomaly in that they may not function properly or meet preset criteria.
In a virtualized environment, a host typically contains multiple physical NUMA nodes, and the memory allocation of a virtual machine requires consideration of the host's NUMA topology and the available memory of the nodes. If the operating state of a physical NUMA node is abnormal, it may not provide reliable memory services, which may lead to performance degradation or other problems for the virtual machine.
Therefore, in this embodiment, after the memory specification of the virtual machine and the remaining memory of each physical NUMA node in the host are obtained, the physical NUMA nodes need to be screened. For those physical NUMA nodes with abnormal running states, the nodes are rejected and do not participate in the memory allocation process.
Therefore, by eliminating the physical NUMA nodes with abnormal running states, the memory allocation can be ensured to be carried out only for the nodes which are in the normal working state and meet the preset requirements, so that the performance and the stability of the whole virtualization environment are improved.
In one embodiment, after rejecting the physically non-uniform memory access nodes that do not meet the preset requirement, the method further includes:
if the number of the physical non-uniform memory access nodes after eliminating the physical non-uniform memory access nodes which do not meet the preset requirements is smaller than the preset number, outputting prompt information, and after receiving an allocation instruction, allocating memory for the virtual machine by using the first residual memory of the physical non-uniform memory access nodes after eliminating the physical non-uniform memory access nodes which do not meet the preset requirements.
The embodiment refers to a further processing step in the case of rejecting physical NUMA nodes that do not meet the preset requirement. Specifically, if the number of physical NUMA nodes after eliminating the physical NUMA nodes which do not meet the preset requirements is smaller than the preset number, the system outputs prompt information, and after receiving an allocation instruction, the first residual memory of the physical NUMA nodes after eliminating the physical NUMA nodes which do not meet the preset requirements is used for performing memory allocation for the virtual machine.
In this case, the system first determines whether the number of physical NUMA nodes after eliminating the physical NUMA nodes that do not meet the preset requirement is less than the preset number. If so, the system will output a prompt prompting the user that the number of physical NUMA nodes may be insufficient to meet the allocation requirements.
Then, after receiving an allocation instruction sent by a worker (i.e. after the worker confirms), the system can select and reject the first block of residual memory in the physical NUMA nodes after the physical NUMA nodes which do not meet the preset requirement to allocate the memory for the virtual machine, so that the risk that the number of the physical NUMA nodes may not be enough to meet the allocation requirement and the memory is forcibly allocated is avoided.
In one embodiment, after allocating memory for the virtual machine according to each of the first remaining memory and the memory specification, the method further includes:
outputting an allocation log, wherein the allocation log at least comprises the time for allocating the memory and the allocation condition of the first residual memory of each physical non-uniform memory access node.
In this embodiment, after memory is allocated for the virtual machine, an allocation log is further required to be output, where the log includes at least the following contents: the time of memory allocation and the allocation of the first remaining memory of each physical NUMA node. This means that after the virtual machine is created and memory is allocated, details of the memory allocation are recorded. The log includes the time of memory allocation and the specific allocation of the first remaining memory for each physical NUMA node. The time at which memory is allocated refers to the exact point in time at which the memory allocation operation occurs, which is important for tracking and auditing the memory allocation process. Second, the log also records the allocation of the first remaining memory of each physical NUMA node. When the memory is allocated, the first residual memory condition of each physical NUMA node is considered, so that load balancing and performance optimization can be better performed.
By outputting these detailed allocation logs, an administrator, developer, or other relevant personnel can view and analyze the status of memory allocation and its distribution as needed. This is very useful for troubleshooting, performance optimization, and resource management. By knowing the allocation of the first remaining memory of each physical NUMA node, the resource utilization of the system can be better understood, and a decision can be made as to whether further optimization or adjustment is needed.
In one embodiment, a plurality of allocation policies to be determined are preset, including:
determining the number of physical non-uniform memory access nodes on a host;
and determining a plurality of allocation strategies to be determined according to the number of the physical non-uniform memory access nodes.
The embodiment provides a method for presetting a plurality of distribution strategies to be determined, which is used for determining the number of physical NUMA nodes on a host and the corresponding distribution strategies to be determined. First, the number of physical NUMA nodes on the host needs to be determined. A physical NUMA node may be understood as a set of processor and memory resources interconnected in a host. The number of physical NUMA nodes on the host can be determined by the relevant information of the system. Based on the number of physical NUMA nodes on the host, a plurality of allocation policies to be determined are preset. The allocation policy to be determined may include different algorithms or rules for deciding how the virtual machine allocates memory on a particular physical NUMA node. These allocation policies to be determined may be designed for different application scenarios or optimization objectives, such as improving virtual machine performance, reducing memory access latency, etc. By presetting a plurality of allocation strategies to be determined, flexible selection can be provided for different situations. Finally, according to the number of the physical NUMA nodes and the allocation strategy to be determined, the second residual memory of each physical NUMA node after the virtual machine allocates the memory under each allocation strategy to be determined can be obtained according to a certain calculation method. According to the calculation results, the allocation strategy to be determined meeting the preset conditions can be selected as a target allocation strategy for allocating the memory for the virtual machine.
In summary, the present embodiment provides a method for determining the number of physical NUMA nodes and allocation policies to be determined, and a method for selecting, by calculation, a target allocation policy that satisfies a preset condition. The method can flexibly select proper strategies according to specific scenes and requirements so as to improve the performance of the virtual machine and optimize the memory allocation.
In one embodiment, determining a number of allocation policies to be determined according to a number of physically non-coherent memory access nodes includes:
selecting partial physical non-uniform memory access nodes from the physical non-uniform memory access nodes respectively as target physical non-uniform memory access nodes, and allocating memory for the virtual machine by using first residual memory of the target physical non-uniform memory access nodes;
and each time the target physical non-uniform memory access node is selected, one allocation strategy to be determined corresponds to the target physical non-uniform memory access node.
In one embodiment, the step of determining a plurality of allocation policies to be determined according to the number of physical NUMA nodes specifically includes: first, determining the number of physical NUMA nodes on a host: first, the number of physical NUMA nodes on the host needs to be determined, which can be obtained by way of system information or configuration files, etc. Secondly, determining a plurality of allocation strategies to be determined according to the number of the physical NUMA nodes: and determining a plurality of allocation strategies to be determined according to the determined number of the physical NUMA nodes. Each allocation policy to be determined corresponds to a subset of target physical NUMA nodes. Thirdly, selecting part of physical NUMA nodes from the physical NUMA nodes as target physical NUMA nodes respectively: and selecting part of physical NUMA nodes from the physical NUMA nodes as target physical NUMA nodes according to the allocation strategy to be determined. The target physical NUMA node is selected according to a preset selection strategy, possibly according to factors such as performance, load balancing and the like. Fourth, allocating memory for the virtual machine using the first remaining memory of the target physical NUMA node: for each selected target physical NUMA node, memory is allocated for the virtual machine using the first remaining memory of the physical NUMA node. The first remaining memory refers to the memory that the physical NUMA node remains after being allocated to other virtual machines (specifically, the current remaining memory).
It is to be appreciated that each time a target physical NUMA node is selected from the physical NUMA nodes, a corresponding allocation policy is to be determined. That is, in the process of determining a plurality of allocation policies to be determined according to the number of physical NUMA nodes, each allocation policy to be determined is determined in a one-to-one correspondence with each selected target physical NUMA node.
Through the steps, in the process of determining a plurality of allocation strategies to be determined according to the number of the physical NUMA nodes, different target physical NUMA nodes can be selected aiming at different physical NUMA nodes so as to realize more flexible and personalized memory allocation strategies.
In one embodiment, the number of physically non-coherent memory access nodes is 2 N And selecting part of the physical non-uniform memory access nodes from the physical non-uniform memory access nodes as target physical non-uniform memory access nodes, and allocating memory for the virtual machine by using the first residual memory of the target physical non-uniform memory access nodes, wherein the method comprises the following steps:
respectively from 2 N The physical non-uniform memory access nodes are respectively selected from 2 0 、2 1 Up to 2 m The target physical non-uniform memory access nodes are selected, N is more than or equal to m is more than or equal to 2, and N and m are integers;
According to the selection of 2 0 、2 1 Up to 2 m The first remaining memory of each target physical non-uniform memory access node allocates memory for the virtual machine.
In this embodiment, a method for determining a target allocation policy according to the number of physical NUMA nodes is provided. Because the number of the physical NUMA nodes is usually 2 to the power N, the memory distribution situation of the virtual machine is divided into n+1 types, namely the memory of the virtual machine is evenly distributed in the host machine 2 0 、2 1 …2 N And on the physical NUMA nodes, N+1 distribution conditions are totally adopted.
First, from 2 N A selection is made among the physical NUMA nodes. The number of choices is 2 0 、2 1 Up to 2 m And the target physical NUMA nodes. Here, N is a value equal to or greater than m. And then, distributing memory for the virtual machine according to the first residual memory of the selected target physical NUMA node. The target physical NUMA node refers to a node that is selected as the target allocated memory among the selected physical NUMA nodes.
First kindThe memory distribution is that the virtual machine memory is distributed in 1 (i.e. 2 0 ) On physical NUMA nodes, in this case co-locatedIn the allocation mode, vm (the memory specification of the virtual machine) occupies only 1 physical NUMA node memory.
The second is that the virtual machine memory is allocated in 2 (i.e. 2 1 ) On physical NUMA nodes, in this case in commonAnd the memory of two physical NUMA nodes is occupied at the moment in a distribution mode, and the size is vm/2.
And so on until the memory allocation of the virtual machine is 2 N On a single physical NUMA node, in this case in commonI.e. 1 allocation mode, at this time, the memory of all physical NUMA nodes is occupied, and the size is vm/2 N
In summary, this embodiment describes a method for allocating memory for a virtual machine according to the first remaining memory of a physical NUMA node selected by a target when the number of physical NUMA nodes is 2 to the power N. The method aims at optimizing the distribution of the memory according to the particularity of the number of the physical NUMA nodes so as to meet the requirements of the virtual machine.
In one embodiment, allocating memory for a virtual machine using a first remaining memory of a target physical NUMA node includes:
and allocating memory for the virtual machine by using the first residual memory average of the target physical NUMA node.
The embodiment relates to a method for allocating memory for a virtual machine according to a first residual memory of a target physical NUMA node, wherein the memory is allocated in an average allocation mode. The target physical NUMA nodes are selected from the physical NUMA nodes after determining the target allocation policy. And the first remaining memory refers to the remaining memory in the physical NUMA node that is not allocated to other virtual machines.
In this embodiment, a target allocation policy has been determined and a target physical NUMA node has been selected. Thus, when allocating memory for a virtual machine, the virtual machine is allocated on average using the first remaining memory of the target physical NUMA node. This means that the memory of the virtual machine is evenly distributed over the selected target physical NUMA nodes to achieve balanced allocation of memory. By means of average allocation, the first residual memory of each target physical NUMA node can be fully utilized, and the situation that the residual memory of one node is excessive and the residual memory of other nodes is insufficient is avoided. By means of average distribution, the overall memory utilization rate can be improved, and the performance and efficiency of the system are improved.
For example: in one embodiment, the virtual machine memory size is 8G, and the host has 4 physical NUMA nodes, i.e., 2 2 If 32G memory remains for each node, there are a total of 3 allocation cases. In the first allocation case, virtual machines are only bound to 1 physical NUMA node and then shareAnd each allocation mode is that 8G memories of the virtual machines are all allocated to a certain physical NUMA node. In the second allocation case, the virtual machine binds two physical NUMA nodes, brings a formula, and has 6 allocation modes altogether, at this time, the virtual machine is divided into two virtual NUMA nodes, and each virtual NUMA node 4G memory is respectively bound on the two physical NUMA nodes of the host. In the third allocation situation, the virtual machine binds four physical NUMA nodes, and only one allocation mode is that the virtual machine is divided into four virtual NUMA nodes, and each virtual NUMA node 2G memory is respectively bound on the four physical NUMA nodes of the host.
Through the traversal of the steps, under each allocation mode, calculating the dispersion of the residual memory values of all physical NUMA nodes of the host after the virtual machine is started, finding out the mode with the lowest variance value, and finally obtaining the optimal allocation mode of the virtual machine on all physical NUMA nodes of the host.
Specifically, the formula for calculating the variance of the physical NUMA nodes to quantify the dispersion of the nodes is:wherein final represents the output result, +.>First remaining memory for the ith node, < >>Representing all allocation modes included in the traversal of the steps (j represents a j-th allocation mode (corresponding to a j-th allocation strategy to be determined), Z is a positive integer, and h is an integer in 0-N); />Representing the average value of the remaining second remaining memory after the virtual machine occupies the physical NUMA node memory; />Representing the memory that the virtual machine should occupy at the ith physical NUMA node on the host in the jth allocation.
For example: in the situation that each node of the host remains 32G of memory and 3 distribution conditions exist, 11 distribution modes are used, the virtual machine is divided into four virtual NUMA nodes, when each virtual NUMA node is respectively bound with each physical NUMA node 2G of the host, the variance result is minimum, the time value is 0, each node of the host remains 30G of memory after the virtual machine is started, and the virtual machine is in a state with very stable performance.
In summary, in the node allocation method provided in this embodiment, when a virtual machine is created, a memory specification of the virtual machine and a first remaining memory of each physical NUMA node in a host are obtained; and distributing memory for the virtual machine according to the first residual memory and the memory specification. Therefore, the node allocation method considers the residual memory condition of each node and allocates the memory for the virtual machine, so that the performance of the virtual machine is improved; by considering the first residual memory and the memory specification of each physical NUMA node to allocate the memory, the resources of the host can be utilized more reasonably and uniformly, and the situation that the traditional virtualization platform only pays attention to the total resource allowance and possibly allocates the memory on certain nodes, so that the memory resources of other nodes are wasted is avoided, so that the resource utilization rate of the host is improved, and the resource waste is avoided.
In order to solve the above technical problem, the present application further provides a node allocation system, as shown in fig. 2, including:
an obtaining unit 21, configured to obtain, when the virtual machine is created, a memory specification of the virtual machine and a first remaining memory of each physical non-uniform memory access node in the host;
the allocation unit 22 is configured to allocate memory for the virtual machine according to each of the first remaining memory and the memory specification.
In one embodiment, the dispensing unit 22 includes:
the strategy determining unit is used for determining a target allocation strategy according to the first residual memory and the memory specification;
and the memory allocation unit is used for allocating memory for the virtual machine from the first residual memory of each physical non-uniform memory access node according to the target allocation strategy.
In one embodiment, further comprising:
the target node determining unit is used for determining a plurality of target physical non-uniform memory access nodes and memories to be allocated corresponding to each target physical non-uniform memory access node according to a target allocation strategy;
the virtual node creating unit is used for creating a plurality of virtual non-uniform memory access nodes, the virtual non-uniform memory access nodes are in one-to-one correspondence with the physical non-uniform memory access nodes, and the memory configuration information of the virtual non-uniform memory access nodes is the same as the memory to be allocated of the target physical non-uniform memory access nodes corresponding to the virtual non-uniform memory access nodes;
and the binding unit is used for binding the virtual non-uniform memory access node with the target physical non-uniform memory access node corresponding to the virtual non-uniform memory access node when the virtual machine is started.
In one embodiment, the target allocation policy satisfies a preset condition, where the preset condition is:
After memory is allocated to the virtual machine from the first residual memory of each physical non-uniform memory access node according to the target allocation policy, the difference value of the second residual memory of each two physical non-uniform memory access nodes is within a preset range.
In one embodiment, further comprising:
the strategy setting unit is used for presetting a plurality of distribution strategies to be determined;
the computing unit is used for computing a second residual memory of each physical non-uniform memory access node after the memory is allocated to the virtual machine according to each allocation strategy to be determined;
the policy determining unit is specifically configured to determine, as a target allocation policy, an allocation policy to be determined that a second remaining memory of each physical non-uniform memory access node after allocating memory for the virtual machine meets a preset condition.
In one embodiment, the non-coherent memory access further comprises:
a dispersion calculating unit, configured to calculate a dispersion of the second remaining memory of each physical non-uniform memory access node according to the second remaining memory of each physical non-uniform memory access node;
the policy determining unit is specifically configured to determine, as a target allocation policy, an allocation policy to be determined, where the allocation policy to be determined is within a range of a dispersion threshold, of a second remaining memory of each of the physical non-coherent memory access nodes after the memory is allocated to the virtual machine.
In one embodiment, the policy determining unit is specifically configured to determine, as the target allocation policy, an allocation policy to be determined that has a minimum dispersion of the second remaining memory of each of the physical non-coherent memory access nodes after the memory is allocated for the virtual machine.
In one embodiment, the dispersion calculating unit is specifically configured to calculate the variance of the second remaining memory of each physical non-uniform memory access node according to the second remaining memory of each physical non-uniform memory access node;
the policy determining unit is specifically configured to determine, as a target allocation policy, an allocation policy to be determined, where the variance of the second remaining memory of each physical non-coherent memory access node is within a variance threshold range after the non-coherent memory access allocates memory for the virtual machine.
In one embodiment, the policy determining unit is specifically configured to determine, as the target allocation policy, an allocation policy to be determined that a variance of a second remaining memory of each of the physically non-coherent memory access nodes is minimum after the non-coherent memory access allocates memory for the virtual machine.
In one embodiment, the non-coherent memory access further comprises:
And the rejecting unit is used for rejecting the physical non-uniform memory access nodes which do not meet the preset requirements.
In one embodiment, the rejection unit is specifically configured to reject the physical non-coherent memory access node having a remaining memory smaller than a preset memory threshold.
In one embodiment, the rejection unit is specifically configured to reject, in a non-coherent memory access, a physical non-coherent memory access node corresponding to a memory stripe that is not connected to the host.
In one embodiment, the rejection unit is specifically configured to reject the physical non-coherent memory access node with abnormal running state from the non-coherent memory access.
In one embodiment, the non-coherent memory access further comprises:
the request unit is used for outputting prompt information when the number of the physical non-uniform memory access nodes after eliminating the physical non-uniform memory access nodes which do not meet the preset requirement is smaller than the preset number, and after receiving the allocation instruction, allocating memory for the virtual machine by using the first residual memory of the physical non-uniform memory access nodes after eliminating the physical non-uniform memory access nodes which do not meet the preset requirement.
In one embodiment, further comprising:
The log unit is used for outputting an allocation log after the memory is allocated to the virtual machine according to the first residual memory and the memory specification, and the allocation log at least comprises the time for allocating the memory and the allocation condition of the first residual memory of each physical non-uniform memory access node.
In one embodiment, a policy setting unit includes:
the node number determining unit is used for determining the number of the physical non-uniform memory access nodes on the host;
and the allocation policy to be determined determining unit is used for determining a plurality of allocation policies to be determined according to the number of the physical non-uniform memory access nodes.
In one embodiment, the to-be-determined allocation policy determining unit is specifically configured to select a part of physical non-uniform memory access nodes from the physical non-uniform memory access nodes as target physical non-uniform memory access nodes, and allocate memory for the virtual machine by using a first remaining memory of the target physical non-uniform memory access nodes; and each time the target physical non-uniform memory access node is selected, one allocation strategy to be determined corresponds to the target physical non-uniform memory access node.
In one embodiment, the allocation policy determining unit to be determined is specifically configured to determine that the non-coherent memory accesses are respectively from 2 N The physical non-uniform memory access nodes are respectively selected from 2 0 、2 1 Up to 2 m The target physical non-uniform memory access nodes are selected, N is more than or equal to m is more than or equal to 2, and N and m are integers; according to the selection of 2 0 、2 1 Up to 2 m The first remaining memory of each target physical non-uniform memory access node allocates memory for the virtual machine.
In one embodiment, the allocation policy determining unit to be determined is specifically configured to select a portion of the physical non-uniform memory access nodes from the physical non-uniform memory access nodes as target physical non-uniform memory access nodes, and the non-uniform memory access uses a first remaining memory average of the target physical non-uniform memory access nodes to allocate memory for the virtual machine.
For the description of the node allocation system, refer to the above embodiments, and the description is omitted herein.
In order to solve the above technical problem, the present application further provides a node allocation device, as shown in fig. 3, including:
a memory 31 for storing a computer program 41;
the processor 32 is configured to implement the steps of the node allocation method described above when storing the computer program 41.
For the description of the node allocation apparatus, refer to the above embodiments, and the description is omitted herein.
To solve the above technical problem, the present application further provides a computer readable storage medium 40, as shown in fig. 4, where a computer program 41 is stored on the computer readable storage medium 40, and the computer program 41 implements the steps of the node allocation method described above when executed by the processor 32. For the description of the computer-readable storage medium 40, reference is made to the above embodiments, and the description thereof is omitted herein.
It should also be noted that in this specification, relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (18)

1. A method of node allocation, comprising:
when a virtual machine is created, acquiring the memory specification of the virtual machine and the first residual memory of each physical non-uniform memory access node in a host;
distributing memory for the virtual machine according to each of the first residual memory and the memory specification;
allocating memory for the virtual machine according to each of the first remaining memory and the memory specification, including:
determining a target allocation strategy according to the first residual memory and the memory specification;
distributing memory for the virtual machine from the first residual memory of each physical non-uniform memory access node according to the target distribution strategy;
The target allocation strategy meets preset conditions, wherein the preset conditions are as follows:
after memory is allocated to the virtual machine from the first residual memories of each physical non-uniform memory access node according to the target allocation policy, the difference value of the second residual memories of each two physical non-uniform memory access nodes is within a preset range;
the determination mode of the target allocation strategy is as follows:
presetting a plurality of distribution strategies to be determined;
calculating a second residual memory of each physical non-uniform memory access node after memory is allocated to the virtual machine according to each allocation policy to be determined;
determining an allocation policy to be determined, which satisfies the preset condition, of the second remaining memory of each of the physical non-uniform memory access nodes after the memory is allocated to the virtual machine as the target allocation policy;
after calculating the second remaining memory of each of the physical non-uniform memory access nodes after allocating memory for the virtual machine according to each allocation policy to be determined, the method further includes:
calculating the dispersion of the second residual memory of each physical non-uniform memory access node according to the second residual memory of each physical non-uniform memory access node;
Determining an allocation policy to be determined, which satisfies the preset condition, of the second remaining memory of each of the physical non-uniform memory access nodes after the memory is allocated to the virtual machine as the target allocation policy, including:
and determining an allocation strategy to be determined, of which the dispersion of the second residual memory of each physical non-uniform memory access node is within a dispersion threshold range after the memory is allocated for the virtual machine, as the target allocation strategy.
2. The node allocation method of claim 1, further comprising, after determining a target allocation policy based on the first remaining memory and the memory specification:
determining a plurality of target physical non-uniform memory access nodes and memories to be allocated corresponding to each target physical non-uniform memory access node according to the target allocation policy;
creating a plurality of virtual non-uniform memory access nodes, wherein the virtual non-uniform memory access nodes are in one-to-one correspondence with the physical non-uniform memory access nodes, and the memory configuration information of the virtual non-uniform memory access nodes is the same as the memory to be allocated of the target physical non-uniform memory access nodes corresponding to the virtual non-uniform memory access nodes;
And when the virtual machine is started, binding the virtual non-uniform memory access node with a target physical non-uniform memory access node corresponding to the virtual non-uniform memory access node.
3. The node allocation method according to claim 1, wherein determining, as the target allocation policy, an allocation policy to be determined that a dispersion of a second remaining memory of each of the physically non-coherent memory access nodes after allocation of memory for the virtual machine is within a dispersion threshold range includes:
and determining an allocation policy to be determined, which is to be determined and has minimum dispersion of the second residual memory of each physical non-uniform memory access node after the memory is allocated for the virtual machine, as the target allocation policy.
4. The node allocation method of claim 1, wherein calculating a dispersion of the second remaining memory of each of the physically non-coherent memory access nodes from the second remaining memory of each of the physically non-coherent memory access nodes comprises:
calculating the variance of the second residual memory of each physical non-uniform memory access node according to the second residual memory of each physical non-uniform memory access node;
determining an allocation policy to be determined, which is within a dispersion threshold range, of second remaining memory of each of the physical non-uniform memory access nodes after memory allocation for the virtual machine as the target allocation policy, including:
And determining an allocation strategy to be determined, wherein the allocation strategy to be determined is used for determining that the variance of the second residual memory of each physical non-uniform memory access node is within a variance threshold range after the memory is allocated for the virtual machine, as the target allocation strategy.
5. The node allocation method according to claim 4, wherein determining, as the target allocation policy, an allocation policy to be determined that a variance of a second remaining memory of each of the physically non-coherent memory access nodes after allocation of memory for the virtual machine is within a variance threshold range includes:
and determining an allocation policy to be determined, which is the smallest in variance of the second residual memory of each of the physical non-uniform memory access nodes after the memory is allocated to the virtual machine, as the target allocation policy.
6. The node allocation method according to claim 1, further comprising, after obtaining the memory specification of the virtual machine and the first remaining memory of each physically non-coherent memory access node in the host:
and eliminating the physical non-uniform memory access nodes which do not meet the preset requirements.
7. The node allocation method according to claim 6, wherein rejecting physically non-coherent memory access nodes that do not meet a preset requirement comprises:
And eliminating the physical non-uniform memory access nodes of which the first residual memory is smaller than a preset memory threshold value.
8. The node allocation method according to claim 6, wherein rejecting physically non-coherent memory access nodes that do not meet a preset requirement comprises:
and eliminating the physical non-uniform memory access nodes which do not correspond to the memory stripes connected with the host.
9. The node allocation method according to claim 6, wherein rejecting physically non-coherent memory access nodes that do not meet a preset requirement comprises:
and eliminating the physical non-uniform memory access node with abnormal running state.
10. The node allocation method according to claim 6, further comprising, after rejecting the physically non-coherent memory access nodes that do not meet the preset requirement:
if the number of the physical non-uniform memory access nodes after eliminating the physical non-uniform memory access nodes which do not meet the preset requirements is smaller than the preset number, outputting prompt information, and after receiving an allocation instruction, allocating memory for the virtual machine by using the first residual memory of the physical non-uniform memory access nodes after eliminating the physical non-uniform memory access nodes which do not meet the preset requirements.
11. The node allocation method according to claim 1, further comprising, after allocating memory for the virtual machine according to each of the first remaining memory and the memory specification:
outputting an allocation log, wherein the allocation log at least comprises the time for allocating the memory and the allocation condition of the first residual memory of each physical non-uniform memory access node.
12. The node allocation method according to any of claims 1-11, wherein presetting a number of allocation policies to be determined comprises:
determining the number of the physical non-uniform memory access nodes on the host;
and determining a plurality of allocation strategies to be determined according to the number of the physical non-uniform memory access nodes.
13. The node allocation method according to claim 12, wherein determining a number of allocation policies to be determined according to the number of physically non-coherent memory access nodes comprises:
selecting partial physical non-uniform memory access nodes from the physical non-uniform memory access nodes respectively as target physical non-uniform memory access nodes, and allocating memory for the virtual machine by using first residual memory of the target physical non-uniform memory access nodes;
And each time the target physical non-uniform memory access node is selected, one allocation strategy to be determined corresponds to the target physical non-uniform memory access node.
14. The node allocation method according to claim 13, wherein the number of the physically non-coherent memory access nodes is 2 N And selecting part of the physical non-uniform memory access nodes from the physical non-uniform memory access nodes as target physical non-uniform memory access nodes, and allocating memory for the virtual machine by using the first residual memory of the target physical non-uniform memory access nodes, wherein the method comprises the following steps:
respectively from 2 N Each of the physical non-uniform memory access nodesSelect 2 0 、2 1 Up to 2 m The target physical non-uniform memory access nodes are selected, N is more than or equal to m is more than or equal to 2, and N and m are integers;
according to the selection of 2 0 、2 1 Up to 2 m And allocating memory for the virtual machine by the first residual memory of each target physical non-uniform memory access node.
15. The node allocation method of claim 13, wherein allocating memory for the virtual machine using the first remaining memory of the target physical non-coherent memory access node comprises:
and using the first residual memory average of the target physical non-uniform memory access node to allocate memory for the virtual machine.
16. A node-point distribution system, comprising:
the system comprises an acquisition unit, a storage unit and a storage unit, wherein the acquisition unit is used for acquiring the memory specification of a virtual machine and a first residual memory of each physical non-uniform memory access node in a host when the virtual machine is created;
the allocation unit is used for allocating memory for the virtual machine according to the first residual memory and the memory specification;
the dispensing unit comprises:
the strategy determining unit is used for determining a target allocation strategy according to the first residual memory and the memory specification;
the memory allocation unit is used for allocating memory for the virtual machine from the first residual memory of each physical non-uniform memory access node according to the target allocation strategy;
the target allocation strategy meets preset conditions, wherein the preset conditions are as follows:
after memory is allocated to the virtual machine from the first residual memories of each physical non-uniform memory access node according to the target allocation policy, the difference value of the second residual memories of each two physical non-uniform memory access nodes is within a preset range;
further comprises:
the strategy setting unit is used for presetting a plurality of distribution strategies to be determined;
The computing unit is used for computing a second residual memory of each physical non-uniform memory access node after memory is allocated to the virtual machine according to each allocation strategy to be determined;
the policy determining unit is specifically configured to determine, as the target allocation policy, an allocation policy to be determined that a second remaining memory of each of the physical non-uniform memory access nodes after allocating memory for the virtual machine meets the preset condition;
a dispersion calculating unit, configured to calculate a dispersion of a second remaining memory of each of the physical non-uniform memory access nodes according to the second remaining memory of each of the physical non-uniform memory access nodes;
the policy determining unit is specifically configured to determine, as the target allocation policy, an allocation policy to be determined that a dispersion of a second remaining memory of each of the physical non-coherent memory access nodes after allocating memory to the virtual machine is within a dispersion threshold range.
17. A node allocation apparatus, comprising:
a memory for storing a computer program;
processor for implementing the steps of the node allocation method according to any of claims 1-15 when storing a computer program.
18. A computer readable storage medium, characterized in that the computer readable storage medium has stored thereon a computer program which, when executed by a processor, implements the steps of the node allocation method according to any of claims 1-15.
CN202311154278.XA 2023-09-08 2023-09-08 Node distribution method, system, device and medium Active CN116880965B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311154278.XA CN116880965B (en) 2023-09-08 2023-09-08 Node distribution method, system, device and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311154278.XA CN116880965B (en) 2023-09-08 2023-09-08 Node distribution method, system, device and medium

Publications (2)

Publication Number Publication Date
CN116880965A CN116880965A (en) 2023-10-13
CN116880965B true CN116880965B (en) 2024-02-09

Family

ID=88259158

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311154278.XA Active CN116880965B (en) 2023-09-08 2023-09-08 Node distribution method, system, device and medium

Country Status (1)

Country Link
CN (1) CN116880965B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102232282A (en) * 2010-10-29 2011-11-02 华为技术有限公司 Method and apparatus for realizing load balance of resources in data center
CN112181595A (en) * 2020-10-10 2021-01-05 济南浪潮数据技术有限公司 NUMA node binding method, device, equipment and storage medium of virtual machine
CN115344353A (en) * 2022-08-29 2022-11-15 济南浪潮数据技术有限公司 Method, system and equipment for hot expansion of memory in cloud platform virtual machine
KR20230063015A (en) * 2021-11-01 2023-05-09 한화시스템 주식회사 Apparatus and method for managing virtual machine cpu resource in virtualization server
CN116225610A (en) * 2022-12-27 2023-06-06 天翼云科技有限公司 Binding method and device of virtual machine, electronic equipment and scheduling system
CN116302363A (en) * 2023-05-16 2023-06-23 苏州浪潮智能科技有限公司 Virtual machine creation method, system, computer equipment and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102232282A (en) * 2010-10-29 2011-11-02 华为技术有限公司 Method and apparatus for realizing load balance of resources in data center
CN112181595A (en) * 2020-10-10 2021-01-05 济南浪潮数据技术有限公司 NUMA node binding method, device, equipment and storage medium of virtual machine
KR20230063015A (en) * 2021-11-01 2023-05-09 한화시스템 주식회사 Apparatus and method for managing virtual machine cpu resource in virtualization server
CN115344353A (en) * 2022-08-29 2022-11-15 济南浪潮数据技术有限公司 Method, system and equipment for hot expansion of memory in cloud platform virtual machine
CN116225610A (en) * 2022-12-27 2023-06-06 天翼云科技有限公司 Binding method and device of virtual machine, electronic equipment and scheduling system
CN116302363A (en) * 2023-05-16 2023-06-23 苏州浪潮智能科技有限公司 Virtual machine creation method, system, computer equipment and storage medium

Also Published As

Publication number Publication date
CN116880965A (en) 2023-10-13

Similar Documents

Publication Publication Date Title
US9749208B2 (en) Integrated global resource allocation and load balancing
CN107548549B (en) Resource balancing in a distributed computing environment
US10733029B2 (en) Movement of services across clusters
US6901446B2 (en) System and method for describing and automatically managing resources
US10108460B2 (en) Method and system for integrated deployment planning for virtual appliances
US8434078B2 (en) Quick deployment method
US10248347B2 (en) Auto allocation of storage system resources to heterogeneous categories of resource consumer
US20020059427A1 (en) Apparatus and method for dynamically allocating computer resources based on service contract with user
US20120271944A1 (en) Distributed computing based on multiple nodes with determined capacity selectively joining resource groups having resource requirements
CN111124687B (en) CPU resource reservation method, device and related equipment
US9600343B2 (en) System and method for analyzing computing system resources
JP2004021982A (en) Method and system for dynamically allocating computer system resource
US7698529B2 (en) Method for trading resources between partitions of a data processing system
JP2015532992A (en) Automatic profiling of resource usage
CN110221920B (en) Deployment method, device, storage medium and system
US11681557B2 (en) Systems and methods for managing resources in a hyperconverged infrastructure cluster
US8443369B1 (en) Method and system for dynamically selecting a best resource from each resource collection based on resources dependencies, prior selections and statistics to implement an allocation policy
CN116880965B (en) Node distribution method, system, device and medium
CN117369941A (en) Pod scheduling method and system
CN116302327A (en) Resource scheduling method and related equipment
CN109376006A (en) Resource integrated method based on user demand time-varying characteristics under a kind of cloud computing environment
CN112000477B (en) Method, device, equipment and medium for load balancing in pod
CN112468458B (en) Scheduling method based on neutron layering mechanism
CN112346861A (en) Resource allocation method, device, equipment and super-fusion system
CN114675973A (en) Resource management method, device, storage medium, and program product

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant