Resource running method and device of virtual machine, processor and electronic equipment

By responding to the target system initialization and determining the target processing core in the virtual machine resource operation method, the problem of slow operation of virtual machine resources is solved, and the effect of online modification of CPU binding information and taking effect in real time is achieved.

CN120045312APending Publication Date: 2025-05-27INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202412000520.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-31
Publication Date
2025-05-27

AI Technical Summary

Technical Problem

The resources of virtual machines are running slowly, and the existing technology cannot modify the binding information of the CPU online and cannot take effect in real time.

Method used

By responding to the initialization of the target system, the current running status of the target virtual machine is determined, and the target processing core is determined from the processing core set, the target processing core is assigned to the target virtual machine, and the resources of the target virtual machine are run on the allocated processing core.

Benefits of technology

It realizes online modification of CPU binding information and takes effect in real time, improving the resource operation speed of the virtual machine.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120045312A_ABST
    Figure CN120045312A_ABST
Patent Text Reader

Abstract

The invention discloses a resource running method and device of a virtual machine, a processor and electronic equipment, and relates to the field of resource scheduling. The method comprises the steps that in response to the fact that initialization of a target system is completed, the current running state of a target virtual machine is determined, and the target virtual machine is an instance running on the target system; based on the current running state, a target processing core is determined from a processing core set, the processing core set comprises at least one processing core, and the target processing core is used for representing the processing core of the resource of the target virtual machine to be run; allocating a target processing core to the target virtual machine; and running resources of the target virtual machine on the allocated target processing core. According to the method and the device, the technical problem of low resource running speed of the virtual machine is solved, and the technical effect of improving the resource running speed of the virtual machine is further achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of resource scheduling, and in particular, to a method, apparatus, processor, and electronic device for resource operation of a virtual machine. Background Art

[0002] In systems such as private clouds and hyper-converged systems, various loads are running, and these loads usually run in virtual machines, and the performance of the virtual machines directly affects the stability of the load operation and the timeliness of load service processing.

[0003] However, after physically isolating the Central Processing Unit (CPU) and then binding it to the virtual machine, the host needs to be restarted to ensure the stability of the load operation and the timeliness of load service processing. Moreover, the above method cannot modify the CPU binding information online and cannot take effect in real time, resulting in the technical problem of slow resource operation speed of the virtual machine.

[0004] In view of the above technical problem of slow resource operation speed of the virtual machine, no effective solution has been proposed yet. Summary of the Invention

[0005] Embodiments of the present invention provide a method, apparatus, processor, and electronic device for resource operation of a virtual machine to at least solve the technical problem of slow resource operation speed of the virtual machine.

[0006] According to one aspect of the embodiments of the present invention, there is provided a method for resource operation of a virtual machine, the method including: determining a current running state of a target virtual machine in response to the target system having completed initialization, where the target virtual machine is an instance running on the target system; determining a target processing core from a set of processing cores based on the current running state, where the set of processing cores includes at least one processing core, and the target processing core is used to represent the processing core for running the resources of the target virtual machine; allocating the target processing core to the target virtual machine; and running the resources of the target virtual machine on the allocated target processing core.

[0007] Optionally, determining the current running state of the target virtual machine in response to the target system having completed initialization includes: determining the target virtual machine from a plurality of virtual machines in response to the target system having completed initialization; and detecting the state of the target virtual machine to obtain the current running state.

[0008] Optionally, determining the target virtual machine from a plurality of virtual machines in response to the target system having completed initialization includes: determining at least one virtual machine having target attributes from a plurality of virtual machines in response to the target system having completed initialization; and determining the at least one virtual machine having target attributes as the target virtual machine.

[0009] Optionally, based on the current running state, determine a target processing core from a set of processing cores, including: in response to the current running state indicating that the target virtual machine is in a powered-on state or a running state, determine a first quantity of the processing cores of the current host corresponding to the target virtual machine, and a second quantity of the processing cores required for the resources to be run by the target virtual machine; based on the first quantity and the second quantity, determine the target processing core from the set of processing cores.

[0010] Optionally, based on the first quantity and the second quantity, determine a target processing core from a set of processing cores, including: in response to the first quantity being greater than or equal to the second quantity, determine, from the processing cores of the current host in the set of processing cores, the processing cores that meet the second quantity, and determine the processing cores that meet the second quantity as the target processing core; in response to the first quantity being less than the second quantity, determine, from the processing cores of the current host and the processing cores of the remaining hosts in the set of processing cores, the processing cores that meet the second quantity, and determine the processing cores that meet the second quantity as the target processing core, where the remaining host is any one of the other hosts except the current host among the multiple hosts.

[0011] Optionally, the method further includes: in response to the current running state indicating that the target virtual machine is in a powered-on state or a running state, create a sub-directory under the parent directory of the target virtual machine, where the name of the sub-directory is the identifier of the target virtual machine; write the attribute information of the target processing core into the list of processing cores corresponding to the sub-directory, where the attribute information includes the quantity of the allocated target processing cores and the location where the target processing cores are located before allocation.

[0012] Optionally, the method further includes: delete the attribute information from the list of processing cores corresponding to the service, where the priority of allocating the target processing core to the service is lower than the priority of allocating the target processing core to the target virtual machine.

[0013] According to one aspect of the embodiments of the present invention, there is provided a resource running device for a virtual machine, and the device may include: a first determination unit, configured to determine the current running state of a target virtual machine in response to the target system having completed initialization, where the target virtual machine is an instance running on the target system; a second determination unit, configured to determine a target processing core from a set of processing cores based on the current running state, where the set of processing cores includes at least one processing core, and the target processing core is used to represent the processing core for running the resources of the target virtual machine; an allocation unit, configured to allocate the target processing core to the target virtual machine; and a running unit, configured to run the resources of the target virtual machine on the allocated target processing core.

