CN116225610A - Binding method and device of virtual machine, electronic equipment and scheduling system - Google Patents

Binding method and device of virtual machine, electronic equipment and scheduling system Download PDF

Info

Publication number
CN116225610A
CN116225610A CN202211685842.6A CN202211685842A CN116225610A CN 116225610 A CN116225610 A CN 116225610A CN 202211685842 A CN202211685842 A CN 202211685842A CN 116225610 A CN116225610 A CN 116225610A
Authority
CN
China
Prior art keywords
virtual machine
cpu
idle
cpus
target
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.)
Pending
Application number
CN202211685842.6A
Other languages
Chinese (zh)
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.)
Tianyi Cloud Technology Co Ltd
Original Assignee
Tianyi Cloud 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 Tianyi Cloud Technology Co Ltd filed Critical Tianyi Cloud Technology Co Ltd
Priority to CN202211685842.6A priority Critical patent/CN116225610A/en
Publication of CN116225610A publication Critical patent/CN116225610A/en
Pending legal-status Critical Current

Links

Images

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/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • G06F9/5044Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering hardware capabilities
    • 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/45562Creating, deleting, cloning virtual machine instances
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Bus Control (AREA)

Abstract

The embodiment of the invention provides a binding method and device of a virtual machine, electronic equipment and a scheduling system, wherein the method comprises the following steps: receiving a creation instruction for creating a first target virtual machine, and determining the target number of Central Processing Units (CPUs) required for creating the first target virtual machine according to the creation instruction; determining the allocation situation of the CPU on each NUMA node of the non-uniform memory access architecture, and judging whether continuous idle CPU with target number exists on each NUMA node; when no continuous idle CPU with target number exists on each NUMA node, the binding relation between the CPU on each NUMA node and the virtual machine is adjusted so as to adjust continuous idle CPU with at least target number on one NUMA node; creating a first target virtual machine, and binding the first target virtual machine to a continuous, target number of idle CPUs on a NUMA node.

Description

