Apparatus and method for virtual machine scheduling in non-uniform memory access architecture
11204798 · 2021-12-21
Assignee
Inventors
- Haibing Guan (Shanghai, CN)
- Ruhui MA (Shanghai, CN)
- Jian Li (Shanghai, CN)
- Zhengwei Qi (Shanghai, CN)
- Junsheng Tan (Shanghai, CN)
Cpc classification
G06F12/0284
PHYSICS
G06F2009/4557
PHYSICS
G06F9/4881
PHYSICS
G06F2009/45579
PHYSICS
G06F9/5077
PHYSICS
International classification
G06F9/455
PHYSICS
Abstract
The method includes the following steps: step 1. obtaining NUMA topology information of a host machine, and monitoring virtual machine performance events by using a kernel PMU; step 2. implementing a greedy algorithm, and a scheduling decision is obtained; step 3. scheduling, according to the scheduling decision, a virtual CPU (VCPU) and a memory of a virtual machine; step 4. after the scheduling of the virtual machine is complete, redirecting to step 1 to continue performing performance monitoring of the virtual machine.
Claims
1. A method for virtual machine scheduling, the method comprising at least the following steps: step 1. obtaining, a non-uniform memory access (NUMA) topology information of a host machine, and monitoring performance events of a virtual machine by using a kernel performance monitoring unit (PMU); step 2. implementing a greedy algorithm to obtain a scheduling decision; step 3. scheduling, according to the scheduling decision, a virtual CPU (VCPU) and a memory of the virtual machine; and step 4. after the scheduling of the virtual machine is complete, redirecting to step 1 to continue performing performance monitoring of the virtual machine; wherein the greedy algorithm includes at least the following steps: inputting the NUMA topology information of the host machine and the performance events of the virtual machine; determining whether the virtual machine is an I/O-intensive virtual machine; determining an NUMA node to which the virtual machine shall be scheduled; and returning the scheduling decision; and wherein the step 1 comprises at least the following steps: real-time monitoring the performance events of the virtual machine, by using a virtual machine monitor (VMM); real-time monitoring performance events of an operating system, by using the PMU of an operating system kernel; and obtaining a topology structure of a NUMA architecture of the host machine; wherein the performance events of the virtual machine comprise a CPU usage, a memory usage, and an I/O usage of the virtual machine, and the performance events of the operating system comprise a cache loss ratio of the operating system and cycles per second of executing instructions by the virtual machine.
2. The method for virtual machine scheduling according to claim 1, wherein the NUMA topology information of the host machine NUMA comprises a quantity of NUMA nodes, a distance between the NUMA nodes, and an NUMA node to which an I/O device is connected.
3. The method for virtual machine scheduling according to claim 1, wherein if it is determined that the virtual machine is an I/O-intensive virtual machine, the NUMA node to which the virtual machine shall be scheduled is further determined by using the following formula:
MAX(Σ.sub.n=0.sup.NMem[n]*ANMMatrix(n)) where n represents the NUMA node; N represents a quantity of NUMA nodes; Mem[n] represents a quantity of memory pages that are distributed at the NUMA node n by the virtual machine; and ANMMatrix(n) represents a distance between the NUMA nodes.
4. The method for virtual machine scheduling according to claim 3, wherein if the virtual machine is not an I/O-intensive virtual machine, the NUMA node to which the virtual machine shall be scheduled is determined by using the following formula:
Max(Σ.sub.c=0.sup.NΣ.sub.n=0.sup.NCPU[c]*Mem[n]*ANMMatrix(n)) where CPU[c] represents CPU usage of the virtual machine at a node c.
Description
BRIEF DESCRIPTION OF THE DRAWINGS
(1)
(2)
(3)
DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
(4) As shown in
(5) The performance events monitored by the performance monitoring module include CPU usage, memory usage, a cache loss ratio, and I/O performance data of the virtual machine.
(6) As shown in
(7) Step 1. A performance monitoring module obtains NUMA topology information of a host machine, and monitors virtual machine performance events by using a kernel PMU.
(8) Step 2. Transmit the NUMA topology information of the host machine and the virtual machine performance events to an algorithm implementation interface module, where the NUMA topology information of the host machine NUMA includes a quantity of NUMA nodes, a distance between the NUMA nodes, and an NUMA node to which an I/O device is connected.
Step 3. The algorithm implementation interface module invokes an algorithm, and transmits a scheduling decision that is obtained by using a scheduling algorithm to a virtual machine scheduling module after execution of the scheduling algorithm is complete.
Step 4. The virtual machine scheduling module schedules a VCPU and a memory of a virtual machine according to the scheduling decision transmitted by the algorithm implementation interface module.
Step 5. After the scheduling of the virtual machine is complete, redirect to step 1 to continue performing performance monitoring of the virtual machine.
(9) The scheduling algorithm is a greedy algorithm. An algorithm process of the scheduling algorithm includes the following steps:
(10) (1) Input of the algorithm is the NUMA topology information of the host machine and the virtual machine performance events that are transmitted by the performance monitoring module.
(11) (2) Whether the virtual machine is an I/O-intensive virtual machine by using the following formula:
if PacketsPerSecond.sub.VM>threshold
where PacketsPerSecond.sub.VM is a quantity of network data packets received and transmitted by the virtual machine, the quantity is obtained by the performance monitoring module by means of monitoring, and threshold is a predefined threshold.
(3) If it is determined that the virtual machine is an I/O-intensive virtual machine by using the formula, an NUMA node to which the virtual machine shall be scheduled is further determined by using the following formula:
MAX(Σ.sub.n=0.sup.NMem[n]*ANMMatrix(n))
where n represents an NUMA node; N represents a quantity of NUMA nodes provided by the performance monitoring module; Mem[n] represents a quantity of memory pages that are distributed at the NUMA node n by the virtual machine, and the quantity is provided by the performance monitoring module; and ANMMatrix(n) represents a distance between the NUMA nodes provided by the performance monitoring module. For N NUMA nodes, the algorithm selects a node with the maximum value that is obtained by using the foregoing formula, and schedules the virtual machine to the node.
(4) If the virtual machine is not an I/O-intensive virtual machine, an NUMA node to which the virtual machine shall be scheduled is determined by using the following formula:
Max(Σ.sub.c=0.sup.NΣ.sub.n=0.sup.NCPU[c]*Mem[n]*ANMMatrix(n))
where N represents a quantity of NUMA nodes of the host machine, CPU[c] represents CPU usage of the virtual machine at a node c, Mem[n] represents a quantity of memory pages that are distributed at an NUMA node n by the virtual machine, and ANMMatrix(n) represents a distance between the NUMA nodes provided by the performance monitoring module. For N NUMA nodes, the algorithm calculates a value of each node by using the foregoing formula, then selects a node with the maximum value, and schedules the virtual machine to the node.
(5) The algorithm returns the scheduling decision of the virtual machine according to the foregoing process.
(12) The step 1 specifically includes real-time monitoring of performance events, such as CPU usage, memory usage, and I/O usage, of the virtual machine by using a virtual machine monitor (VMM), real-time monitoring of performance events, such as a cache loss ratio of an operating system and cycles per second of executing instructions by the virtual machine, by using the PMU of an operating system kernel, and obtaining the topology information of an NUMA architecture of the host machine. The specific preferred embodiments of the present invention are described in detail above. It should be understood that, a person of ordinary skill in the art may make multiple modifications and variations according to the concept of the present invention without creative efforts. Therefore, a technical solution that is obtained by a person skilled in the art by means of logic analysis or reasoning or by performing limited tests based on the prior art and according to the concept of the present invention shall fall within the protection scope of the claims.