[0014] According to another aspect of the embodiments of the present invention, there is also provided a processor. The processor is used to run a program, where when the program is run by the processor, the steps of the resource running method for the virtual machine in the embodiments of the present invention are executed.

[0015] On the other hand, according to an embodiment of the present invention, an electronic device is further provided, including a memory and a processor. A computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps of the method for running resources of a virtual machine in various embodiments of the present invention.

[0016] On the other hand, according to an embodiment of the present invention, a computer-readable storage medium is further provided. The computer-readable storage medium includes a stored program, wherein when the program runs, it controls the device where the computer-readable storage medium is located to execute the steps of the method for running resources of a virtual machine in the embodiment of the present invention.

[0017] On the other hand, according to an embodiment of the present invention, a computer program product is further provided. The computer program product includes a computer program, wherein when the computer program is executed by a processor, it implements the steps of the method for running resources of a virtual machine in the embodiment of the present invention.

[0018] On the other hand, according to an embodiment of the present invention, a computer program product is provided, including a non-volatile computer-readable storage medium. The non-volatile computer-readable storage medium is used to store a computer program, and when the computer program is executed by a processor, it implements the steps of the method for running resources of a virtual machine in the embodiment of the present invention.

[0019] On the other hand, according to an embodiment of the present invention, an embodiment of the present application further provides a computer program. When the computer program is executed by a processor, it implements the steps of the method for running resources of a virtual machine in the above embodiments of the present invention.

[0020] In the embodiment of the present invention, when running the resources of a virtual machine, if the target system has completed initialization, then on the basis of determining the current running state of the target virtual machine, a target processing core can be determined from the set of processing cores. The determined target processing core is allocated to the target virtual machine, and the resources of the target virtual machine are run on the allocated target processing core, thereby achieving the purpose of being able to modify the binding information of the CPU online and taking effect in real time, thus solving the technical problem of slow running speed of the resources of the virtual machine, and further achieving the technical effect of being able to improve the running speed of the resources of the virtual machine. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] The drawings described herein are used to provide a further understanding of the present invention, form a part of this application, and the schematic embodiments of the present invention and their descriptions are used to explain the present invention, and do not constitute an improper limitation to the present invention. In the drawings:

[0022] Figure 1 is a hardware structure block diagram of a terminal device for implementing the method for running resources of a virtual machine in an embodiment of the present application;

[0023] Figure 2 It is a flowchart of a method for resource operation of a virtual machine according to an embodiment of the present invention;

[0024] Figure 3 It is a flowchart of a method for high computing power scheduling and guarantee of a virtual machine according to an embodiment of the present invention;

[0025] Figure 4 It is a schematic diagram of a resource operation device of a virtual machine according to an embodiment of the present invention. Detailed implementation manners

[0026] In the following, embodiments of the present application will be described in detail with reference to the accompanying drawings and in conjunction with the embodiments.

[0027] It should be noted that the terms "first", "second", etc. in the description and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily need to be used to describe a specific order or sequence.

[0028] The method embodiments provided in the embodiments of the present application can be executed in a terminal device or a similar computing device. Taking the operation on a terminal device as an example, Figure 1 It is a hardware structure block diagram of a terminal device for implementing a method for resource operation of a virtual machine according to an embodiment of the present application. As Figure 1 shown, the terminal device may include one or more ( Figure 1 only one is shown in Figure 1 a) processor 102 (the processor 102 may include, but is not limited to, a processing device such as a microcontroller unit (MCU) or a field-programmable gate array (FPGA)) and a memory 104 for storing data. Among them, the above-mentioned terminal device may further include a transmission device 106 for communication functions and an input / output device 108. Those of ordinary skill in the art can understand that Figure 1 the structure shown in Figure 1 is only schematic, and it does not limit the structure of the above-mentioned server device. For example, the server device may further include more or fewer components than those shown in

[0029] The memory 104 can be used to store computer programs, such as software programs and modules of application software, like the computer program corresponding to the resource running method of the virtual machine in the embodiments of the present application. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, implements the above-mentioned method. The memory 104 can include high-speed random access memory, and can also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memories. In some instances, the memory 104 can further include a memory remotely disposed relative to the processor 102, and these remote memories can be connected to the server device through a network. Examples of the above network include but are not limited to the Internet, enterprise intranet, local area network, mobile communication network, and combinations thereof.

[0030] The transmission device 106 is used to receive or send data via a network. Specific examples of the above network can include a wireless network provided by the communication provider of the server device. In one instance, the transmission device 106 includes a network adapter (abbreviated as NIC), which can be connected to other network devices through a base station and thus can communicate with the Internet. In one instance, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0031] Under the above operating environment, the present application provides a Figure 2 resource running method of the virtual machine as shown. Figure 2 It is a flowchart of a resource running method of a virtual machine according to an embodiment of the present invention. The method can include the following steps:

[0032] Step S201, in response to the target system having completed initialization, determine the current running state of the target virtual machine.

[0033] In the technical solution provided in step S201 of the present invention above, the above target virtual machine can be an instance running on the target system. For example, the above target virtual machine can be a virtual machine enabled with high-performance exclusive features, and the above target system can be a virtualized basic operating system (abbreviated as OS). Here, only an example is given and no specific limitation is made.

[0034] In this embodiment, the above current running state can be used to indicate whether the target virtual machine is in a powered-on state or a running state. The above current running state can also be called the running state. Here, only an example is given and no specific limitation is made.