Binding method and device of virtual machine, electronic equipment and scheduling system
Technical Field
The present invention relates to the field of data processing technologies, and in particular, to a virtual machine binding method, device, electronic device, and a scheduling system.
Background
In the current computer architecture, multi-core or many-core has become mainstream, but CPU (Central Processing Unit central processing unit) accesses unified memory to form a bottleneck, and NUMA (Non Uniform Memory Access, non-uniform memory access architecture) avoids performance loss caused when multiple processors access the same memory to try to solve the problem by providing separate memory to each processor, so that for one virtual machine, the main memory accessing the NUMA is faster or less than the main memory accessing the virtual machine crossing the NUMA, and in order to solve the problem, the industry generally limits a certain virtual machine to access within a certain NUMA.
In practical applications, virtual machines may be distributed to each NUMA in an average manner, but with a period of operation, a large number of virtual machines may be added or deleted, and a large number of fragments may be generated on the NUMA, which may cause a problem that a new virtual machine cannot be created and the throughput of a server is low.
Disclosure of Invention
In view of the above, a method, an apparatus, an electronic device and a scheduling system for binding a virtual machine are proposed to overcome or at least partially solve the above problems, comprising:
A method of binding virtual machines, the method comprising:
receiving a creation instruction for creating a first target virtual machine, and determining the target number of Central Processing Units (CPUs) required for creating the first target virtual machine according to the creation instruction;
determining the allocation situation of the CPU on each NUMA node of the non-uniform memory access architecture, and judging whether continuous idle CPU with target number exists on each NUMA node;
when no continuous idle CPU with target number exists on each NUMA node, the binding relation between the CPU on each NUMA node and the virtual machine is adjusted so as to adjust continuous idle CPU with at least target number on one NUMA node;
and creating the first target virtual machine, and binding the first target virtual machine on a continuous and target number of idle CPUs on the NUMA node.
Optionally, the adjusting the binding relationship between the CPU and the virtual machine on each NUMA node includes:
determining idle fragment CPUs in a target NUMA node, wherein the idle fragment CPUs are idle CPUs with continuous quantity of 1;
determining bound CPUs adjacent to the idle fragment CPUs, wherein the bound CPUs are bound with a virtual machine;
And establishing a binding relation between the idle fragment CPU and the virtual machine, and removing the binding relation between the virtual machine and a CPU farthest from the idle fragment CPU in the bound CPUs.
Optionally, the adjusting the binding relationship between the CPU and the virtual machine on each NUMA node includes:
counting the standing time of each virtual machine, wherein the standing time is calculated from the last data interaction between the virtual machine and the CPU;
and when the standing time exceeds a first preset value, the binding relation between the corresponding virtual machine and the CPU is released.
Optionally, the adjusting the binding relationship between the CPU and the virtual machine on each NUMA node includes:
determining the priority of the first target virtual machine and the priority of the virtual machine which has a binding relation with the CPU currently;
determining a second target virtual machine with a priority lower than that of the first target virtual machine;
and releasing the binding relation between the second target virtual machine and the corresponding CPU.
Optionally, the method further comprises:
when the first target virtual machine actively releases the binding relation with the corresponding CPU, the binding relation between the second target virtual machine and the corresponding CPU is established.
Optionally, the method further comprises:
determining the number of idle fragment CPUs in each NUMA node, wherein the idle fragment CPUs are idle CPUs with continuous number of 1;
when the number of the idle fragment CPUs exceeds a second preset value, the binding relation between the CPU and the virtual machine on each NUMA node is adjusted so as to reduce the number of the idle fragment CPUs below the second preset value.
Optionally, the binding the first target virtual machine to a consecutive, target number of idle CPUs on the NUMA node includes:
determining a plurality of idle CPU groups, wherein the idle CPU groups are composed of continuous idle CPUs with at least the number of target quantity;
determining the number of continuous CPUs with the continuous number greater than 1, which are remained by each NUMA node when the first target virtual machine is bound in each idle CPU group;
binding the first target virtual machine in the idle CPU group with the largest number of the rest continuous CPU with the continuous number larger than 1.
Optionally, when the first target virtual machine is determined to be bound to each idle CPU group, the number of consecutive CPUs remaining in each NUMA node is greater than 1, including:
determining the number of the continuous CPUs, the number of which is larger than 1, of the continuous CPUs remaining in each NUMA node when the first target virtual machine is bound in each idle CPU group;
And squaring the number of the CPUs, and taking the value obtained after squaring as the number of the continuous CPUs with the number of the continuous NUMA nodes remaining being more than 1.
Optionally, after binding the first target virtual machine to a consecutive, target number of idle CPUs on the NUMA node, the method further includes:
and setting the CPU bound with the first target virtual machine into a binding state.
Optionally, the method further comprises:
acquiring the current use state of each CPU on each NUMA; the current use state comprises an idle state and a binding state;
and storing the current use state into a preset database.
Optionally, the determining the allocation situation of the CPU on each non-uniform memory access architecture NUMA node includes:
acquiring the current use state of each CPU from the preset database;
and determining the allocation situation of the CPUs on each NUMA node according to the current use state of each CPU.
The embodiment of the invention also provides a scheduling system, which comprises: a NUMA configuration collection module and a NUMA defragmentation module;
the NUMA configuration collection module is used for determining the allocation situation of the CPU on each NUMA node;
the NUMA defragmentation module is used for receiving a creation instruction for creating a first target virtual machine and determining the target number of Central Processing Units (CPUs) required for creating the first target virtual machine according to the creation instruction; judging whether continuous idle CPU with target number exists on each NUMA node; when no continuous idle CPU with target number exists on each NUMA node, the binding relation between the CPU on each NUMA node and the virtual machine is adjusted so as to adjust continuous idle CPU with at least target number on one NUMA node; creating the first target virtual machine and binding the first target virtual machine to a continuous, target number of idle CPUs on the NUMA node
The embodiment of the invention also provides a binding device of the virtual machine, which comprises:
the receiving module is used for receiving a creation instruction for creating the first target virtual machine and determining the target number of Central Processing Units (CPUs) required for creating the first target virtual machine according to the creation instruction;
the judging module is used for determining the allocation situation of the CPU on each NUMA node of the non-uniform memory access architecture and judging whether continuous idle CPU with a target number exist on each NUMA node;
the adjusting module is used for adjusting the binding relation between the CPU and the virtual machine on each NUMA node when no continuous idle CPU with the target number exists on each NUMA node so as to adjust continuous idle CPU with the target number at least on one NUMA node;
and the creating and binding module is used for creating the first target virtual machine and binding the first target virtual machine on the continuous idle CPU with the target number on the NUMA node.
Optionally, the adjusting module is configured to determine an idle fragmentation CPU in the target NUMA node, where the idle fragmentation CPU is a continuous number of idle CPUs with 1; determining bound CPUs adjacent to the idle fragment CPUs, wherein the bound CPUs are bound with a virtual machine; and establishing a binding relation between the idle fragment CPU and the virtual machine, and removing the binding relation between the virtual machine and a CPU farthest from the idle fragment CPU in the bound CPUs.
Optionally, the adjusting module is configured to count a standing time of each virtual machine, where the standing time is calculated from the last time the virtual machine finishes data interaction with the CPU; and when the standing time exceeds a first preset value, the binding relation between the corresponding virtual machine and the CPU is released.
Optionally, the adjusting module is configured to determine a priority of the first target virtual machine and a priority of a virtual machine that has a binding relationship with the CPU currently; determining a second target virtual machine with a priority lower than that of the first target virtual machine; and releasing the binding relation between the second target virtual machine and the corresponding CPU.
Optionally, the apparatus further comprises:
and the rebinding module is used for establishing the binding relation between the second target virtual machine and the corresponding CPU when the first target virtual machine actively unbinds from the binding relation with the corresponding CPU.
Optionally, the apparatus further comprises:
the automatic adjustment module is used for determining the number of idle fragment CPUs in each NUMA node, wherein the idle fragment CPUs are idle CPUs with the continuous number of 1; when the number of the idle fragment CPUs exceeds a second preset value, the binding relation between the CPU and the virtual machine on each NUMA node is adjusted so as to reduce the number of the idle fragment CPUs below the second preset value.
Optionally, the creating and binding module is configured to determine a plurality of idle CPU groups, where the idle CPU groups are formed by a continuous idle CPU with at least a target number of idle CPUs; determining the number of continuous CPUs with the continuous number greater than 1, which are remained by each NUMA node when the first target virtual machine is bound in each idle CPU group; binding the first target virtual machine in the idle CPU group with the largest number of the rest continuous CPU with the continuous number larger than 1.
Optionally, the creating and binding module is configured to determine, when the first target virtual machine is bound to each idle CPU group, the number of CPUs of the continuous CPU with the number of remaining continuous CPUs of each NUMA node being greater than 1; and squaring the number of the CPUs, and taking the value obtained after squaring as the number of the continuous CPUs with the number of the continuous NUMA nodes remaining being more than 1.
Optionally, the apparatus further comprises:
and the state adjustment module is used for setting the CPU bound with the first target virtual machine into a binding state after binding the first target virtual machine on the continuous idle CPU with the target number on the NUMA node.
Optionally, the apparatus further comprises:
the relation storage module is used for acquiring the current use state of each CPU on each NUMA; the current use state comprises an idle state and a binding state; and storing the current use state into a preset database.
Optionally, the judging module is configured to obtain a current use state of each CPU from the preset database; and determining the allocation situation of the CPUs on each NUMA node according to the current use state of each CPU.
The embodiment of the invention also provides electronic equipment, which comprises a processor, a memory and a computer program stored on the memory and capable of running on the processor, wherein the computer program realizes the binding method of the virtual machine when being executed by the processor.
The embodiment of the invention also provides a computer readable storage medium, wherein the computer readable storage medium stores a computer program, and the computer program realizes the virtual machine binding method when being executed by a processor.
The embodiment of the invention has the following advantages:
in the embodiment of the invention, a creation instruction for creating a first target virtual machine is received, and the target number of CPU (Central processing Unit) needed for creating the first target virtual machine is determined according to the creation instruction; determining the allocation situation of the CPU on each NUMA node of the non-uniform memory access architecture, and judging whether continuous idle CPU with target number exists on each NUMA node; when no continuous idle CPU with target number exists on each NUMA node, the binding relation between the CPU on each NUMA node and the virtual machine is adjusted so as to adjust continuous idle CPU with at least target number on one NUMA node; creating a first target virtual machine, and binding the first target virtual machine to a continuous, target number of idle CPUs on a NUMA node. By the embodiment of the invention, when the fact that no continuous idle CPU with the target number exists on each NUMA node is detected, the binding relation between the CPU on each NUMA node and the virtual machine is adjusted so as to adjust the continuous idle CPU with the at least target number on one NUMA node. Therefore, the problem of low throughput of the server caused by fragments is avoided by reducing the CPU of the fragments, and the bearing capacity of the virtual machine of the server is improved.
Drawings
In order to more clearly illustrate the technical solutions of the present invention, the drawings that are needed in the description of the present invention will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present invention, and that other drawings may be obtained according to these drawings without inventive effort to a person skilled in the art.
FIG. 1 is a flow chart of steps of a binding method of a virtual machine according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of a NUMA node according to an embodiment of the invention;
FIG. 3 is a flow chart of steps of another virtual machine binding method according to an embodiment of the present invention;
FIG. 4 is a flow chart of steps of a binding method of a virtual machine according to another embodiment of the present invention;
FIG. 5 is a flow chart of steps of a binding method of a virtual machine according to an embodiment of the present invention;
FIG. 6 is a flow chart of the steps of a binding method of a virtual machine according to an embodiment of the present invention;
FIG. 7 is a schematic diagram of a scheduling system according to an embodiment of the present invention;
FIG. 8 is a schematic diagram of another scheduling system according to an embodiment of the present invention;
FIG. 9 is a schematic diagram of another NUMA node of embodiments of the invention;
FIG. 10 is a schematic diagram of a scheduling process according to an embodiment of the present invention;
FIG. 11 is a schematic diagram of another scheduling process according to an embodiment of the present invention;
fig. 12 is a schematic structural diagram of a binding device of a virtual machine according to an embodiment of the present invention.
Detailed Description
In order that the above-recited objects, features and advantages of the present invention will become more readily apparent, a more particular description of the invention will be rendered by reference to the appended drawings and appended detailed description. It will be apparent that the described embodiments are some, but not all, embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
In order to solve the problem of low server throughput caused by fragmentation, the embodiment of the invention provides a binding method of a virtual machine, which can adjust the binding relation between the CPU and the virtual machine on each NUMA node when detecting that no continuous and target number of idle CPU exists on each NUMA node, so as to adjust continuous and at least target number of idle CPU on one NUMA node. Therefore, the problem of low throughput of the server caused by fragments is avoided by reducing the CPU of the fragments, and the bearing capacity of the virtual machine of the server is improved.
Referring to fig. 1, a step flowchart of a binding method of a virtual machine according to an embodiment of the present invention may include the following steps:
step 101, receiving a creation instruction for creating a first target virtual machine, and determining the target number of Central Processing Units (CPUs) required for creating the first target virtual machine according to the creation instruction.
In practical applications, when a virtual machine needs to be created, a user may send a create instruction to a server on which a NUMA node is deployed.
After receiving the creation instruction for creating the first target virtual machine, the server may determine, according to the creation instruction, a target number of CPUs required for creating the first target virtual machine.
As an example, the target data may be included in a create instruction, specified by a user, to which embodiments of the invention are not limited.
Step 102, determining allocation conditions of CPUs on NUMA nodes of each non-uniform memory access architecture, and judging whether continuous idle CPUs with target number exist on each NUMA node.
When receiving the creation instruction, determining the allocation condition of the CPU on each NUMA node currently; specifically, it may be determined whether the CPU on each NUMA node has been assigned to a virtual machine. If not already allocated to the virtual machine, can be regarded as the idle CPU; and if already assigned to the virtual machine, acts as a bound CPU.
After determining the allocation situation of each CPU, the continuous CPU can be determined; as shown in fig. 2, CPU0, CPU1, CPU3, CPU4, CPU5 are idle CPUs; CPU0 and CPU1 may be regarded as a continuous CPU and CPU3, CPU4, and CPU5 may be regarded as a continuous CPU, to which the embodiment of the present invention is not limited.
After determining the continuous CPU, judging whether the continuous CPU is idle CPU with the target number; in the above example, if the target number is 5, it can be determined that there is no free CPU with the continuous number being the target number.
Step 103, when no continuous idle CPU with target number exists on each NUMA node, the binding relation between the CPU on each NUMA node and the virtual machine is adjusted so as to adjust continuous idle CPU with at least target number on one NUMA node.
In practical application, when it is determined that there are a continuous, target number of idle CPUs on the NUMA node, a first target virtual machine may be created, and the first target virtual machine may be bound with the continuous, target number of idle CPUs.
And when judging that no continuous and target number of idle CPUs exist on each NUMA node, adjusting the binding relation between the CPU on each NUMA node and the virtual machine so that at least one NUMA node has continuous and at least target number of idle CPUs.
By connecting the example, the binding relation between the CPU2 and the corresponding virtual machine can be released, and the binding relation between the CPU0 and the corresponding virtual machine can be established; thus, CPU1-CPU5 will all be idle CPUs; at this time, a binding relationship of the first target virtual machine and the CPU1 to CPU5 may be established.
Step 104, creating a first target virtual machine, and binding the first target virtual machine on a continuous, target number of idle CPUs on a NUMA node.
After adjusting out the consecutive, at least a target number of idle CPUs, the server may create a first target virtual machine in response to the creation instruction.
At the same time, the server may bind the created first target virtual machine to a continuous, target number of idle CPUs on an adjusted NUMA node.
In the embodiment of the invention, a creation instruction for creating a first target virtual machine is received, and the target number of CPU (Central processing Unit) needed for creating the first target virtual machine is determined according to the creation instruction; determining the allocation situation of the CPU on each NUMA node of the non-uniform memory access architecture, and judging whether continuous idle CPU with target number exists on each NUMA node; when no continuous idle CPU with target number exists on each NUMA node, the binding relation between the CPU on each NUMA node and the virtual machine is adjusted so as to adjust continuous idle CPU with at least target number on one NUMA node; creating a first target virtual machine, and binding the first target virtual machine to a continuous, target number of idle CPUs on a NUMA node. By the embodiment of the invention, when the fact that no continuous idle CPU with the target number exists on each NUMA node is detected, the binding relation between the CPU on each NUMA node and the virtual machine is adjusted so as to adjust the continuous idle CPU with the at least target number on one NUMA node. Therefore, the problem of low throughput of the server caused by fragments is avoided by reducing the CPU of the fragments, and the bearing capacity of the virtual machine of the server is improved.
Referring to fig. 3, a flowchart illustrating steps of another binding method of a virtual machine according to an embodiment of the present invention may include the following steps:
step 301, receiving a creation instruction for creating the first target virtual machine, and determining the target number of CPUs required for creating the first target virtual machine according to the creation instruction.
In practical applications, when a virtual machine needs to be created, a user may send a create instruction to a server on which a NUMA node is deployed.
After receiving the creation instruction for creating the first target virtual machine, the server may determine, according to the creation instruction, a target number of CPUs required for creating the first target virtual machine.
Step 302, determining allocation of CPUs on each NUMA node, and determining whether there are continuous idle CPUs with a target number on each NUMA node.
When receiving the creation instruction, determining the allocation condition of the CPU on each NUMA node currently; specifically, it may be determined whether the CPU on each NUMA node has been assigned to a virtual machine. If not already allocated to the virtual machine, can be regarded as the idle CPU; and if already assigned to the virtual machine, acts as a bound CPU.
After determining the allocation situation of each CPU, the continuous CPU can be determined; after determining the continuous CPU therein, it may be judged whether or not there is a continuous number of idle CPUs as the target number.
Step 303, when no continuous idle CPU with a target number exists on each NUMA node, determining the idle fragmented CPU in the target NUMA node, wherein the idle fragmented CPU is the idle CPU with the continuous number of 1.
In practical application, when it is determined that there are a continuous, target number of idle CPUs on the NUMA node, a first target virtual machine may be created, and the first target virtual machine may be bound with the continuous, target number of idle CPUs.
And when judging that no continuous and target number of idle CPUs exist on each NUMA node, adjusting the binding relation between the CPU on each NUMA node and the virtual machine so that at least one NUMA node has continuous and at least target number of idle CPUs.
Specifically, the idle fragment CPU in the target NUMA node may be first determined; an idle fragmented CPU may refer to a consecutive number 1 of idle CPUs.
As shown in fig. 2, CPU0, CPU1, CPU3, CPU5, CPU6 are idle CPUs; CPU3 may be considered as an idle fragmented CPU.
Step 304, determining a bound CPU adjacent to the idle fragment CPU, wherein the bound CPU is bound with a virtual machine.
In practical application, after determining the idle fragment CPU, the bound CPU adjacent to the idle fragment CPU can be determined again; wherein, a bound CPU may refer to a CPU that has been previously bound to a virtual machine.
Step 305, establishing a binding relationship between the idle fragmented CPU and a virtual machine, and unbinding a binding relationship between a virtual machine and a CPU farthest from the idle fragmented CPU in the bound CPUs, so as to adjust continuous idle CPUs with at least a target number on a NUMA node.
After determining the idle fragment CPU and the bound CPU adjacent to the idle fragment CPU, the binding relation between the idle fragment CPU and the bound CPU adjacent to the idle fragment CPU and the virtual machine can be adjusted; specifically, the binding relation between a virtual machine and a CPU farthest from the idle fragment CPU in the bound CPUs can be released; meanwhile, the binding relation between the idle fragment CPU and the virtual machine can be established.
As shown in fig. 2, CPU0 and CPU4 are idle CPUs; the virtual machine bound to CPU3 may be released and a binding relationship may be established between the virtual machine and CPU 0.
As an example, adjustments may also be made between different NUMA nodes, such as: the virtual machine bound to the CPU in the NUMA node 1 is unbundled and bound to the CPU in the NUMA node 2 to adjust a continuous, at least a target number of idle CPUs on the NUMA node 1, which is not limited in the embodiment of the present invention.
Step 306, creating a first target virtual machine, and binding the first target virtual machine to a continuous, target number of idle CPUs on a NUMA node.
After adjusting a continuous, at least a target number of idle CPUs on at least one NUMA node, the server can create a first target virtual machine in response to a create instruction.
At the same time, the server may bind the created first target virtual machine to a continuous, target number of idle CPUs on an adjusted NUMA node.
In the embodiment of the invention, a creation instruction for creating a first target virtual machine is received, and the target number of CPUs required for creating the first target virtual machine is determined according to the creation instruction; determining the allocation situation of the CPUs on each NUMA node and judging whether continuous idle CPUs with target number exist on each NUMA node; when no continuous idle CPU with a target number exists on each NUMA node, determining idle fragment CPU in the target NUMA node, wherein the idle fragment CPU is the idle CPU with the continuous number of 1; determining bound CPUs adjacent to the idle fragment CPUs, wherein the bound CPUs are bound with a virtual machine; establishing a binding relation between an idle fragment CPU and a virtual machine, and removing the binding relation between the virtual machine and a CPU farthest from the idle fragment CPU in the bound CPUs so as to adjust continuous idle CPUs with at least target number on a NUMA node; creating a first target virtual machine, and binding the first target virtual machine to a continuous, target number of idle CPUs on a NUMA node. According to the embodiment of the invention, the problem of low throughput of the server caused by fragments is avoided by reducing the CPU of the fragments, and the bearing capacity of the virtual machine of the server is improved.
Referring to fig. 4, a flowchart illustrating steps of a binding method of a virtual machine according to another embodiment of the present invention may include the following steps:
step 401, receiving a creation instruction for creating the first target virtual machine, and determining the target number of CPUs required for creating the first target virtual machine according to the creation instruction.
In practical applications, when a virtual machine needs to be created, a user may send a create instruction to a server on which a NUMA node is deployed.
After receiving the creation instruction for creating the first target virtual machine, the server may determine, according to the creation instruction, a target number of CPUs required for creating the first target virtual machine.
Step 402, determining allocation of CPUs on each NUMA node, and judging whether there are continuous idle CPUs with target number on each NUMA node.
When receiving the creation instruction, determining the allocation condition of the CPU on each NUMA node currently; specifically, it may be determined whether the CPU on each NUMA node has been assigned to a virtual machine. If not already allocated to the virtual machine, can be regarded as the idle CPU; and if already assigned to the virtual machine, acts as a bound CPU.
After determining the allocation situation of each CPU, the continuous CPU can be determined; after determining the continuous CPU therein, it may be judged whether or not there is a continuous number of idle CPUs as the target number.
And step 403, counting the standing time of each virtual machine when no continuous and target number of idle CPUs exist on each NUMA node, wherein the standing time starts to be calculated from the last data interaction between the virtual machine and the CPU.
In practical application, when it is determined that there are a continuous, target number of idle CPUs on the NUMA node, a first target virtual machine may be created, and the first target virtual machine may be bound with the continuous, target number of idle CPUs.
And when judging that no continuous and target number of idle CPUs exist on each NUMA node, adjusting the binding relation between the CPU on each NUMA node and the virtual machine so that at least one NUMA node has continuous and at least target number of idle CPUs.
Specifically, the standing time of each virtual machine having a binding relationship with the CPU in the NUMA node may be counted first; the rest time may be calculated from the end of the last data interaction with the CPU by the virtual machine.
And step 404, when the standing time exceeds a first preset value, the binding relation between the corresponding virtual machine and the CPU is released, so that continuous idle CPUs with at least the target number are adjusted on a NUMA node.
In practical application, when the rest time exceeds the first preset value, the virtual machine may be indicated to be possibly unnecessary to use the CPU temporarily; at this time, the binding relationship between the virtual machine whose rest time exceeds the first preset value and the corresponding CPU may be released. The first preset value may be set according to an actual situation, which is not limited in the embodiment of the present invention.
As an example, the virtual machines with the rest times exceeding the first preset value and the largest rest time may be unbinding sequentially until a continuous, at least a target number of idle CPUs are adjusted on the at least one NUMA node.
Step 405, creating a first target virtual machine, and binding the first target virtual machine to a continuous, target number of idle CPUs on a NUMA node.
After adjusting a continuous, at least a target number of idle CPUs on at least one NUMA node, the server can create a first target virtual machine in response to a create instruction.
At the same time, the server may bind the created first target virtual machine to a continuous, target number of idle CPUs on an adjusted NUMA node.
As an example, after detecting that the first target virtual machine is actively unbound, the unbound CPU may be re-established to have a binding relationship with the previously passively unbound virtual machine, which is not limited by the embodiment of the present invention.
In the embodiment of the invention, a creation instruction for creating a first target virtual machine is received, and the target number of CPUs required for creating the first target virtual machine is determined according to the creation instruction; determining the allocation situation of the CPUs on each NUMA node and judging whether continuous idle CPUs with target number exist on each NUMA node; when no continuous and target number of idle CPUs exist on each NUMA node, counting the standing time of each virtual machine, wherein the standing time starts to be calculated from the last data interaction between the virtual machine and the CPU; when the standing time exceeds a first preset value, the binding relation between the corresponding virtual machine and the CPU is released, so that continuous idle CPUs with at least the target number are adjusted on a NUMA node; creating a first target virtual machine, and binding the first target virtual machine to a continuous, target number of idle CPUs on a NUMA node. According to the embodiment of the invention, the problem of low throughput of the server caused by fragments is avoided by reducing the CPU of the fragments, and the bearing capacity of the virtual machine of the server is improved.
Referring to fig. 5, a flowchart illustrating steps of a binding method of a virtual machine according to another embodiment of the present invention may include the following steps:
Step 501, receiving a creation instruction for creating a first target virtual machine, and determining a target number of CPUs required for creating the first target virtual machine according to the creation instruction.
In practical applications, when a virtual machine needs to be created, a user may send a create instruction to a server on which a NUMA node is deployed.
After receiving the creation instruction for creating the first target virtual machine, the server may determine, according to the creation instruction, a target number of CPUs required for creating the first target virtual machine.
Step 502, determining allocation of CPUs on each NUMA node, and judging whether there are continuous idle CPUs with target number on each NUMA node.
When receiving the creation instruction, determining the allocation condition of the CPU on each NUMA node currently; specifically, it may be determined whether the CPU on each NUMA node has been assigned to a virtual machine. If not already allocated to the virtual machine, can be regarded as the idle CPU; and if already assigned to the virtual machine, acts as a bound CPU.
After determining the allocation situation of each CPU, the continuous CPU can be determined; after determining the continuous CPU therein, it may be judged whether or not there is a continuous number of idle CPUs as the target number.
Step 503, determining the priority of the first target virtual machine and the priority of the virtual machine having a binding relationship with the CPU currently when no continuous and target number of idle CPUs exist on each NUMA node.
In practical application, when it is determined that there are a continuous, target number of idle CPUs on the NUMA node, a first target virtual machine may be created, and the first target virtual machine may be bound with the continuous, target number of idle CPUs.
When it is determined that no continuous and target number of idle CPUs exist on each NUMA node, the priority of the first target virtual machine and the priority of the virtual machine having a binding relationship with the CPU of each NUMA node at present can be determined.
As an example, the priority may be set in advance according to actual conditions, for example: the task setting method is set according to the importance degree of the task corresponding to the virtual machine, and the embodiment of the invention is not limited to the importance degree.
Step 504, determining a second target virtual machine having a priority lower than that of the first target virtual machine.
After determining the priority of the first target virtual machine and the priority of the virtual machine currently having a binding relationship with the CPU of each NUMA node, at least one second target virtual machine having a priority lower than the priority of the first target virtual machine may be determined.
Step 505, unbinding the second target virtual machine and the corresponding CPU, so as to adjust continuous idle CPUs with at least the target number on a NUMA node.
Then, the binding relation between the second target virtual machine and the corresponding CPU can be released; specifically, unbinding operation is sequentially performed on the second target virtual machine according to the order of the priority from large to small until continuous idle CPUs with at least the target number are adjusted on at least one NUMA node.
Step 506, creating a first target virtual machine, and binding the first target virtual machine to a continuous, target number of idle CPUs on a NUMA node.
After adjusting a continuous, at least a target number of idle CPUs on at least one NUMA node, the server can create a first target virtual machine in response to a create instruction.
At the same time, the server may bind the created first target virtual machine to a continuous, target number of idle CPUs on an adjusted NUMA node.
In an embodiment of the present invention, the method further includes the following steps:
when the first target virtual machine actively releases the binding relation with the corresponding CPU, the binding relation between the second target virtual machine and the corresponding CPU is established.
In practical application, when the first target virtual machine is detected to actively release the binding relation with the corresponding CPU, the binding relation between the second target virtual machine and the corresponding CPU can be reestablished.
In the embodiment of the invention, a creation instruction for creating a first target virtual machine is received, and the target number of CPUs required for creating the first target virtual machine is determined according to the creation instruction; determining the allocation situation of the CPUs on each NUMA node and judging whether continuous idle CPUs with target number exist on each NUMA node; when no continuous and target number of idle CPUs exist on each NUMA node, determining the priority of a first target virtual machine and the priority of the virtual machine which has binding relation with the CPU currently; determining a second target virtual machine with a priority lower than that of the first target virtual machine; removing the binding relation between the second target virtual machine and the corresponding CPU to adjust continuous idle CPU with at least the target number on a NUMA node; creating a first target virtual machine, and binding the first target virtual machine to a continuous, target number of idle CPUs on a NUMA node. According to the embodiment of the invention, the problem of low throughput of the server caused by fragments is avoided by reducing the CPU of the fragments, and the bearing capacity of the virtual machine of the server is improved.
Referring to fig. 6, a flowchart illustrating steps of a binding method of a virtual machine according to an embodiment of the present invention may include the following steps:
step 601, receiving a creation instruction for creating a first target virtual machine, and determining a target number of CPUs required for creating the first target virtual machine according to the creation instruction.
In practical applications, when a virtual machine needs to be created, a user may send a create instruction to a server on which a NUMA node is deployed.
After receiving the creation instruction for creating the first target virtual machine, the server may determine, according to the creation instruction, a target number of CPUs required for creating the first target virtual machine.
Step 602, obtaining the current use state of each CPU from a preset database.
In practical application, when determining the allocation situation of the CPUs on each NUMA node, the current use state of each CPU may be obtained from a preset database. The current usage state may include an idle state and a binding state; wherein, the idle state may refer to the CPU not being bound to the virtual machine, and the bound state may refer to the CPU having been bound to the virtual machine.
In an embodiment of the present invention, the method may further include the following steps:
acquiring the current use state of each CPU on each NUMA; storing the current use state into a preset database.
Firstly, the current use state of each CPU on each NUMA can be acquired; then, the current usage state of each CPU may be stored into a preset database so that the current usage state of each CPU is determined based on the preset database later.
As an example, the information in the preset database may be updated in real time; for example: when a CPU is bound to a virtual machine, the current usage state of the CPU may be adjusted from an idle state to a bound state in a preset database, which is not limited in the embodiment of the present invention.
Step 603, determining the allocation situation of the CPUs on each NUMA node according to the current use state of each CPU, and judging whether there are continuous idle CPUs with a target number on each NUMA node.
After the current use state of each CPU is obtained, the allocation situation of each CPU on the NUMA node can be determined based on the current use state.
Then, based on the allocation situation of each CPU, it can be determined whether there are continuous, target number of idle CPUs on each NUMA node.
Step 604, when there are no continuous idle CPUs with a target number on each NUMA node, adjusting the binding relationship between the CPU on each NUMA node and the virtual machine to adjust continuous idle CPUs with at least a target number on one NUMA node.
In practical application, when it is determined that there are a continuous, target number of idle CPUs on the NUMA node, a first target virtual machine may be created, and the first target virtual machine may be bound with the continuous, target number of idle CPUs.
And when judging that no continuous and target number of idle CPUs exist on each NUMA node, adjusting the binding relation between the CPU on each NUMA node and the virtual machine so that at least one NUMA node has continuous and at least target number of idle CPUs.
Step 605, determining a plurality of idle CPU groups, wherein the idle CPU groups are composed of continuous idle CPUs with at least a target number.
In practical applications, multiple idle CPU groups may appear after adjustment; wherein the set of idle CPUs may be comprised of a continuous, at least a target number of idle CPUs.
To guarantee the subsequent throughput of the server, multiple idle CPU groups may be first determined.
Step 606, determining the number of consecutive CPUs, which are greater than 1, remaining in each NUMA node when the first target virtual machine is bound to each idle CPU group.
Then, the number of consecutive CPUs remaining for each NUMA node that are consecutive by a number greater than 1 assuming the first target virtual machine is bound to each free CPU group is determined.
In one embodiment of the present invention, step 606 may include the following sub-steps:
and step 11, determining the number of the continuous CPUs, the number of which is larger than 1, of the continuous CPUs remaining in each NUMA node when the first target virtual machine is bound in each idle CPU group.
First, it may be determined that the number of CPUs remaining in succession for each NUMA node is greater than 1, assuming that the first target virtual machine is bound to each idle CPU group.
And step 12, squaring the number of the CPUs, and taking the value obtained after squaring as the number of the continuous CPUs with the number of the continuous NUMA nodes remaining being more than 1.
Then, a single house of the number of CPUs of the continuous number of CPUs greater than 1 remaining in each NUMA node when the first target virtual machine is supposed to be bound to each idle CPU group can be taken, and the value obtained after squaring is taken as the number of continuous CPUs of the continuous number greater than 1 remaining in each NUMA node.
Step 607, creating a first target virtual machine, and binding the first target virtual machine in the idle CPU group with the largest number of continuous CPUs with the remaining continuous number greater than 1.
After determining the number of remaining, consecutive CPUs having a consecutive number greater than 1, corresponding to the respective idle CPU groups, the server may create the first target virtual machine in response to the creation instruction.
Meanwhile, the first target virtual machine can be bound in the idle CPU group with the largest number of the rest continuous CPU with the continuous number being more than 1, so that fragments generated by binding the first target virtual machine are reduced.
In one embodiment of the present invention, after binding the first target virtual machine to a consecutive, target number of idle CPUs on a NUMA node, the method further comprises:
and setting the CPU bound with the first target virtual machine into a binding state.
In practical application, after the first target virtual machine is bound on a continuous idle CPU with a target number on a NUMA node, the current use state of the CPU bound by the first target virtual machine can be adjusted; specifically, the CPU bound to the first target virtual machine may be adjusted from an idle state to a bound state, and the current usage state of the CPU in the preset database may be synchronized.
In an embodiment of the present invention, the following defragmentation process may be further included:
determining the number of idle fragment CPUs in each NUMA node, wherein the idle fragment CPUs are idle CPUs with the continuous number of 1; when the number of idle fragment CPUs exceeds a second preset value, the binding relation between the CPU on each NUMA node and the virtual machine is adjusted so as to reduce the number of idle fragment CPUs below the second preset value.
In practical applications, the above-mentioned defragmentation step may also be performed in advance, i.e. before the creation instruction has been received.
Specifically, the number of idle fragment CPUs in each NUMA node may be first determined; then, the relation between the number of idle fragment CPUs and a second preset value is judged. The second preset value may be set according to an actual situation.
If the number of the idle fragment CPUs exceeds a second preset value, the binding relation between the CPU and the virtual machine on each NUMA node can be adjusted in advance so as to reduce the number of the idle fragment CPUs below the preset value.
If the number of idle fragmented CPUs does not exceed the second preset value, the number of idle fragmented CPUs may be continuously detected, which is not limited in the embodiment of the present invention.
In the embodiment of the invention, a creation instruction for creating a first target virtual machine is received, and the target number of CPUs required for creating the first target virtual machine is determined according to the creation instruction; acquiring the current use state of each CPU from a preset database; determining the allocation situation of the CPUs on each NUMA node according to the current use state of each CPU, and judging whether continuous idle CPUs with target number exist on each NUMA node; when no continuous idle CPU with target number exists on each NUMA node, the binding relation between the CPU on each NUMA node and the virtual machine is adjusted so as to adjust continuous idle CPU with at least target number on one NUMA node; determining a plurality of idle CPU groups, wherein the idle CPU groups are composed of continuous idle CPUs with at least the number of target quantity; determining the number of continuous CPUs with the continuous number greater than 1, which are remained by each NUMA node when the first target virtual machine is bound in each idle CPU group; and creating a first target virtual machine, and binding the first target virtual machine in the idle CPU group with the largest number of continuous CPU with the continuous number larger than 1. According to the embodiment of the invention, the problem of low throughput of the server caused by fragments is avoided by reducing the CPU of the fragments, and the bearing capacity of the virtual machine of the server is improved.
And by binding the first target virtual machine in the idle CPU group with the largest number of the rest continuous CPU with the continuous number larger than 1, fragments generated by the binding can be reduced.
It should be noted that, for simplicity of description, the method embodiments are shown as a series of acts, but it should be understood by those skilled in the art that the embodiments are not limited by the order of acts, as some steps may occur in other orders or concurrently in accordance with the embodiments. Further, those skilled in the art will appreciate that the embodiments described in the specification are presently preferred embodiments, and that the acts are not necessarily required by the embodiments of the invention.
Referring to fig. 7, which is a schematic structural diagram of a scheduling system according to an embodiment of the present invention, the system may include: a NUMA configuration collection module and a NUMA defragmentation module.
The NUMA configuration collection module is used for determining the allocation situation of the CPU on each NUMA node;
the NUMA defragmentation module is used for receiving a creation instruction for creating the first target virtual machine and determining the target number of CPU (central processing unit) needed by the creation of the first target virtual machine according to the creation instruction; judging whether continuous idle CPU with target number exists on each NUMA node; when no continuous idle CPU with target number exists on each NUMA node, the binding relation between the CPU on each NUMA node and the virtual machine is adjusted so as to adjust continuous idle CPU with at least target number on one NUMA node; creating a first target virtual machine, and binding the first target virtual machine to a continuous, target number of idle CPUs on a NUMA node.
In practical applications, the NUMA configuration collection module may be configured to determine allocation of CPUs on each NUMA node in real time.
The NUMA defragmentation module may be configured to receive a creation instruction for creating the first target virtual machine, and determine, according to the creation instruction, a target number of CPUs required for creating the first target virtual machine after receiving the creation instruction for creating the first target virtual machine.
The NUMA defragmentation module can then determine whether there are a consecutive number of idle CPUs of the target number based on the allocation of CPUs on each NUMA node as determined by the NUMA configuration collection module.
When it is determined that there are a continuous, target number of idle CPUs on the NUMA node, the NUMA defragmentation module may create a first target virtual machine and bind the first target virtual machine to the continuous, target number of idle CPUs.
And when it is determined that no continuous and target number of idle CPUs exist on each NUMA node, the NUMA defragmentation module can adjust the binding relationship between the CPUs on each NUMA node and the virtual machine so that at least one NUMA node has continuous and at least target number of idle CPUs.
After adjusting out a consecutive, at least a target number of idle CPUs, the NUMA defragmentation module can create a first target virtual machine in response to the creation instruction. At the same time, the NUMA defragmentation module can bind the created first target virtual machine to a continuous, target number of idle CPUs on an adjusted NUMA node.
In an embodiment of the present invention, the system may further include a virtual machine dynamic programming and scheduling module, as shown in fig. 8:
the NUMA configuration collection module collects NUMA conditions and morphology NUMA topology of the physical machine, and updates the NUMA topology conditions according to the use and release of a CPU (Central processing Unit) on the NUMA by the system; and provides data to the virtual machine dynamic programming scheduling module for use.
1, firstly, obtaining the corresponding conditions of all CPUs and NUMA of the system through corresponding system commands such as lscpu and the like.
2, in a two-dimensional array (NUMA bitmap) where all NUMA information is placed, each CPU is numbered as shown in FIG. 9 below, and 0/1 is used to indicate whether or not the CPU is bound.
The virtual machine dynamic planning and scheduling module: and according to the NUMA configuration collection module data and a dynamic programming algorithm, scheduling and binding the newly-built virtual machine.
The operation of the virtual machine dynamic programming scheduling module may be as follows in fig. 10:
if a 4-core virtual machine is to be created, the following algorithm principle is followed:
1, under the condition that the CPU is not overdriving, the total number of cores of the bound virtual machines is the largest in all NUMA spaces.
2, the number of fragments generated in NUMA is the smallest, and the largest virtual machines can be scheduled.
The corresponding dynamic programming formula:
C(x+1)=Max{C(x)-S(1,NUMA(n))};
wherein C (X) expresses the capacity left after X times of scheduling, S (1, NUMA (n)) expresses the capacity occupied by NUMA (n) after 1 virtual machine is scheduled, C (x+1) expresses the capacity left after X times of scheduling, and the remaining capacity is needed to be scheduled in each NUMA in an attempt, and finally the remaining continuous space is the largest.
For the calculation of C (x), we also set a formula, for the space on the same NUMA, the more space, the greater the weighting, the weighted space formula is as follows:
Figure BDA0004020917710000181
the available space of a single NUMA is calculated first, the already bound core availed=0, the free core availed=1, the available space of a single NUMA is calculated, the sum of the spaces on the NUMA is squared for the purpose of weighting the available space of a single NUMA, if the available space on the NUMA is 4, the end result is 16, if the available space is 6, and finally 36, it will be greater than 42+22=20. The benefits of the same NUAM space are emphasized.
Through a dynamic programming algorithm, the method can ensure that after the virtual machine is established, the overall optimization is realized, namely the generated fragments are minimum, and the scheduled virtual machines are maximum.
NUMA defragmentation module: and adopting a dynamic programming algorithm to perform secondary movement on the bound virtual machines, integrating discontinuous spaces, freeing up continuous spaces and providing the continuous spaces for new virtual machines.
Over time, virtual machines are continuously deleted, a large amount of fragments are generated on NUMA, the overall utilization rate of the NUMA is reduced, and the virtual machines cannot be distributed. At this time, the bound virtual machine needs to be moved for the second time, as shown in fig. 11 below:
the first step: when a 6-core virtual machine is to be applied, the space on all NUMA does not meet the requirement, and NUMA fragments are required to be sorted at the moment;
and a second step of: the defragmentation of NUMA is performed as follows:
1, adopting dynamic programming through global adjustment to reduce the generation of fragments as much as possible;
and 2, after the virtual machine is adjusted, weighting the space sum to be maximum.
The related formula calculation also adopts a dynamic planning formula and a weighted space formula in the dynamic planning scheduling module. By arranging NUMA spaces, a large amount of continuous space is vacated after the virtual machine is rebind;
and a third step of: on the vacated contiguous NUMA space, a specified virtual machine is created.
Through the arrangement of NUMA fragments, the bearing capacity of the virtual machine is further improved, and the throughput rate of NUMA is improved.
In the embodiment of the invention, a creation instruction for creating a first target virtual machine is received, and the target number of CPU (Central processing Unit) needed for creating the first target virtual machine is determined according to the creation instruction; determining the allocation situation of the CPU on each NUMA node of the non-uniform memory access architecture, and judging whether continuous idle CPU with target number exists on each NUMA node; when no continuous idle CPU with target number exists on each NUMA node, the binding relation between the CPU on each NUMA node and the virtual machine is adjusted so as to adjust continuous idle CPU with at least target number on one NUMA node; creating a first target virtual machine, and binding the first target virtual machine to a continuous, target number of idle CPUs on a NUMA node. By the embodiment of the invention, when the fact that no continuous idle CPU with the target number exists on each NUMA node is detected, the binding relation between the CPU on each NUMA node and the virtual machine is adjusted so as to adjust the continuous idle CPU with the at least target number on one NUMA node. Therefore, the problem of low throughput of the server caused by fragments is avoided by reducing the CPU of the fragments, and the bearing capacity of the virtual machine of the server is improved.
Referring to fig. 12, a schematic structural diagram of a binding apparatus of a virtual machine according to an embodiment of the present invention may include the following modules:
a receiving module 1201, configured to receive a creation instruction for creating a first target virtual machine, and determine, according to the creation instruction, a target number of CPUs required for creating the first target virtual machine;
a judging module 1202, configured to determine allocation of CPUs on non-uniform memory access architecture NUMA nodes, and judge whether there are continuous idle CPUs with a target number on each NUMA node;
the adjusting module 1203 is configured to adjust, when no continuous idle CPUs with a target number exist on each NUMA node, a binding relationship between the CPUs on each NUMA node and the virtual machine, so as to adjust a continuous idle CPU with at least a target number on one NUMA node;
the create and bind module 1204 is configured to create a first target virtual machine and bind the first target virtual machine to a number of consecutive, target number of idle CPUs on a NUMA node.
In an alternative embodiment of the present invention, the adjustment module 1203 is configured to determine an idle fragment CPU in the target NUMA node, where the idle fragment CPU is a continuous number of idle CPUs with 1; determining bound CPUs adjacent to the idle fragment CPUs, wherein the bound CPUs are bound with a virtual machine; and establishing a binding relation between the idle fragment CPU and a virtual machine, and removing the binding relation between the virtual machine and a CPU farthest from the idle fragment CPU in the bound CPUs.
In an alternative embodiment of the present invention, the adjustment module 1203 is configured to count a rest time of each virtual machine, where the rest time is calculated from the last data interaction with the CPU by the virtual machine; and when the standing time exceeds a first preset value, the binding relation between the corresponding virtual machine and the CPU is released.
In an alternative embodiment of the present invention, the adjustment module 1203 is configured to determine a priority of the first target virtual machine and a priority of a virtual machine that has a binding relationship with the CPU currently; determining a second target virtual machine with a priority lower than that of the first target virtual machine; and releasing the binding relation between the second target virtual machine and the corresponding CPU.
In an alternative embodiment of the present invention, the apparatus further comprises:
and the rebinding module is used for establishing the binding relation between the second target virtual machine and the corresponding CPU when the first target virtual machine actively unbinds the binding relation with the corresponding CPU.
In an alternative embodiment of the present invention, the apparatus further comprises:
the automatic adjustment module is used for determining the number of idle fragment CPUs in each NUMA node, wherein the idle fragment CPUs are idle CPUs with the continuous number of 1; when the number of idle fragment CPUs exceeds a second preset value, the binding relation between the CPU on each NUMA node and the virtual machine is adjusted so as to reduce the number of idle fragment CPUs below the second preset value.
In an alternative embodiment of the present invention, a create and bind module 1204 is configured to determine a plurality of idle CPU groups, where the idle CPU groups are comprised of a continuous, at least a target number of idle CPUs; determining the number of continuous CPUs with the continuous number greater than 1, which are remained by each NUMA node when the first target virtual machine is bound in each idle CPU group; binding the first target virtual machine in the idle CPU group with the largest number of the rest continuous CPU with the continuous number larger than 1.
In an alternative embodiment of the present invention, a create and bind module 1204 is configured to determine, when the first target virtual machine is bound to each idle CPU group, the number of CPUs of the continuous CPU with the number of remaining continuous number of NUMA nodes being greater than 1; and squaring the number of the CPUs, and taking the value obtained after squaring as the number of the continuous CPUs with the residual continuous number of NUMA nodes being more than 1.
In an alternative embodiment of the present invention, the apparatus further comprises:
and the state adjustment module is used for setting the CPU bound with the first target virtual machine into a binding state after binding the first target virtual machine on the continuous idle CPU with the target number on a NUMA node.
In an alternative embodiment of the present invention, the apparatus further comprises:
The relation storage module is used for acquiring the current use state of each CPU on each NUMA; the current use state comprises an idle state and a binding state; storing the current use state into a preset database.
In an alternative embodiment of the present invention, the determining module 1202 is configured to obtain, from a preset database, a current usage status of each CPU; determining the allocation condition of the CPUs on each NUMA node according to the current use state of each CPU
In the embodiment of the invention, a creation instruction for creating a first target virtual machine is received, and the target number of CPU (Central processing Unit) needed for creating the first target virtual machine is determined according to the creation instruction; determining the allocation situation of the CPU on each NUMA node of the non-uniform memory access architecture, and judging whether continuous idle CPU with target number exists on each NUMA node; when no continuous idle CPU with target number exists on each NUMA node, the binding relation between the CPU on each NUMA node and the virtual machine is adjusted so as to adjust continuous idle CPU with at least target number on one NUMA node; creating a first target virtual machine, and binding the first target virtual machine to a continuous, target number of idle CPUs on a NUMA node. By the embodiment of the invention, when the fact that no continuous idle CPU with the target number exists on each NUMA node is detected, the binding relation between the CPU on each NUMA node and the virtual machine is adjusted so as to adjust the continuous idle CPU with the at least target number on one NUMA node. Therefore, the problem of low throughput of the server caused by fragments is avoided by reducing the CPU of the fragments, and the bearing capacity of the virtual machine of the server is improved.
The embodiment of the invention also provides electronic equipment, which comprises a processor, a memory and a computer program stored on the memory and capable of running on the processor, wherein the computer program is executed by the processor to realize the binding method of the virtual machine.
The embodiment of the invention also provides a computer readable storage medium, wherein the computer readable storage medium stores a computer program, and the binding method of the virtual machine is realized when the computer program is executed by a processor.
For the device embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and reference is made to the description of the method embodiments for relevant points.
In this specification, each embodiment is described in a progressive manner, and each embodiment is mainly described by differences from other embodiments, and identical and similar parts between the embodiments are all enough to be referred to each other.
It will be apparent to those skilled in the art that embodiments of the present invention may be provided as a method, apparatus, or computer program product. Accordingly, embodiments of the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, embodiments of the invention may take the form of a computer program product on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
Embodiments of the present invention are described with reference to flowchart illustrations and/or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. It is therefore intended that the following claims be interpreted as including the preferred embodiment and all such alterations and modifications as fall within the scope of the embodiments of the invention.
Finally, it is further noted that 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 terminal 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 terminal. 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 terminal device comprising the element.
The above description of the binding method, device, electronic device and scheduling system of a virtual machine provided, the specific examples applied herein illustrate the principles and embodiments of the present invention, and the description of the above examples is only used to help understand the method and core idea of the present invention; meanwhile, as those skilled in the art will have variations in the specific embodiments and application scope in accordance with the ideas of the present invention, the present description should not be construed as limiting the present invention in view of the above.