[0035] In this embodiment, in response to the target system having completed initialization, the current running state of the target virtual machine is determined. Optionally, in this embodiment, when the initialization information configuration of the target system has been completed, the state of the target virtual machine is detected, and the current running state of the target virtual machine can be obtained. Among them, the initialization information can be used to indicate whether it is a critical service and application grouping, set the default available CPU core list set for scheduling, and whether to redefine the startup instruction of the virtual machine.

[0036] Optionally, if the critical service and application grouping has been performed, the default available CPU core list set for scheduling has been set, and the startup instruction of the virtual machine has been redefined, it indicates that the initialization information configuration of the target system has been completed. In this case, by detecting the state of the target virtual machine, the current running state of the target virtual machine can be obtained. Among them, the critical service and application grouping can include services such as network service, computing service, storage service, system service, distributed storage service, container engine service, monitoring service, and special virtual machine. There are several subdirectories under the computing service and the special virtual machine parent directory (computeall / , overridevm / ), and each subdirectory corresponds to a running virtual machine, and fine-grained division control is performed through the subdirectories.

[0037] Step S202: Based on the current running state, determine the target processing core from the set of processing cores.

[0038] In the technical solution provided in step S202 of the present invention above, the set of processing cores may include at least one processing core. The target processing core can be used to represent the processing core of the resources for running the target virtual machine. For example, the processing core may be a CPU core.

[0039] In this embodiment, after determining the current running state of the target virtual machine in response to the target system having completed initialization, based on the current running state, the target processing core is determined from the set of processing cores. Optionally, based on determining the current running state of the target virtual machine, it can be determined whether the target virtual machine is in the powered-on state or the running state. If it is determined that the target virtual machine is in the powered-on state or the running state, then the target processing core can be determined from the set of processing cores, that is, the processing core of the resources for running the target virtual machine can be determined.

[0040] Step S203: Allocate the target processing core to the target virtual machine.

[0041] In the technical solution provided in step S203 of the present invention above, after determining the target processing core from the set of processing cores based on the current operating state, the target processing core is allocated to the target virtual machine. Optionally, in this embodiment, based on determining the target processing core, the target processing core is allocated to the target virtual machine. For example, a CPU core is allocated to a virtual machine that has enabled the high-performance exclusive feature.

[0042] Step S204, run the resources of the target virtual machine on the allocated target processing core.

[0043] In the technical solution provided in step S204 of the present invention above, the resources of the above target virtual machine can be used to represent the computing threads of a Virtual Central Processing Unit (VCPU for short).

[0044] In this embodiment, after allocating the target processing core to the target virtual machine, the resources of the target virtual machine are run on the allocated target processing core. Optionally, in this embodiment, based on allocating the target processing core to the target virtual machine, the resources of the target virtual machine are loaded into the resource group of the special virtual machine, and on the allocated target processing core, by calling the resource group, the resources of the target virtual machine can be run. For example, the computing threads of the VCPU are run. Among them, the above resource group can be named with the identification (ID for short) of the virtual machine. For example, the above resource group can be recorded as overridevm / vm_id. This is only for illustration purposes and is not specifically limited.

[0045] In steps S201 to S204 of the present application above, when running the resources of the virtual machine, if the target system has completed initialization, then based on determining the current operating state of the target virtual machine, the target processing core can be determined from the set of processing cores. The determined target processing core is allocated to the target virtual machine, and the resources of the target virtual machine are run on the allocated target processing core. Thus, the purpose of being able to modify the binding information of the CPU online and take effect in real time is achieved, thereby solving the technical problem of the slow running speed of the resources of the virtual machine, and further achieving the technical effect of being able to improve the running speed of the resources of the virtual machine.

[0046] The above method of this embodiment will be further introduced below.

[0047] As an optional embodiment, step S201, in response to the target system having completed initialization, determining the current operating state of the target virtual machine includes: in response to the target system having completed initialization, determining the target virtual machine from multiple virtual machines; detecting the state of the target virtual machine to obtain the current operating state.

[0048] In this embodiment, in response to the target system having completed initialization, a target virtual machine is determined from multiple virtual machines. Optionally, in this embodiment, in the case where the target system has completed initialization information configuration, a target virtual machine can be determined from multiple virtual machines. That is to say, if the CPU core list set that can be used for scheduling by default has been grouped and set for critical services and applications, and the startup instructions of the virtual machine have been redefined, then a target virtual machine can be determined from multiple virtual machines.

[0049] In this embodiment, after determining a target virtual machine from multiple virtual machines in response to the target system having completed initialization, the state of the target virtual machine is detected to obtain the current running state. Optionally, based on determining the target virtual machine, the state of the target virtual machine is detected in this embodiment, and the current running state of the target virtual machine can be obtained. Thus, it can be determined whether the target virtual machine is in the powered-on state or the running state, thereby achieving the purpose of being able to determine the current running state of the target virtual machine, and further achieving the technical effect of being able to ensure the accuracy of the current state of the target virtual machine.

[0050] As an optional embodiment, determining a target virtual machine from multiple virtual machines in response to the target system having completed initialization includes: in response to the target system having completed initialization, determining at least one virtual machine having target attributes from multiple virtual machines; and determining the at least one virtual machine having target attributes as the target virtual machine.

[0051] In this embodiment, the above target attributes can be used to represent high-performance exclusive attributes.

[0052] In this embodiment, in response to the target system having completed initialization, at least one virtual machine having target attributes is determined from multiple virtual machines. Optionally, in the case where the target system has completed initialization information configuration, it is sequentially determined whether each virtual machine has target attributes from multiple virtual machines. If it is determined that a certain virtual machine has target attributes, then the virtual machine having target attributes is recorded until there are no unjudged virtual machines among multiple virtual machines, thereby achieving the purpose of being able to determine at least one virtual machine having target attributes, and further achieving the technical effect of being able to improve the screening accuracy of virtual machines.

[0053] In this embodiment, after determining at least one virtual machine with target attributes from multiple virtual machines in response to the target system having completed initialization, at least one virtual machine with target attributes is determined as the target virtual machine. Optionally, based on determining at least one virtual machine with target attributes, this embodiment determines at least one virtual machine with target attributes as the target virtual machine. For example, at least one virtual machine with the exclusive high-performance attribute is determined as the target virtual machine, thereby achieving the purpose of being able to determine the target virtual machine, and further realizing the technical effect of being able to ensure the rationality of CPU allocation.

[0054] As an optional embodiment, step S202 of determining a target processing core from a set of processing cores based on the current running state includes: in response to the current running state indicating that the target virtual machine is in the powered-on state or the running state, determining a first quantity of the processing cores of the current host corresponding to the target virtual machine, and a second quantity of the processing cores required for the resources to be run by the target virtual machine; and determining the target processing core from the set of processing cores based on the first quantity and the second quantity.

[0055] In this embodiment, after determining the current running state of the target virtual machine in response to the target system having completed initialization, in response to the current running state indicating that the target virtual machine is in the powered-on state or the running state, a first quantity of the processing cores of the current host corresponding to the target virtual machine, and a second quantity of the processing cores required for the resources to be run by the target virtual machine are determined. Optionally, based on determining the current running state of the target virtual machine, it can be determined whether the target virtual machine is in the powered-on state or the running state. If it is determined that the target virtual machine is in the powered-on state or the running state, then the first quantity of the processing cores of the current host corresponding to the target virtual machine, and the second quantity of the processing cores required for the resources to be run by the target virtual machine can be directly accessed from the target system. For example, the quantity of the processing cores of the host where the target virtual machine is located or the target host scheduled, and the current quantity of CPU cores required for the resources to be run by the target virtual machine can be accessed, thereby achieving the purpose of being able to determine the quantity of CPU cores, and further realizing the technical effect of being able to improve the accuracy of calculating the quantity of CPU cores required for the target virtual machine.

[0056] In this embodiment, after determining the first number of processing cores of the current host corresponding to the target virtual machine and the second number of processing cores required for the resources to be run by the target virtual machine in response to the current running state indicating that the target virtual machine is in the powered-on state or the running state, based on the first number and the second number, a target processing core is determined from the set of processing cores. Optionally, in this embodiment, based on the determined first number and second number, the relationship between the determined first number and the second number is judged to obtain a judgment result. According to the obtained judgment result, a target processing core can be determined from the set of processing cores, that is, the processing core for the resources to run the target virtual machine can be determined, thereby achieving the purpose of being able to determine the target processing core, and further realizing the technical effect of being able to improve the accuracy of allocating the target processing core.

[0057] As an optional embodiment, determining a target processing core from the set of processing cores based on the first number and the second number includes: in response to the first number being greater than or equal to the second number, determining, from the processing cores of the current host in the set of processing cores, the processing cores that meet the second number, and determining the processing cores that meet the second number as the target processing cores; in response to the first number being less than the second number, determining, from the processing cores of the current host and the processing cores of the remaining hosts in the set of processing cores, the processing cores that meet the second number, and determining the processing cores that meet the second number as the target processing cores.

[0058] In this embodiment, after determining the first number of processing cores of the current host corresponding to the target virtual machine and the second number of processing cores required for the resources to be run by the target virtual machine in response to the current running state indicating that the target virtual machine is in the powered-on state or the running state, in response to the first number being greater than or equal to the second number, determining, from the processing cores of the current host in the set of processing cores, the processing cores that meet the second number, and determining the processing cores that meet the second number as the target processing cores. Optionally, in this embodiment, based on the determined first number and second number, the relationship between the determined first number and the second number is judged to obtain a judgment result. If the obtained judgment result indicates that the first number is greater than or equal to the second number, then the processing cores that meet the second number can be determined from the processing cores of the current host in the set of processing cores, and the processing cores that meet the second number are determined as the target processing cores, thereby achieving the purpose of being able to determine the target processing core, and further realizing the technical effect of being able to improve the accuracy of allocating the target processing core.

[0059] Optionally, determine the relationship between the number of processing cores of the host where the virtual machine is located or the target host to be scheduled, and the current number of CPU cores required for the resources to be run by the target virtual machine. If it is determined that the number of processing cores of the host where the virtual machine is located or the target host to be scheduled is greater than or equal to the current number of CPU cores, automatically match the same number of available physical CPU cores on the host, that is, preferentially allocate the CPU cores under the same node (numa node) as the target processing cores.

[0060] In this embodiment, the above remaining host can be any one of the other hosts except the current host among the multiple hosts.

[0061] In this embodiment, after determining the first number of processing cores of the current host corresponding to the target virtual machine and the second number of processing cores required for the resources to be run by the target virtual machine in response to the current running state indicating that the target virtual machine is in the powered-on state or the running state, in response to the first number being less than the second number, determine the processing cores that meet the second number from the processing cores of the current host and the processing cores of the remaining hosts in the processing core set, and determine the processing cores that meet the second number as the target processing cores. Optionally, based on the determination of the first number and the second number, this embodiment determines the relationship between the determined first number and the second number, and a judgment result can be obtained. If the obtained judgment result indicates that the first number is less than the second number, the processing cores that meet the second number can be determined from the processing cores of the current host and the processing cores of the remaining hosts in the processing core set, and the processing cores that meet the second number are determined as the target processing cores, thereby achieving the purpose of determining the target processing cores, and further realizing the technical effect of improving the accuracy of allocating the target processing cores.

[0062] Optionally, determine the relationship between the number of processing cores of the host where the virtual machine is located or the target host to be scheduled, and the current number of CPU cores required for the resources to be run by the target virtual machine. If it is determined that the number of processing cores of the host where the virtual machine is located or the target host to be scheduled is less than the current number of CPU cores, allocate the CPU cores under other numa nodes as the target processing cores.