Claims (15)

1. A method for binding a virtual machine, the method comprising:
receiving a creation instruction for creating a first target virtual machine, and determining the target number of Central Processing Units (CPUs) required for creating the first target virtual machine according to the creation instruction;
determining the allocation situation of the CPU on each NUMA node of the non-uniform memory access architecture, and judging whether continuous idle CPU with target number exists on each NUMA node;
when no continuous idle CPU with target number exists on each NUMA node, the binding relation between the CPU on each NUMA node and the virtual machine is adjusted so as to adjust continuous idle CPU with at least target number on one NUMA node;
And creating the first target virtual machine, and binding the first target virtual machine on a continuous and target number of idle CPUs on the NUMA node.
2. The method of claim 1, wherein the adjusting the binding of the CPU on each NUMA node to the virtual machine comprises:
determining idle fragment CPUs in a target NUMA node, wherein the idle fragment CPUs are idle CPUs with continuous quantity of 1;
determining bound CPUs adjacent to the idle fragment CPUs, wherein the bound CPUs are bound with a virtual machine;
and establishing a binding relation between the idle fragment CPU and the virtual machine, and removing the binding relation between the virtual machine and a CPU farthest from the idle fragment CPU in the bound CPUs.
3. The method of claim 1, wherein the adjusting the binding of the CPU on each NUMA node to the virtual machine comprises:
counting the standing time of each virtual machine, wherein the standing time is calculated from the last data interaction between the virtual machine and the CPU;
and when the standing time exceeds a first preset value, the binding relation between the corresponding virtual machine and the CPU is released.
4. The method of claim 1, wherein the adjusting the binding of the CPU on each NUMA node to the virtual machine comprises:
Determining the priority of the first target virtual machine and the priority of the virtual machine which has a binding relation with the CPU currently;
determining a second target virtual machine with a priority lower than that of the first target virtual machine;
and releasing the binding relation between the second target virtual machine and the corresponding CPU.
5. The method according to claim 4, wherein the method further comprises:
when the first target virtual machine actively releases the binding relation with the corresponding CPU, the binding relation between the second target virtual machine and the corresponding CPU is established.
6. The method according to claim 1, wherein the method further comprises:
determining the number of idle fragment CPUs in each NUMA node, wherein the idle fragment CPUs are idle CPUs with continuous number of 1;
when the number of the idle fragment CPUs exceeds a second preset value, the binding relation between the CPU and the virtual machine on each NUMA node is adjusted so as to reduce the number of the idle fragment CPUs below the second preset value.
7. The method of claim 1, wherein binding the first target virtual machine to a consecutive, target number of idle CPUs on the NUMA node comprises:
Determining a plurality of idle CPU groups, wherein the idle CPU groups are composed of continuous idle CPUs with at least the number of target quantity;
determining the number of continuous CPUs with the continuous number greater than 1, which are remained by each NUMA node when the first target virtual machine is bound in each idle CPU group;
binding the first target virtual machine in the idle CPU group with the largest number of the rest continuous CPU with the continuous number larger than 1.
8. The method of claim 7, wherein the determining that the first target virtual machine is bound to each idle CPU group, the number of consecutive CPUs remaining for each NUMA node being greater than 1, comprises:
determining the number of the continuous CPUs, the number of which is larger than 1, of the continuous CPUs remaining in each NUMA node when the first target virtual machine is bound in each idle CPU group;
and squaring the number of the CPUs, and taking the value obtained after squaring as the number of the continuous CPUs with the number of the continuous NUMA nodes remaining being more than 1.
9. The method of claim 1, wherein after binding the first target virtual machine on a consecutive, target number of idle CPUs on the NUMA node, the method further comprises:
and setting the CPU bound with the first target virtual machine into a binding state.
10. The method according to claim 1, wherein the method further comprises:
acquiring the current use state of each CPU on each NUMA; the current use state comprises an idle state and a binding state;
and storing the current use state into a preset database.
11. The method of claim 10, wherein determining allocation of CPUs on each non-uniform memory access architecture NUMA node comprises:
acquiring the current use state of each CPU from the preset database;
and determining the allocation situation of the CPUs on each NUMA node according to the current use state of each CPU.
12. A scheduling system, the system comprising: a NUMA configuration collection module and a NUMA defragmentation module;
the NUMA configuration collection module is used for determining the allocation situation of the CPU on each NUMA node;
the NUMA defragmentation module is used for receiving a creation instruction for creating a first target virtual machine and determining the target number of Central Processing Units (CPUs) required for creating the first target virtual machine according to the creation instruction; judging whether continuous idle CPU with target number exists on each NUMA node; when no continuous idle CPU with target number exists on each NUMA node, the binding relation between the CPU on each NUMA node and the virtual machine is adjusted so as to adjust continuous idle CPU with at least target number on one NUMA node; and creating the first target virtual machine, and binding the first target virtual machine on a continuous and target number of idle CPUs on the NUMA node.
13. A binding apparatus for a virtual machine, the apparatus comprising:
the receiving module is used for receiving a creation instruction for creating the first target virtual machine and determining the target number of Central Processing Units (CPUs) required for creating the first target virtual machine according to the creation instruction;
the judging module is used for determining the allocation situation of the CPU on each NUMA node of the non-uniform memory access architecture and judging whether continuous idle CPU with a target number exist on each NUMA node;
the adjusting module is used for adjusting the binding relation between the CPU and the virtual machine on each NUMA node when no continuous idle CPU with the target number exists on each NUMA node so as to adjust continuous idle CPU with the target number at least on one NUMA node;
and the creating and binding module is used for creating the first target virtual machine and binding the first target virtual machine on the continuous idle CPU with the target number on the NUMA node.
14. An electronic device comprising a processor, a memory and a computer program stored on the memory and capable of running on the processor, which when executed by the processor implements a method of binding a virtual machine according to any one of claims 1 to 11.
15. 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 a binding method of a virtual machine according to any of claims 1 to 11.
CN202211685842.6A 2022-12-27 2022-12-27 Binding method and device of virtual machine, electronic equipment and scheduling system Pending CN116225610A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211685842.6A CN116225610A (en) 2022-12-27 2022-12-27 Binding method and device of virtual machine, electronic equipment and scheduling system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211685842.6A CN116225610A (en) 2022-12-27 2022-12-27 Binding method and device of virtual machine, electronic equipment and scheduling system