[0063] As an optional embodiment, the method further includes: in response to the current running state indicating that the target virtual machine is in the powered-on state or the running state, create a subdirectory under the parent directory of the target virtual machine; write the attribute information of the target processing cores into the list of processing cores corresponding to the subdirectory.

[0064] In this embodiment, the name of the above subdirectory can be the identifier of the target virtual machine.

[0065] In this embodiment, in response to the current running state indicating that the target virtual machine is in the powered-on state or the running state, a subdirectory is created under the parent directory of the target virtual machine. Optionally, based on determining the current running state of the target virtual machine, it can be determined whether the target virtual machine is in the powered-on state or the running state. If it is determined that the target virtual machine is in the powered-on state or the running state, a subdirectory is created under the parent directory of the target virtual machine. For example, a sub-organization (directory) is created under the parent organization (directory) of the special virtual machine, thereby achieving the purpose of being able to create a subdirectory.

[0066] In this embodiment, the above attribute information may include the number of allocated target processing cores and the location where the target processing cores were located before allocation.

[0067] In this embodiment, in response to the current running state indicating that the target is in the powered-on state or the running state of the virtual machine, after creating a subdirectory under the parent directory of the target virtual machine, the attribute information of the target processing core is written into the list of processing cores corresponding to the subdirectory. Optionally, based on creating the subdirectory, the attribute information of the target processing core can be determined, and the determined attribute information of the above target processing core is written into the list of processing cores corresponding to the subdirectory. For example, the four CPU cores 24 - 27 are written into the available CPU set parameter of the overridevm / vm_id resource organization, thereby achieving the purpose of being able to store the attribute information of the target processing core, and further realizing the technical effect of being able to improve the availability of the attribute information.

[0068] As an optional embodiment, the method further includes: deleting the attribute information from the list of processing cores corresponding to the service.

[0069] In this embodiment, the priority of allocating the target processing core to the service may be lower than the priority of allocating the target processing core to the target virtual machine.

[0070] In this embodiment, the attribute information is deleted from the list of processing cores corresponding to the service. Optionally, in the case where the target processing core has been allocated to the target virtual machine, the attribute information of the target processing core is deleted from the list of processing cores corresponding to the service. For example, the CPU cores exclusive to the target virtual machine are removed from the global record file of the resource grouping of other key services and applications except the special virtual machine, and the current available CPU core list (for example, the available CPU set under computeall / grouping), thereby achieving the purpose of being able to avoid resource contention, and further realizing the technical effect of being able to reduce the frequency of CPU resource contention.

[0071] In an embodiment of the present invention, when running the resources of a virtual machine, if the target system has completed initialization, based on determining the current running state of the target virtual machine, the target processing core can be determined from the processing core set. Allocate the determined target processing core to the target virtual machine, and run the resources of the target virtual machine on the allocated target processing core, thereby achieving the purpose of being able to modify the binding information of the CPU online and taking effect in real time, thus solving the technical problem of slow running speed of the resources of the virtual machine, and further achieving the technical effect of being able to improve the running speed of the resources of the virtual machine.

[0072] The technical solution of the embodiment of the present invention will be illustrated by way of preferred embodiments below.

[0073] In systems such as private clouds and hyper-converged systems, various loads are running, and these loads usually run in virtual machines, and the performance of the virtual machines directly affects the stability of the load operation and the timeliness of the load service processing.

[0074] However, after physically isolating the Central Processing Unit (CPU) and then binding it to the virtual machine, the host needs to be restarted to ensure the stability of the load operation and the timeliness of the load service processing. Moreover, the above method cannot modify the binding information of the CPU online and cannot take effect in real time, resulting in the technical problem of slow running speed of the resources of the virtual machine.

[0075] To solve the above technical problem, an embodiment of the present invention proposes a method for running the resources of a virtual machine. When running the resources of a virtual machine, if the target system has completed initialization, based on determining the current running state of the target virtual machine, the target processing core can be determined from the processing core set. Allocate the determined target processing core to the target virtual machine, and run the resources of the target virtual machine on the allocated target processing core, thereby achieving the purpose of being able to modify the binding information of the CPU online and taking effect in real time, thus solving the technical problem of slow running speed of the resources of the virtual machine, and further achieving the technical effect of being able to improve the running speed of the resources of the virtual machine.

[0076] In this embodiment, by executing the virtual machine high computing power scheduling guarantee method in this application, the determined target processing core can be allocated to the target virtual machine, and the resources of the target virtual machine can be run on the allocated target processing core. For example, Figure 3 is a flowchart of a virtual machine high computing power scheduling guarantee method according to an embodiment of the present invention, as Figure 3 shown, the method may include the following steps:

[0077] Step S301, in the virtualized basic OS, enable the resource control (cgroup) feature and start the CPU controller subsystem.

[0078] In the virtualized basic OS, after enabling the cgroup feature and starting the CPU controller subsystem, step S302 is entered to establish a CPU resource grouping directory for system key services and applications.

[0079] In the technical solution provided in step S302 of the present invention, establishing key service and application groupings may include: services such as network services, computing services, storage services, system services, distributed storage services, container engine services, monitoring services, and special virtual machines. There are several subdirectories under the computing service and special virtual machine parent directories (computeall / , overridevm / ), and each subdirectory corresponds to a running virtual machine, and fine-grained division control is performed through the subdirectories. cpuset\cpu\cpuacct is a resource type of the operating system cgroup control mechanism.

[0080] After establishing the CPU resource grouping directory for system key services and applications, step S303 is entered to set a default available scheduling CPU core list set for the key service and application groupings.

[0081] In the technical solution provided in step S303 of the present invention, all core lists except core 0 and isolated cores are defaultly allocated, that is, all available cores on the host are defaultly allocated. For example, the host is a two-way CPU server, with 28 cores per CPU, for a total of 2 * 28 = 56 cores. 1 - 55 are written into the available CPU set parameters of computeall / , overridevm / , etc. By managing the available CPU core set of the system, the range of CPU cores used for scheduling virtual machines is controlled. Since the available CPU core set of the special virtual machine is a subset of it, and relevant perception and cooperation are required between them, the goal of precise control and scheduling is ultimately achieved. In addition, the settings of the key service and application groupings and the core allocation situation are saved in the global file to ensure effectiveness when restarting.

[0082] After setting a default available scheduling CPU core list set for the key service and application groupings, step S304 is entered to redefine the virtual machine startup instruction.

[0083] In the technical solution provided in step S304 of the present invention above, the purpose of redefinition is to support specifying a default set of CPU core lists that can run the virtual machine when the virtual machine starts, and that each virtual machine is default added to the computeal1 / group when it is initialized, which facilitates subsequent unified management of the virtual machine scheduling under it by modifying the available CPU core list set of the group, and creating a sub-directory named after the unique ID of the virtual machine, for example, computeall / vm_id. Among them, the available CPU core list set of the sub-directory can inherit the available CPU core list set of the parent directory.

[0084] After redefining the virtual machine startup instruction, step S305 is entered to create a management resource management group and set CPU core actions.

[0085] In the technical solution provided in step S305 of the present invention above, if the virtual machine with the high-performance exclusive feature enabled is in the powered-on state or the running state, the setting of the CPU core action takes effect.

[0086] After creating the management resource management group and setting the CPU core actions, step S306 is entered to pre-allocate target CPU cores for the virtual machine with the high-performance exclusive feature enabled.

[0087] In the technical solution provided in step S306 of the present invention above, if the virtual machine is in the shutdown state, only the feature on / off state is recorded at this time. When the virtual machine is in the powered-on state or the running state, based on the host where the virtual machine is located or the target host for scheduling and the current number of CPU cores configured for the current virtual machine, comprehensive calculation and analysis are performed to automatically match the same number of available physical CPU cores on the host, and the CPU cores under the same numa node are preferentially allocated; if the number is not enough, then they are allocated to the CPU cores under other numa nodes. The above on-demand allocation method can avoid ineffective allocation and reduce the possibility of subsequent conflicts, because the cores allocated between virtual machines are not allowed to conflict or overlap and need to be unique. For example, if the virtual machine is configured with 4C8G, 24 - 27 cores are allocated to this virtual machine after calculation.

[0088] After pre-allocating target CPU cores for the virtual machine with the high-performance exclusive feature enabled, step S307 is entered to create a sub-organization (directory) named after the unique identifier ID of the virtual machine under the parent organization (directory) of the special virtual machine after the virtual machine starts, thereby establishing a resource control hierarchy.

[0089] In the technical solution provided in step S307 of the present invention above, the established overridevm / vm_id is used as the resource group for virtual machine computing thread allocation and scheduling subsequently.

[0090] After the virtual machine is started, a sub-organization (directory) named after the virtual machine's unique identification ID is established under the special virtual machine parent organization (directory). After the resource control hierarchy is established, step S308 is entered to set the available CPU list set parameters within the virtual machine's resource control group.

[0091] In the technical solution provided in the above step S308 of the present invention, the available CPU list set parameters in the resource control group of the virtual machine are set. For example, the CPU core list used by overridevm / vm_id is set, wherein the content of the list is the CPU core list automatically allocated and recorded when the high-performance exclusive feature is enabled for the virtual machine. For example, the four CPU cores 24-27 are written into the available CPU set parameters of the overridevm / vm_id resource organization, that is, when the virtual machine is scheduled to run, these CPU cores will always be used to carry computing tasks.

[0092] After setting the available CPU list set parameters in the resource control group of the virtual machine, proceed to step S309 to remove the CPU core exclusively used by the target virtual machine from the resource grouping global record file of other key services and applications except the special virtual machine, as well as the current available CPU core list.

[0093] In the technical solution provided in the above step S309 of the present invention, the program running on the exclusive CPU core will release and exit the exclusive CPU core during the next scheduling, so that these CPUs are in an idle state and other CPUs are used to run services. That is, when critical services and applications are scheduled, they will only be scheduled between other available CPU cores and will no longer be scheduled to run on the exclusive CPU core.

[0094] For example, if the host is a server with two CPUs, each with 28 cores, a total of 2*28=56 cores, the aforementioned 24-27 cores are already dedicated to a certain exclusive virtual machine, and the other available cores are 1-23 CPU cores and 28-55 CPU cores, which can be used to run system services and other virtual machines and are globally shared. At the same time, update the system's key services and the global configuration file of the application resource grouping, where the global configuration file of the resource grouping can record the changes in the exclusive CPU cores and the newly configured exclusive CPU cores to ensure that they will automatically take effect at the next restart.

[0095] After the CPU core exclusively used by the target virtual machine is removed from the resource grouping global record file of other key services and applications except the special virtual machine and the currently available CPU core list, step S310 is entered to delete the invalid or expired cache corresponding to the exclusive CPU core.

[0096] In the technical solution provided in step S310 of the present invention above, since the cache originally running on the dedicated CPU core may be accessed by other programs, almost all of them will trigger cache misses. Therefore, the above deletion operation can avoid the performance jitter caused by additional cache miss misses.

[0097] After deleting the invalid or expired cache of the dedicated CPU core, step S311 is entered to switch and set the VCPU computing thread of the virtual machine to run under the overridevm / vm_id resource group.