Publications (1)

Publication Number Publication Date
CN116225610A true CN116225610A (en) 2023-06-06

Family

ID=86590096

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211685842.6A Pending CN116225610A (en) 2022-12-27 2022-12-27 Binding method and device of virtual machine, electronic equipment and scheduling system

Country Status (1)

Country Link
CN (1) CN116225610A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116880965A (en) * 2023-09-08 2023-10-13 苏州浪潮智能科技有限公司 Node distribution method, system, device and medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116880965A (en) * 2023-09-08 2023-10-13 苏州浪潮智能科技有限公司 Node distribution method, system, device and medium
CN116880965B (en) * 2023-09-08 2024-02-09 苏州浪潮智能科技有限公司 Node distribution method, system, device and medium

Similar Documents

Publication Publication Date Title
US20240004790A1 (en) Coordinated garbage collection in distributed systems
US10831387B1 (en) Snapshot reservations in a distributed storage system
EP2437168B1 (en) Method and device for balancing load of multiprocessor system
CN108900626B (en) Data storage method, device and system in cloud environment
US20130138886A1 (en) Scheduler, multi-core processor system, and scheduling method
CN106603692B (en) Data storage method and device in distributed storage system
DE102012206019A1 (en) Assignment of counters from a population of counters to control logical register mappings to physical registers for execution of instructions initiated by an allocation unit
CN101957863A (en) Data parallel processing method, device and system
CN111381928B (en) Virtual machine migration method, cloud computing management platform and storage medium
CN108574645B (en) Queue scheduling method and device
CN108200112B (en) Distributed storage method and system
CN112148430A (en) Method for online safe migration of virtual machine with virtual network function
US20240187351A1 (en) Stream allocation using stream credits
CN109117279B (en) Electronic device, method for limiting inter-process communication thereof and storage medium
CN116225610A (en) Binding method and device of virtual machine, electronic equipment and scheduling system
CN108509280A (en) A kind of Distributed Calculation cluster locality dispatching method based on push model
US11765099B2 (en) Resource allocation using distributed segment processing credits
CN116483546B (en) Distributed training task scheduling method, device, equipment and storage medium
CN116663639B (en) Gradient data synchronization method, system, device and medium
US11005776B2 (en) Resource allocation using restore credits
CN113326146A (en) Message processing method and device, electronic equipment and storage medium
CN113127179A (en) Resource scheduling method and device, electronic equipment and computer readable medium
CN110928649A (en) Resource scheduling method and device
EP3389222A1 (en) A method and a host for managing events in a network that adapts event-driven programming framework
CN109062707B (en) Electronic device, method for limiting inter-process communication thereof and storage medium

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
CB02 Change of applicant information
CB02 Change of applicant information

Address after: 100007 room 205-32, floor 2, building 2, No. 1 and No. 3, qinglonghutong a, Dongcheng District, Beijing

Applicant after: Tianyiyun Technology Co.,Ltd.

Address before: 100093 Floor 4, Block E, Xishan Yingfu Business Center, Haidian District, Beijing

Applicant before: Tianyiyun Technology Co.,Ltd.