[0098] In the technical solution provided in step S311 of the present invention above, the CPU cores of the overridevm / vm_id resource group are viewed and only the VCPU computing threads will run, and no other programs will run. Therefore, there will be no CPU resource competition, which can reduce context switching and improve the cache hit rate, thereby significantly improving the computing performance. At the same time, update the system key services and the global configuration file of the application resource grouping to ensure automatic effectiveness after the next restart.

[0099] After switching and setting the VCPU computing thread of the virtual machine to run under the overridevm / vm_id resource group, step S312 is entered to migrate services during the virtual machine life cycle management.

[0100] In the technical solution provided in step S312 of the present invention above, during the virtual machine life cycle management, the following services are migrated: online computing / whole machine migration, resource management grouping, exclusive configuration, etc. Among them, the location of the CPU core used may be different from that of the source host, and it needs to be recalculated and obtained according to the recorded dedicated CPU parameters of the virtual machine and the CPU core usage of the destination host, and repeated execution and effectiveness are performed on the new host according to the above steps S301 to S311.

[0101] In this embodiment, when running the resources of the virtual machine, if the target system has completed initialization, based on determining the current running state of the target virtual machine, the target processing core can be determined from the processing core set. Allocate the determined target processing core to the target virtual machine, and run the resources of the target virtual machine on the allocated target processing core, thereby achieving the purpose of being able to modify the binding information of the CPU online and being able to take effect in real time, thus solving the technical problem of slow running speed of the resources of the virtual machine, and further realizing the technical effect of being able to improve the running speed of the resources of the virtual machine.

[0102] Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by means of software plus a necessary general hardware platform. Of course, it can also be implemented by hardware, but in many cases, the former is a better implementation method. Based on such an understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in various embodiments of the present application.

[0103] In this embodiment, a resource operation device for a virtual machine is further provided. This device is used to implement the above embodiments and preferred implementation methods, and those that have been described will not be repeated. As used below, the term "module" can be a combination of software and / or hardware that can implement a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementation in hardware, or a combination of software and hardware is also possible and contemplated.

[0104] Figure 4 is a schematic diagram of a resource operation device for a virtual machine according to an embodiment of the present invention. As Figure 4 shown, the resource operation device 400 for the virtual machine may include: a first determination unit 401, a second determination unit 402, an allocation unit 403, and an operation unit 404.

[0105] The first determination unit 401 is configured to determine the current running state of the target virtual machine in response to the target system having completed initialization, where the target virtual machine is an instance running on the target system.

[0106] The second determination unit 402 is configured to determine a target processing core from a set of processing cores based on the current running state, where the set of processing cores includes at least one processing core, and the target processing core is used to represent the processing core for running the resources of the target virtual machine.

[0107] The allocation unit 403 is configured to allocate the target processing core to the target virtual machine.

[0108] The operation unit 404 is configured to run the resources of the target virtual machine on the allocated target processing core.

[0109] Optionally, the first determination unit 401 may include: a first determination module, configured to determine the target virtual machine from multiple virtual machines in response to the target system having completed initialization; and a detection module, configured to detect the state of the target virtual machine to obtain the current running state.

[0110] Optionally, the first determination module may include: a first determination sub-module, configured to determine at least one virtual machine with target attributes from multiple virtual machines in response to the target system having completed initialization; a second determination sub-module, configured to determine the at least one virtual machine with target attributes as the target virtual machine.

[0111] Optionally, the second determination unit 402 may include: a second determination module, configured to determine a first quantity of processing cores of the current host corresponding to the target virtual machine and a second quantity of processing cores required for the resources to be run by the target virtual machine in response to the current running state indicating that the target virtual machine is in a powered-on state or a running state; a third determination module, configured to determine target processing cores from a set of processing cores based on the first quantity and the second quantity.

[0112] Optionally, the third determination module may include: a fourth determination sub-module, configured to determine processing cores that meet the second quantity from the processing cores of the current host in the set of processing cores and determine the processing cores that meet the second quantity as the target processing cores in response to the first quantity being greater than or equal to the second quantity; a fifth determination sub-module, configured to determine processing cores that meet the second quantity from the processing cores of the current host and the processing cores of the remaining hosts in the set of processing cores and determine the processing cores that meet the second quantity as the target processing cores in response to the first quantity being less than the second quantity, where the remaining hosts are any of the other hosts except the current host among the multiple hosts.

[0113] Optionally, the resource running device 400 of the virtual machine may further include: a creation unit, configured to create a sub-directory under the parent directory of the target virtual machine in response to the current running state indicating that the target virtual machine is in a powered-on state or a running state, where the sub-directory is named with the identifier of the target virtual machine; a writing unit, configured to write the attribute information of the target processing cores into the list of processing cores corresponding to the sub-directory, where the attribute information includes the quantity of the allocated target processing cores and the location where the target processing cores were located before allocation.

[0114] Optionally, the resource running device 400 of the virtual machine may further include: a deletion unit, configured to delete the attribute information from the list of processing cores corresponding to the service, where the priority of allocating the target processing cores to the service is lower than the priority of allocating the target processing cores to the target virtual machine.

[0115] In this embodiment, the following units are deployed in the resource running device of the virtual machine: a first determination unit, configured to determine the current running state of the target virtual machine in response to the target system having completed initialization, where the target virtual machine is an instance running on the target system; a second determination unit, configured to determine a target processing core from a set of processing cores based on the current running state, where the set of processing cores includes at least one processing core, and the target processing core is used to represent the processing core for running the resources of the target virtual machine; an allocation unit, configured to allocate the target processing core to the target virtual machine; and a running unit, configured to run the resources of the target virtual machine on the allocated target processing core. Thus, the purpose of being able to modify the binding information of the CPU online and making it take effect in real time is achieved, thereby solving the technical problem of slow running speed of the resources of the virtual machine, and further achieving the technical effect of being able to improve the running speed of the resources of the virtual machine.

[0116] It should be noted that the above-mentioned various modules can be implemented by software or hardware. For the latter, it can be achieved in the following ways, but not limited to this: the above-mentioned modules are all located in the same processor; or, the above-mentioned various modules are respectively located in different processors in any combination form.

[0117] An embodiment of the present application also provides a computer-readable storage medium, in which a computer program is stored, and the computer program is configured to execute the steps in any one of the above method embodiments when running.

[0118] In an exemplary embodiment, the above computer-readable storage medium may include, but is not limited to: USB flash drives, read-only memories (ROM for short), random access memories (RAM for short), mobile hard disks, magnetic disks, or optical discs, etc., various media that can store computer programs.

[0119] An embodiment of the present application also provides an electronic device, including a memory and a processor, where a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0120] In an exemplary embodiment, the above electronic device may further include a transmission device and an input / output device, where the transmission device is connected to the above processor, and the input / output device is connected to the above processor.

[0121] An embodiment of the present application also provides a computer program product, where the computer program product includes a computer program, and the computer program, when executed by a processor, implements the steps in any one of the above method embodiments.

[0122] Embodiments of the present application further provide another computer program product, including a non-volatile computer-readable storage medium storing a computer program, where the computer program, when executed by a processor, implements the steps in any of the above method embodiments.

[0123] Embodiments of the present application also provide a computer program, which includes computer instructions stored in a computer-readable storage medium; a processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the steps in any of the above method embodiments.

[0124] Specific examples in this embodiment may refer to the examples described in the above embodiments and exemplary embodiments, and will not be repeated here.

[0125] Obviously, those skilled in the art should understand that the above modules or steps of the present application can be implemented by a general-purpose computing device. They can be concentrated on a single computing device or distributed on a network composed of multiple computing devices. They can be implemented by program codes executable by the computing device. Thus, they can be stored in a storage device and executed by the computing device. And in some cases, the steps shown or described can be executed in a different order than here, or they can be separately made into individual integrated circuit modules, or multiple modules or steps among them can be made into a single integrated circuit module to implement. In this way, the present application is not limited to any specific combination of hardware and software.

[0126] The above are only the preferred embodiments of the present application and are not used to limit the present application. For those skilled in the art, the present application can have various changes and modifications. Any modification, equivalent replacement, improvement, etc. made within the principle of the present application shall be included in the protection scope of the present application.

Claims

1. A method for running virtual machine resources, characterized in that: include: In response to the target system having completed initialization, determining a current running state of a target virtual machine, wherein the target virtual machine is an instance running on the target system; Based on the current running state, determining a target processing core from a processing core set, wherein the processing core set includes at least one processing core, and the target processing core is used to represent a processing core of a resource to run the target virtual machine; Allocating the target processing core to the target virtual machine; The resources of the target virtual machine are run on the allocated target processing core.

2. The method according to claim 1, in response to the target system having completed initialization, determining the current running state of the target virtual machine comprises: In response to the target system having completed initialization, determining the target virtual machine from a plurality of virtual machines; The state of the target virtual machine is detected to obtain the current running state.

3. The method according to claim 2, characterized in that In response to the target system having completed initialization, determining the target virtual machine from a plurality of virtual machines includes: In response to the target system having completed initialization, determining at least one virtual machine having a target attribute from the plurality of virtual machines; At least one virtual machine having the target attribute is determined as the target virtual machine.

4. The method according to claim 1, characterized in that: Determining a target processing core from a set of processing cores based on the current running state includes: In response to the current running state indicating that the target virtual machine is in a powered-on state or a running state, determining a first number of processing cores of a current host corresponding to the target virtual machine and a second number of processing cores required for the target virtual machine to run the resource; The target processing core is determined from a set of processing cores based on the first number and the second number.

5. The method according to claim 4, characterized in that Determining the target processing core from a set of processing cores based on the first number and the second number includes: In response to the first number being greater than or equal to the second number, determining a processing core that satisfies the second number from the processing cores of the current host in the processing core set, and determining the processing core that satisfies the second number as the target processing core; In response to the first number being less than the second number, a processing core that satisfies the second number is determined from the processing cores of the current host and the processing cores of the remaining hosts in the processing core set, and a processing core that satisfies the second number is determined as the target processing core, wherein the remaining hosts are any host among the multiple hosts except the current host.

6. The method according to claim 1, characterized in that The method further comprises: In response to the current running state indicating that the target virtual machine is in a powered-on state or a running state, a subdirectory is created under the parent directory of the target virtual machine, wherein the subdirectory is named as the identifier of the target virtual machine; The attribute information of the target processing core is written into the list of processing cores corresponding to the subdirectory, wherein the attribute information includes the number of the allocated target processing cores and the position of the target processing core before allocation.

7. The method according to claim 6, characterized in that The method further comprises: The attribute information is deleted from a list of processing cores corresponding to a service, wherein the priority of assigning the target processing core to the service is lower than the priority of assigning the target processing core to the target virtual machine.

8. A resource operation device for a virtual machine, characterized in that: include, a first determining unit, configured to determine a current state of a target virtual machine in response to the target system having completed initialization, wherein the target virtual machine is an instance running on the target system; A second determining unit, configured to determine a target processing core from a processing core set based on the current running state, wherein the processing core set includes at least one processing core, and the target processing core is used to represent a processing core of a resource to run the target virtual machine; an allocating unit, configured to allocate the target processing core to the target virtual machine; The running unit is used to run the resources of the target virtual machine on the allocated target processing core.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method described in any one of claims 1 to 7 are implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method described in any one of claims 1 to 7 are implemented.