Resource thermal adjustment method and device and electronic equipment
By dynamically adjusting the permission status of the virtual machine to the resource in the host, the problem of business interruption during the adjustment of virtual machine resources is solved, and the thermal adjustment and efficient utilization of virtual machine resources are achieved.
Patent Information
- Application Number
- CN202411918603.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-24
- Publication Date
- 2025-04-08
AI Technical Summary
When the virtual machine needs to be adjusted during operation, the existing technology needs to shut down before the resources can be adjusted, resulting in business interruption.
By responding to the resource adjustment requirements of the virtual machine in the host, dynamically adjusting the permission status of the virtual machine to the host resource, thereby achieving thermal adjustment of resources without interrupting the operation of the virtual machine.
Dynamic adjustment of virtual machine resources is realized, business interruption during resource adjustment is avoided, and virtual machine resource utilization efficiency and system reliability are improved.
Smart Images

Figure CN119781905A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of cloud computing technology, and in particular to a resource thermal adjustment method, device, and electronic device. Background Art
[0002] During the operation of a virtual machine, due to changes in business requirements, it is necessary to adjust the resources of the virtual machine (such as virtual processor VCPU, memory, etc.).
[0003] Currently, when a virtual machine is running, if it is necessary to adjust the resources of the virtual machine, mainly when it is necessary to reduce the capacity of the resources of the virtual machine, the virtual machine needs to be shut down first, and then the resources of the virtual machine need to be adjusted. However, when the virtual machine is shut down, the business of the virtual machine will be interrupted. Summary of the invention
[0004] Based on the above technical problems, the present application provides a resource hot adjustment method, device, and electronic device for solving the technical problem that when adjusting the resources of a virtual machine, the virtual machine needs to be shut down, which will cause the interruption of the business running on the virtual machine.
[0005] In a first aspect, the present application provides a resource hot adjustment method, which is applied to a host machine, and the host machine includes at least one virtual machine. The method includes: determining a resource adjustment target in response to a resource adjustment demand corresponding to a target virtual machine in the host machine. In accordance with the resource adjustment target indication, increase a first resource, and set the target virtual machine's permission state to the first resource to an enabled state; and / or, in accordance with the resource adjustment target indication, reduce a second resource, and set the target virtual machine's permission state to the second resource to a disabled state; wherein the target virtual machine is configured to run based on the enabled host machine resources, and the host machine resources include the first resource and the second resource.
[0006] By determining the resource adjustment target, the first resource that needs to be increased and / or the second resource that needs to be reduced based on the available resources of the current target virtual machine are clarified. Based on this, since the permission status of the target virtual machine to the host machine resources can be dynamically adjusted, the permission status of the target virtual machine to the first resource and / or the second resource is dynamically adjusted according to the resource adjustment target. In this way, whether in the demand for resource expansion or resource reduction, there is no need to shut down the target virtual machine, and the permission status of the target virtual machine to the host machine resources can be adjusted, thereby realizing the hot adjustment of the resources of the target virtual machine.
[0007] In a possible implementation, for the target virtual machine, the upper limit of the number of host machine resources in the enabled state is the upper limit of the number of resources on the host machine used to run at least one virtual machine. In this way, since all resources in the host machine resources provided to the target virtual machine can be set to the enabled state, the upper limit of the number of host machine resources is the upper limit of the number of resources on the host machine used to run all virtual machines, that is, the upper limit of the number of available resources on the host machine that can be configured for all virtual machines is clarified. In this way, there is no need for users to configure by themselves, and the upper limit of the available resources of the target virtual machine is increased.
[0008] In one possible implementation, increasing the first resource according to the resource adjustment target indication and setting the target virtual machine's permission state to the first resource to an enabled state includes: resource binding the first resource to the target virtual machine. Reducing the second resource according to the resource adjustment target indication and setting the target virtual machine's permission state to the second resource to a disabled state includes: resource unbinding the second resource from the target virtual machine.
[0009] By binding the first resource with the target virtual machine, configuring the first resource as an available resource of the target virtual machine, and / or unbinding the second resource from the target virtual machine, canceling the available permission of the target virtual machine to the resource, the permission of the target virtual machine to the host machine resources is adjusted, thereby realizing hot adjustment of the resources of the target virtual machine.
[0010] In a possible implementation, the resource adjustment requirement includes a first target quantity. In response to the resource adjustment requirement corresponding to the target virtual machine, determining the resource adjustment target includes: if the first target quantity is greater than the second target quantity, then according to the second target quantity and the first target quantity, the first quantity of the first resource is increased and determined as the resource adjustment target; the second target quantity is the number of resources in the resource configuration information at the current moment that are in an enabled state. If the first target quantity is less than the second target quantity, then according to the second target quantity and the first target quantity, the second quantity of the second resource is reduced and determined as the resource adjustment target.
[0011] In this way, for the target virtual machine, if the first target number is greater than the second target number and resources need to be increased, the first resource increased by the first number is determined as the resource adjustment target. If the first target number is less than the second target number and resources need to be reduced, the second resource reduced by the second number is determined as the resource adjustment target. In this way, the resource adjustment target can be accurately determined, so that the adjusted available resources of the target virtual machine can meet the resource adjustment requirements of the target virtual machine.
[0012] In a possible implementation, reducing the second resource according to the resource adjustment target indication and setting the permission state of the target virtual machine to the second resource to a disabled state includes: determining a second number of second resources whose usage rate meets the preset disable condition from the resources in the enabled state. Setting the second number of second resources to a disabled state. In this way, the second number of second resources whose usage rate meets the disable condition is disabled by using the usage rate of the resources in the enabled state, thereby realizing intelligent resource reduction, reducing the resource context switching time of the services in the target virtual machine, and improving the efficiency of resource adjustment.
[0013] In a possible implementation, the method further includes: in response to the start-up of the target virtual machine, according to the third target number, setting the permission state of the target virtual machine to the third resource to an enabled state. The third target number represents the number of host machine resources that are in an enabled state during the start-up of the target virtual machine, and the third target number is greater than or equal to the second target number. In this way, a larger number of resources is allocated when starting the target virtual machine, which speeds up the start-up of the virtual machine, provides services more quickly, and can quickly restore services in the event of a failure.
[0014] In a possible implementation, in response to the resource adjustment demand corresponding to the target virtual machine in the host machine, before determining the resource adjustment target, it also includes: in response to the completion of the startup of the target virtual machine, generating a resource adjustment demand. The resource adjustment demand includes a first target quantity, and the first target quantity is a first preset quantity. In this way, after the startup is successful, by adjusting the third resource quantity to the first preset quantity, the resource capacity of the target virtual machine is reduced, and the resources of the reduced target virtual machine can meet the resource usage demand of the target virtual machine.
[0015] In a possible implementation, the target virtual machine includes multiple virtual non-uniform memory access architecture VNUMA nodes, and each VNUMA node runs based on the host machine resources in the enabled state. Indicating the increase of the first resource according to the resource adjustment target, setting the permission state of the target virtual machine to the first resource to the enabled state includes: determining the resources to be enabled from the resources currently in the disabled state on each VNUMA node according to the number of the multiple VNUMA nodes and the number of the first resources. The first resource includes the resources to be enabled corresponding to each VNUMA node. For each VNUMA node, the permission state of the resources to be enabled is set to the enabled state.
[0016] In this way, for each VNUMA node, the resources to be enabled corresponding to each VNUMA node are determined, and the resources to be enabled corresponding to each VNUMA node are set to an enabled state. In this way, by determining the resources to be enabled corresponding to each VNUMA node, when the target virtual machine increases available resources, the host machine resources are evenly allocated to multiple VNUMA nodes, and the resource hot adjustment of the target virtual machine including multiple VNUMA nodes is realized, specifically, resource expansion, thereby improving the performance of the target virtual machine.
[0017] In a possible implementation, the target virtual machine includes multiple virtual non-uniform memory access architecture VNUMA nodes, and each VNUMA node runs based on the host machine resources in an enabled state. Reducing the second resource according to the resource adjustment target indication, setting the target virtual machine's permission state for the second resource to an enabled state includes: determining the resources to be disabled from the resources currently in an enabled state on each VNUMA node according to the number of multiple VNUMA nodes and the number of second resources. The second resources include the resources to be disabled corresponding to each VNUMA node. For each NUMA node, the permission state of the resources to be disabled is set to a disabled state.
[0018] In this way, for each VNUMA node, the resources to be disabled corresponding to each VNUMA node are determined, and the resources to be disabled corresponding to each VNUMA node are set to an enabled state. In this way, by determining the resources to be disabled corresponding to each VNUMA node, when reducing available resources, the target virtual machine relatively and evenly reduces the available resources of each VNUMA node, thereby achieving resource hot adjustment of the target virtual machine including multiple VNUMA nodes, specifically resource shrinkage, thereby improving the performance of the target virtual machine.
[0019] In one possible implementation, the host includes a non-uniform memory access architecture NUMA node, and each NUMA node includes a second preset number of host resources. In response to a resource adjustment demand corresponding to a target virtual machine in the host, determining the resource adjustment target also includes: in response to a request to create a target virtual machine, determining the number of VNUMA nodes included in the target virtual machine and the host resources corresponding to each VNUMA node. The number of VNUMA nodes is consistent with the number of NUMA nodes on the host. According to the fourth target number in the request, the number to be enabled on each VNUMA node is determined; from the host resources corresponding to each VNUMA node, the permission state of the resources to be enabled is set to an enabled state, and the permission state of the remaining resources is set to a disabled state.
[0020] In this way, when creating a target virtual machine, relatively balanced host machine resources are allocated to each VNUMA node, thereby improving the performance of the target virtual machine.
[0021] In a possible implementation, the host machine resources include central processing unit (CPU) resources and memory resources, and the CPU resources include virtual processors (VCPUs). In this way, resource allocation and adjustment of the target virtual machine are achieved based on the host machine resources.
[0022] In a second aspect, the present application provides a resource thermal adjustment device, which includes: a determination module and a setting module.
[0023] The determination module is used to determine a resource adjustment target in response to a resource adjustment demand corresponding to a target virtual machine in the host machine.
[0024] The setting module is used to increase the first resource according to the resource adjustment target indication, and set the target virtual machine's permission state for the first resource to an enabled state; and / or, reduce the second resource according to the resource adjustment target indication, and set the target virtual machine's permission state for the second resource to a disabled state.
[0025] The target virtual machine is configured to run based on enabled host machine resources, where the host machine resources include a first resource and a second resource.
[0026] In a third aspect, the present application provides an electronic device, the electronic device comprising a processor and a memory. The memory stores instructions executable by the processor. When the processor is configured to execute the instructions, the electronic device implements the method of the first aspect.
[0027] In a fourth aspect, the present application provides a computer program product. When the computer program product is executed in an electronic device, the electronic device executes the method related to the first aspect to implement the method of the first aspect.
[0028] In a fifth aspect, the present application provides a readable storage medium, the readable storage medium comprising: software instructions. When the software instructions are executed in an electronic device, the electronic device implements the method of the first aspect.
[0029] The beneficial effects of the second to fifth aspects mentioned above can be referred to the first aspect and will not be elaborated on again. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0031] Figure 1 A schematic diagram of the structure of a cloud platform provided in an embodiment of the present application;
[0032] Figure 2 A schematic diagram of the composition of an electronic device provided in an embodiment of the present application;
[0033] Figure 3 A schematic diagram of a process flow of a resource thermal adjustment method provided in an embodiment of the present application;
[0034] Figure 4 A schematic diagram of a target virtual machine before and after resource adjustment provided in an embodiment of the present application;
[0035] Figure 5 A schematic diagram of another target virtual machine before and after resource adjustment provided in an embodiment of the present application;
[0036] Figure 6 A schematic diagram of a target virtual machine provided in an embodiment of the present application;
[0037] Figure 7 A schematic diagram of the composition of a resource thermal adjustment device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0038] In order to enable ordinary persons in the art to better understand the technical solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings.
[0039] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. On the contrary, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the attached claims.
[0040] In addition, in the description of the embodiments of the present application, unless otherwise specified, " / " means or, for example, A / B can mean A or B. "And / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present application, "multiple" means two or more than two.
[0041] In the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.
[0042] During the operation of a virtual machine, due to changes in business requirements, it is necessary to adjust the resources of the virtual machine, where the resources of the virtual machine may be a VCPU (i.e., CPU virtualization technology, the CPU in the virtual machine relative to the physical CPU), memory on the virtual machine, and the like.
[0043] Take the virtual machine resource as VCPU as an example. If the number of available VCPUs of the virtual machine at the current moment is 2, and the upper limit of the available VCPUs of the virtual machine is 8. When configuring the resources of the virtual machine, the configuration can be specifically expressed as:<VCPUplacement='static'current='2'> 8. However, since the CPU itself only supports hot-plugging (i.e., CPU expansion) and does not support hot-plugging (i.e., CPU reduction), if the VCPU of a virtual machine needs to be adjusted during the operation of the virtual machine, mainly for the scenario of VCPU reduction of the virtual machine, and the scenario of resource expansion and resource reduction of the virtual machine including the virtual non-uniform memory access architecture VNUMA node, it is necessary to shut down the virtual machine first, and then adjust the number of VCPUs of the virtual machine based on the upper limit of the number of available VCPUs of the virtual machine. However, when shutting down the virtual machine, the business running on the virtual machine will be interrupted.
[0044] In view of the above problems, an embodiment of the present application provides a resource hot adjustment method, and resource hot adjustment may refer to the ability to dynamically adjust the resources of a virtual machine (such as VCPU, memory, etc., and the resources of the virtual machine below take VCPU as an example) in real time during the operation of the virtual machine without interrupting the normal operation of the virtual machine. Resource hot adjustment may include resource expansion (such as VCPU expansion, i.e., increasing VCPU; memory expansion, i.e., increasing memory) and resource reduction (such as VCPU reduction, i.e., reducing VCPU; memory reduction, i.e., reducing memory). The method is applied to a host machine, and the host machine includes at least one virtual machine. The method includes: determining a resource adjustment target in response to a resource adjustment demand corresponding to a target virtual machine in the host machine. In accordance with the resource adjustment target indication, increase the first resource, and set the permission state of the target virtual machine to the first resource to an enabled state; and / or, in accordance with the resource adjustment target indication, reduce the second resource, and set the permission state of the target virtual machine to the second resource to a disabled state. Among them, the target virtual machine is configured to run based on the host machine resources in an enabled state, and the host machine resources include the first resource and the second resource.
[0045] In this way, by determining the resource adjustment target, the first resource that needs to be increased and / or the second resource that needs to be reduced based on the available resources of the current target virtual machine are clarified. Based on this, since the permission status of the target virtual machine to the host machine resources can be dynamically adjusted, the permission status of the target virtual machine to the first resource and / or the second resource is dynamically adjusted according to the resource adjustment target. In this way, whether in the demand for resource expansion or resource reduction, there is no need to shut down the target virtual machine, and the permission status of the target virtual machine to the host machine resources can be adjusted, thereby realizing the hot adjustment of the resources of the target virtual machine.
[0046] The resource thermal adjustment method provided in the embodiment of the present application is described in detail below with reference to the accompanying drawings.
[0047] The resource hot adjustment method provided in the embodiment of the present application can be applied to a host machine, which includes at least one virtual machine and a virtualization processing module.
[0048] The host machine can be an independent host machine or any host machine in the cloud platform. Figure 1 A schematic diagram of the structure of a cloud platform is shown. Figure 1 As shown, the cloud platform includes multiple host machines. For example, the cloud platform integrates and manages the resources of multiple host machines to build a computing resource pool. After the hardware resources of the host machine are virtualized, one or more virtual machines are created, such as the open source system virtualization module tool (kernel-based virtual machine, KVM). Among them:
[0049] A virtualization processing module is used to determine a resource adjustment target in response to a resource adjustment demand corresponding to a target virtual machine in a host machine. The virtualization processing module is also used to increase a first resource according to the resource adjustment target indication, and set the target virtual machine's permission state to the first resource to an enabled state; and / or, reduce a second resource according to the resource adjustment target indication, and set the target virtual machine's permission state to the second resource to a disabled state. The target virtual machine is configured to run based on the host machine resources in an enabled state, and the host machine resources include the first resource and the second resource.
[0050] In one implementation, resource usage information is stored in the virtualization processing module, and the resource usage information is used to record the permission status of each resource in each target virtual machine host resource.
[0051] In some embodiments, the virtualization processing module is further used to set the permission state of the target virtual machine to the third resource to an enabled state according to the third target number in response to the startup of the target virtual machine. The third target number represents the number of host machine resources that are in an enabled state during the startup of the target virtual machine, and the third target number is greater than or equal to the second target number.
[0052] In some embodiments, the virtualization processing module is further used to generate a resource adjustment requirement in response to completion of the startup of the target virtual machine. The resource adjustment requirement includes a first target quantity, which is a first preset quantity.
[0053] In some embodiments, the host machine includes non-uniform memory access architecture (NUMA) nodes, and each NUMA node includes a second preset number of host machine resources.
[0054] In one implementation, the virtualization processing module is further used to determine the number of VNUMA nodes included in the target virtual machine and the host machine resources corresponding to each VNUMA node in response to a request indicating the creation of a target virtual machine. The number of VNUMA nodes is consistent with the number of NUMA nodes on the host machine. The virtualization processing module is also used to determine the number of resources to be enabled on each VNUMA node according to the fourth target number in the request. The virtualization processing module is also used to set the permission state of the resources to be enabled to an enabled state from the host machine resources corresponding to each VNUMA node, and set the permission state of the remaining resources to a disabled state.
[0055] That is, if the host machine includes one NUMA node, the target virtual machine includes one NUMA node, that is, the VNUMA node is a complete target virtual machine. If the host machine includes multiple NUMA nodes, the target virtual machine also includes NUMA nodes, which requires the host machine resources in the enabled state on each VNUMA node in the target virtual machine.
[0056] In some embodiments, the cloud platform also includes an application programming interface (API) gateway receiving module for obtaining resource adjustment requirements and / or a request to create a target virtual machine.
[0057] In some embodiments, the cloud platform further includes a resource scheduling module, which is used to obtain host machine resources in response to a request sent by the API gateway receiving module to instruct the creation of a target virtual machine, and is also used to send the host machine resources to the virtualization processing module.
[0058] In other embodiments, before acquiring the host machine resources, the resource scheduling module is further used to determine a target host machine from a plurality of host machines and obtain the host machine resources of the target host machine.
[0059] In some embodiments, the cloud platform further includes a monitoring module for monitoring the usage of available resources of the current target virtual machine.
[0060] The embodiments of the present application do not limit the form of the cloud platform. Specifically, the cloud platform can run on electronic devices. The electronic device can be a mobile phone, a tablet computer, a handheld computer, a personal computer (PC), a cellular phone, a personal digital assistant (PDA), a wearable device (such as a smart watch, a smart bracelet, etc.), a smart furniture device (such as a TV, etc.), a car computer (such as a car computer, etc.), a smart screen, a laptop computer, a desktop computer or an all-in-one computer, etc. The electronic device can also be a server or a server cluster. Among them, the server can be a physical server or a virtualization platform. The server can be a physical server, or it can be two or more physical servers that share different responsibilities, and each physical server cooperates with each other to realize the various functions of the server.
[0061] Exemplarily, the server may be a blade server, a high-density server, a rack server, a tower server, or the like.
[0062] It should be noted that the system architecture and application scenarios described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. Ordinary technicians in this field can know that with the evolution of the system architecture and the emergence of new business scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0063] Figure 2 The following is a schematic diagram of the composition of the electronic device provided in the embodiment of the present application. Figure 2As shown, the electronic device may include: a processor 20 , a memory 21 , a communication line 22 , a communication interface 23 , and an input / output interface 24 .
[0064] The processor 20 , the memory 21 , the communication interface 23 and the input / output interface 24 may be connected via a communication line 22 .
[0065] The processor 20 is used to execute instructions stored in the memory 21 to implement the resource thermal adjustment method provided in the following embodiments of the present application. The processor 20 can be a CPU, a general-purpose processor network processor (network processor, NP), a digital signal processor (digital signal processing, DSP), a microprocessor, a microcontroller (micro control unit, MCU) / single chip microcomputer (single chip microcomputer), a programmable logic device (programmable logic device, PLD) or any combination thereof. The processor 20 can also be any other device with processing functions, such as a circuit, a device or a software module, which is not limited in the embodiments of the present application. In one example, the processor 20 may include one or more CPUs, such as Figure 2 As an optional implementation, the server may include multiple processors, for example, in addition to processor 20, it may also include processor 25 ( Figure 2 The dashed line is used as an example.
[0066] The memory 21 is used to store instructions. For example, the instructions may be computer programs. Optionally, the memory 21 may be a read-only memory (ROM) or other types of static storage devices that can store static information and / or instructions, or a random access memory (RAM) or other types of dynamic storage devices that can store information and / or instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), a magnetic disk storage medium or other magnetic storage devices, etc., and the embodiments of the present application are not limited to this.
[0067] It should be noted that the memory 21 may exist independently of the processor 20, or may be integrated with the processor 20. The memory 21 may be located inside the server, or may be located outside the server, which is not limited in the embodiment of the present application.
[0068] The communication line 22 is used to transmit information between the components included in the server.
[0069] The communication interface 23 is used to communicate with other devices or other communication networks. The other communication networks may be Ethernet, radio access network (RAN), wireless local area network (WLAN), etc. The communication interface 23 may be a module, a circuit, a transceiver or any device capable of achieving communication.
[0070] The input / output interface 24 is used to implement human-computer interaction between the user and the server, for example, to implement action interaction or information interaction between the user and the server.
[0071] Exemplarily, the input / output interface 24 may be a mouse, a keyboard, a display screen, or a touch display screen, etc. Action interaction or information interaction between a user and a server may be achieved through a mouse, a keyboard, a display screen, or a touch display screen, etc.
[0072] It should be noted that Figure 2 The structure shown in the figure does not constitute a limitation on the electronic device, except Figure 2 In addition to the components shown, the electronic device may include more or fewer components than shown, or a combination of certain components, or a different arrangement of components.
[0073] The following is an introduction to the resource thermal adjustment method provided in the embodiment of the present application.
[0074] Figure 3 A schematic diagram of a resource hot adjustment method provided in an embodiment of the present application. The resource hot adjustment method provided in an embodiment of the present application is applied to a host machine, which includes at least one virtual machine. Figure 1 The cloud platform shown is executed, specifically by a virtualization processing module in the cloud platform. The method includes: S301-S302.
[0075] S301. A virtualization processing module determines a resource adjustment target in response to a resource adjustment demand corresponding to a target virtual machine in a host machine.
[0076] Exemplarily, the resource adjustment requirement includes a first target number. Specifically, the first target number may represent the target number to which the available resources of the target virtual machine are adjusted. For example, the resource of the target virtual machine is VCPU, and the first target number is 4, that is, the resource adjustment requirement indicates that the number of available VCPUs of the target virtual machine needs to be adjusted to 4. In this way, the resource adjustment requirement clarifies that the available resources of the target virtual machine need to be adjusted to a specific number to meet the actual resource requirements of the target virtual machine.
[0077] In some embodiments, the resource adjustment requirement is determined based on a user instruction.
[0078] Exemplarily, the API gateway receiving module receives a user instruction, the user instruction includes a resource adjustment requirement, and the API gateway receiving module sends the resource adjustment requirement to the virtualization processing module.
[0079] In other embodiments, the resource adjustment requirement is determined based on the usage of available resources of the current target virtual machine.
[0080] Exemplarily, the available resources of the target virtual machine represent the resources that the target virtual machine can use, that is, the resources in the host machine resources that are in an enabled state for the target virtual machine, which is also equivalent to the host machine resources whose permission state is in an enabled state in the resource usage information.
[0081] The resource usage information is used to record the permission status of each resource in the host resources of each target virtual machine. Exemplarily, for the target virtual machine, the upper limit of the number of host resources in the enabled state is the upper limit of the number of resources on the host used to run at least one virtual machine. It can be understood that the host resources can represent the upper limit of the available resources of the target virtual machine.
[0082] This is because all resources in the host resources of the target virtual machine can be set to the enabled state. Therefore, the upper limit of the number of host resources is the upper limit of the number of resources on the host used to run all virtual machines, that is, the upper limit of the number of available resources on the host that are allowed to be configured for all virtual machines is clarified. In this way, the upper limit of the available resources of the target virtual machine is increased. In other words, for the target virtual machine, the permission state of each resource in the host resources can be adjusted dynamically. For example, if the permission state of the target virtual machine to the resources in the host resources is set to the enabled state, it means that the resources in the enabled state are available resources for the target virtual machine, that is, the resources in the enabled state are allocated to the target virtual machine for use. If the permission state of the target virtual machine to the resources in the host resources is set to the disabled state, it means that the resources in the disabled state are unavailable resources for the target virtual machine.
[0083] Exemplarily, the target virtual machine is configured to run based on the host machine resources in the enabled state. In this way, by dynamically adjusting the permission state of the host machine resources, it is possible to dynamically adjust the available resources of the target virtual machine.
[0084] Exemplarily, the host machine resources include CPU resources and memory resources, and the CPU resources include VCPU. In this way, resource allocation and adjustment of the target virtual machine are achieved based on the host machine resources.
[0085] It should be noted that the host resources can correspond to multiple virtual machines, that is, the host resources are provided to multiple virtual machines. However, for different virtual machines, the permission status of each resource in the host resources can be different, and the same resource in the host resources is usually only allocated to one virtual machine for use. For example, the host resources are CPU resources. After the host CPU is provided to the virtual machine, it is represented as a host VCPU. If the number of VCPUs is 8, they are identified as VCPU0-VCPU7 in sequence. The host includes two virtual machines. Then all 8 VCPUs can be provided to the two virtual machines. The difference is: for virtual machine 1, if the available VCPUs of virtual machine 1 are 2, VCPU0 and VCPU1 can be set to enabled state, and the remaining VCPUs (VCPU2-VCPU7) can be set to disabled state. For virtual machine 2, if the available VCPUs of virtual machine 2 are also 2, VCPU2 and VCPU3 can be set to enabled state, and the remaining VCPUs (VCPU0-VCPU1, and VCPU4-VCPU7) can be set to disabled state.
[0086] In one implementation, the monitoring module monitors the usage of available resources of the current target virtual machine (such as usage rate), and then determines resource adjustment requirements based on the usage of available resources of the current target virtual machine, and sends the resource adjustment requirements to the virtualization processing module.
[0087] In another implementation, the monitoring module monitors the usage of the available resources of the current target virtual machine and sends the usage of the available resources of the current target virtual machine to the virtualization processing module, which determines the resource adjustment requirement according to the usage of the available resources of the current target virtual machine.
[0088] Optionally, if there are available resources whose usage rate meets the preset disabling condition among the available resources of the target virtual machine, the resource adjustment demand may represent adjusting (specifically reducing) the available resources to the first target quantity. And / or, if there are available resources whose usage rate meets the preset enabling condition among the available resources of the target virtual machine, the resource adjustment demand may represent adjusting (specifically increasing) the available resources to the first target quantity.
[0089] Exemplarily, the preset disabling condition may be set as a usage rate being less than a first preset usage rate.
[0090] Exemplarily, the preset activation condition may be set as a usage rate greater than a second preset usage rate, wherein the second preset usage rate is greater than the first preset usage rate.
[0091] In the embodiment of the present application, if the usage rate of the available resource meets the preset disabling condition, it indicates that the available resource is an unnecessary resource (such as less used or not used), so the resource adjustment requirement indicates to adjust (specifically reduce) the available resource to the first target amount. If the usage rate of the available resource meets the preset enabling condition, it indicates that the usage of the available resource is close to saturation, so the resource adjustment requirement indicates to adjust (specifically increase) the available resource to the first target amount to avoid excessive resource usage load.
[0092] In some embodiments, the virtualization processing module determines the resource adjustment target in response to the resource adjustment demand corresponding to the target virtual machine, including: if the first target quantity is greater than the second target quantity, then according to the second target quantity and the first target quantity, the first resource is increased by the first quantity and determined as the resource adjustment target. If the first target quantity is less than the second target quantity, then according to the second target quantity and the first target quantity, the second resource is reduced by the second quantity and determined as the resource adjustment target.
[0093] Exemplarily, the host machine resources include a first resource and a second resource. In this way, by adjusting the permission status of the target virtual machine to the host machine resources (specifically the first resource and / or the second resource), the available resources of the target virtual machine can be dynamically adjusted.
[0094] It is understandable that, for the target virtual machine, a part of the host machine resources are resources in an enabled state, and the other part are resources in a disabled state. Based on this, the first resource represents a first number of resources in the disabled state of the host machine resources. In other words, the first resource is determined from the disabled state of the host machine resources, and the permission state of the target virtual machine to the first resource needs to be adjusted to an enabled state to enable the target virtual machine to use the first resource. The second resource represents a second number of resources in the enabled state of the host machine resources. In other words, the second resource is determined from the enabled state of the host machine resources, and the permission state of the target virtual machine to the second resource needs to be adjusted to a disabled state to disable the second resource by the target virtual machine.
[0095] In an embodiment of the present application, when the first target number is greater than the second target number, it indicates that the available resources of the target virtual machine need to be increased, that is, the first number of first resources that need to be adjusted to an enabled state need to be determined from the host machine resources whose permission status is in a disabled state, and used as resource adjustment targets. When the first target number is less than the second target number, it indicates that the available resources of the target virtual machine need to be reduced, that is, the second number of second resources that need to be adjusted to a disabled state need to be determined from the host machine resources whose permission status is in an enabled state, and used as resource adjustment targets. In this way, the resource adjustment target can be accurately determined, so that the adjusted available resources of the target virtual machine can meet the resource adjustment requirements of the target virtual machine.
[0096] In one implementation, if the target virtual machine's resource is a VCPU, then the permission status of one VCPU in each target virtual machine's available VCPU cannot be adjusted and is enabled by default. In this way, the target virtual machine always has a stable VCPU, ensuring the stable operation of the core business on the target virtual machine.
[0097] In some embodiments, according to the second target quantity and the first target quantity, determining the first resource to be increased by the first quantity as the resource adjustment target includes: taking the difference between the second target quantity and the first target quantity as the first quantity. Determining the first quantity of the first resource from the host machine resources that are currently in a disabled state. In this way, the first quantity of the first resource can be accurately determined.
[0098] In one implementation, determining a first quantity of first resources from host resources that are currently in a disabled state includes: sorting the host resources that are currently in a disabled state according to resource identifiers; based on the sorting order, selecting the first quantity of host resources that are ranked first and use them as the first resources. For example, for the target virtual machine, when the permission status of VCPU0 and VCPU1 is in an enabled state, if it is necessary to increase the first quantity (such as the first quantity is 2), select the top 2 VCPUs from the host resources that are currently in a disabled state, namely VCPU2 and VCPU3, and use VCPU2 and VCPU3 as the first resources. In this way, the permission status of the target virtual machine for the host resources can be adjusted more clearly and orderly.
[0099] In another implementation, determining a first quantity of first resources from host resources that are currently in a disabled state includes: selecting a first quantity of host resources with a first preset identifier from the host resources that are currently in a disabled state, and using them as the first resources. Exemplarily, the first preset identifier (specifically, ID) can be a resource of the host resources that are currently in a disabled state specified by the user. For example, for the target virtual machine, when VCPU0 and VCPU1 are in an enabled state, if it is necessary to increase the first quantity (such as the first quantity is 2), the first preset identifier is VCPU3 and VCPU4, then 2 VCPUs are selected from the host resources that are currently in a disabled state, namely: VCPU3 and VCPU4, as the first resources. In this way, determining the first quantity of first resources can be more efficient and in line with actual needs.
[0100] In some embodiments, according to the second target quantity and the first target quantity, reducing the second quantity of the second resource and determining it as the resource adjustment target includes: taking the difference between the second target quantity and the first target quantity as the second quantity. Determining the second quantity of the second resource from the host machine resources that are currently enabled. In this way, the second quantity of the second resource can be accurately determined.
[0101] In one implementation, determining the second quantity of second resources from the host resources that are currently enabled includes: sorting the host resources that are currently enabled according to resource identifiers; based on the sorting order, selecting the second quantity of host resources that are ranked lower and use them as the second resources. For example, when the permission status of VCPU0, VCPU1, and VCPU2 is enabled, if it is necessary to reduce the second quantity (2), select two VCPUs that are ranked lower from the host resources that are currently enabled, namely: VCPU1 and VCPU2, and use VCPU1 and VCPU2 as the second quantity of second resources. In this way, the permission status of each resource can be adjusted more clearly and orderly. At the same time, VCPU0 is used as the VCPU whose permission status cannot be adjusted and remains enabled.
[0102] In another implementation, determining a second quantity of second resources from the host resources currently in an enabled state includes: selecting a second quantity of host resources with a second preset identifier from the host resources currently in an enabled state, and using them as the second resources. Exemplarily, the second preset identifier (specifically, ID) can be a resource in the host resources currently in an enabled state specified by the user. For example, when the permission status of VCPU0, VCPU1, VCPU2, and VCPU3 is in an enabled state, if the second quantity (2) needs to be reduced, and the second preset identifier is VCPU1 and VCPU3, then 2 VCPUs are determined from the host resources currently in an enabled state, namely: VCPU1 and VCPU3, and VCPU1 and VCPU3 are used as the second quantity of second resources. In this way, determining the second quantity of second resources can be more efficient and in line with actual needs.
[0103] In another implementation, if the first target number is less than the second target number, the second number of host resources whose usage rate meets the preset disabling condition is determined from the currently enabled host resources as the second number of second resources. In this way, the second number of host resources with a lower usage rate or unused among the enabled host resources are preferentially determined as the resource adjustment targets that need to be reduced, thereby realizing intelligent resource reduction, reducing the resource context switching time of the business in the target virtual machine, and improving the efficiency of resource adjustment.
[0104] Exemplarily, the preset disabling condition may be set as the usage rate being less than the first preset usage rate. Alternatively, the preset disabling condition may be the first second number of second resources in the order in which the resources in the enabled state are sorted from small to large in terms of usage rate.
[0105] For example, if the number of host machine VCPUs in the resource usage information is 8, and the identifiers of the 8 VCPUs are VCPU0-VCPU7, the number of VCPUs in the resource usage information whose permission status is enabled is 4, and their identifiers are VCPU0-VCPU3, and the number of VCPUs in the permission status is disabled is 4, and their identifiers are VCPU4-VCPU7. When the resource adjustment requirement is to reduce the number of VCPUs of the target virtual machine to 2, the resource adjustment target is 2 (the second number) VCPUs in the enabled permission status (such as VCPU2 and VCPU3). Among them, the permission status of VCPU0 cannot be adjusted, and current represents the number of VCPUs that are currently enabled, that is, the number of available VCPUs of the target virtual machine. The adjusted resource usage information is as follows:
[0106]
[0107] S302, the virtualization processing module increases the first resource according to the resource adjustment target indication, and sets the permission state of the first resource of the target virtual machine to the enabled state; and / or reduces the second resource according to the resource adjustment target indication, and sets the permission state of the target virtual machine to the second resource to the disabled state.
[0108] In some embodiments, the virtualization processing module increases the first resource according to the resource adjustment target indication, and setting the permission state of the target virtual machine to the first resource to an enabled state includes: resource binding the first resource with the target virtual machine.
[0109] In the embodiment of the present application, by binding the first resource with the target virtual machine, the first resource is configured as an available resource of the target virtual machine, so as to adjust the permissions of the target virtual machine to the host machine resources, thereby realizing hot adjustment of the resources of the target virtual machine.
[0110] In some embodiments, the virtualization processing module reduces the second resource according to the resource adjustment target indication, and setting the permission state of the target virtual machine to the second resource to a disabled state includes: unbinding the second resource from the target virtual machine.
[0111] In the embodiment of the present application, the second resource is unbound from the target virtual machine, and the target virtual machine's available authority to the resource is cancelled, so that the target virtual machine's authority to the host machine's resources is adjusted, thereby achieving hot adjustment of the target virtual machine's resources.
[0112] In some embodiments, reducing the second resource according to the resource adjustment target indication and setting the permission state of the target virtual machine to the second resource to a disabled state includes: determining a second number of second resources whose usage rates meet a preset disabling condition from the resources in the enabled state, and setting the second number of second resources to a disabled state.
[0113] In an embodiment of the present application, by using the utilization rate of resources in an enabled state, the second resources whose utilization rate meets the disabling condition are disabled, thereby realizing intelligent resource scaling, reducing the resource context switching time of the business in the target virtual machine, and improving the efficiency of resource adjustment.
[0114] In some embodiments, the method further includes: in response to the start-up of the target virtual machine, the virtualization processing module sets the permission state of the target virtual machine to the third resource to an enabled state according to the third target quantity.
[0115] The third target number indicates the number of host machine resources that are enabled during the startup of the target virtual machine, and the third target number is greater than or equal to the second target number.
[0116] In the embodiment of the present application, during the startup process of the target virtual machine, the permission state of the third resource (specifically, the resource corresponding to the third target quantity) is set to the startup state. Based on this, when the target virtual machine is started, the permission state of the target virtual machine to the third resource is set to the enabled state. In this way, a larger number of resources is allocated when the target virtual machine is started, the startup of the virtual machine is accelerated, the service is provided faster, and the service can be quickly restored in the event of a failure.
[0117] In some embodiments, the virtualization processing module responds to the resource adjustment requirements corresponding to the target virtual machine in the host machine, and before determining the resource adjustment target, it also includes: responding to the completion of the startup of the target virtual machine, generating a resource adjustment requirement. The resource adjustment requirement includes a first target quantity, and the first target quantity is a first preset quantity.
[0118] Exemplarily, the first preset number can be set to the fourth target number in the request indicating the creation of the target virtual machine. It is understandable that the first preset number is mainly used in the scenario of resource reduction after the target virtual machine is started. In this scenario, the first target number is the first preset number, that is, the fourth target number in the request. In other scenarios, the first target number may be greater than the first preset number (the target virtual machine has a high demand for resources and needs to be expanded), and the first target number may be less than the first preset number (the target virtual machine has a low demand for resources and needs to be reduced).
[0119] For example, the third target number is 7, and the fourth target number is 5. Thus, after the target virtual machine is started, there is a need to reduce the number of resources from 7 to 5. Therefore, the virtualization processing module can subsequently execute steps of responding to the resource adjustment requirements corresponding to the target virtual machine, determining the resource adjustment target, and reducing the second resource according to the resource adjustment target indication, and setting the target virtual machine's permission status for the second resource to a disabled state.
[0120] In an embodiment of the present application, after successful startup, the resources of the target virtual machine are scaled down by adjusting the third resource quantity to the first preset quantity (such as the fourth target quantity), and the resources of the scaled-down target virtual machine can meet the resource usage requirements of the target virtual machine.
[0121] In some embodiments, the target virtual machine includes a plurality of virtual non-uniform memory access architecture (VNUMA) nodes, and each VNUMA node operates based on enabled host machine resources.
[0122] In one implementation, increasing the first resource according to the resource adjustment target indication and setting the permission state of the target virtual machine to the first resource to an enabled state includes: determining the resources to be enabled from the resources currently in a disabled state on each VNUMA node according to the number of multiple VNUMA nodes and the number of the first resources. The first resources include the resources to be enabled corresponding to each VNUMA node. For each VNUMA node, setting the permission state of the resources to be enabled to an enabled state.
[0123] In the embodiment of the present application, for each VNUMA node, the resources to be enabled corresponding to each VNUMA node are determined, and the resources to be enabled corresponding to each VNUMA node are set to an enabled state. In this way, by determining the resources to be enabled corresponding to each VNUMA node, when the target virtual machine increases the available resources, the host machine resources are evenly allocated to multiple VNUMA nodes, and the resource hot adjustment of the target virtual machine including multiple VNUMA nodes is realized, specifically, the resource expansion, thereby improving the performance of the target virtual machine.
[0124] Optionally, determining the resources to be enabled from the resources currently in a disabled state on each VNUMA node according to the number of the plurality of VNUMA nodes and the number of the first resource comprises: determining the number of resources to be increased on each VNUMA node according to the number of the plurality of VNUMA nodes and the number of the first resource. Determining the resources to be enabled from the resources currently in a disabled state on each VNUMA node.
[0125] In the embodiment of the present application, for each VNUMA node of the target virtual machine, first, the number to be increased on each VNUMA node is determined, so as to determine the resources to be enabled corresponding to the number to be increased on each VNUMA node. In this way, the resources to be enabled on each VNUMA node can be determined more accurately and reasonably.
[0126] Exemplarily, according to the number of multiple VNUMA nodes and the number of the first resource, determining the number to be added on each VNUMA node includes: obtaining a first calculation result of the number of the first resource / the number of multiple VNUMA nodes. If the first calculation result is an integer, the integer of the first calculation result is determined as the number to be added on each VNUMA node. In this way, the number to be added determined in this way is equivalent to evenly allocating the first resource to multiple VNUMA nodes, so that the number of available resources on each VNUMA node remains balanced.
[0127] like Figure 4 As shown, an embodiment of the present application provides a schematic diagram of a target virtual machine before and after resource adjustment. Figure 4In the example, the target virtual machine includes two VNUMA nodes, namely VNUMA0 and VNUMA1, wherein the available resources on VNUMA0 are: VCPU0, the available resources on VNUMA1 are: VCPU4, and the memory of each VNUMA node is 4G. Based on this, if the number of first resources is 2, then the calculation result of the number of first resources / the number of multiple VNUMA nodes is 1, and the number to be added on each VNUMA node is 1, and one resource to be enabled (such as VCPU1, VCPU5) needs to be determined from the resources currently in the disabled state on each VNUMA node.
[0128] Exemplarily, if the first calculation result is not an integer, the integer part of the first calculation result is used as the number to be added on the first node, and (X+1) is used as the number to be added on the second node, where X is the integer part of the first calculation result. In this way, when the first resource cannot be completely evenly distributed to each VNUMA node, the first resource can still be relatively evenly distributed to multiple VNUMA nodes.
[0129] The multiple VNUMA nodes include first nodes and second nodes, the number of the second nodes is Y, Y is the remainder of the first calculation result, and the first nodes are all nodes in the multiple VNUMA nodes except the second nodes.
[0130] Specifically, the second node is Y VNUMA nodes whose available resource quantity meets the first preset quantity condition among the multiple VNUMA nodes. The first preset quantity condition indicates that the available resource quantity is small. For example, if there are three VNUMA nodes, VNUMA0, VNUMA1, and VNUMA2, the available resources of VNUMA0 are 2, the available resources of VNUMA1 are 3, and the available resources of VNUMA2 are 3. If Y is 2, the second node includes VNUMA0 and any one of VNUMA1 and VNUMA2.
[0131] For example, the target virtual machine includes three VNUMA nodes, namely VNUMA0, VNUMA1, and VNUMA2, wherein the available resources on VNUMA0 are VCPU0, the available resources on VNUMA1 are VCPU4, and the available resources on VNUMA2 are VCPU8. Based on this, if the number of the first resource is 8. Then, the first calculation result is 2 more than 2 (not an integer), the number of the second nodes is 2 (can be any two of VNUMA0, VNUMA1, and VNUMA2), and the number of the first node is 1. Based on this, the number to be increased on the first node is 2 (the integer part of the first calculation result), and the number to be increased on the second node is 3 (X+1).
[0132] Exemplarily, determining the resources to be enabled to be increased on each VNUMA node from the resources currently in a disabled state on each VNUMA node includes: determining the resources corresponding to the number to be increased on each VNUMA node from the resources currently in a disabled state on each VNUMA node by random selection or by a user-specified method, and using them as the resources to be enabled. Alternatively, the resources currently in a disabled state on each VNUMA node are sorted according to resource identifiers, and based on the sorting order, the resources to be increased with the highest sorting are selected and used as the resources to be enabled. In this way, the resources to be enabled can be determined more flexibly.
[0133] In one implementation, reducing the second resource according to the resource adjustment target indication and setting the permission state of the target virtual machine to the second resource to an enabled state includes: determining the resources to be disabled from the resources currently in an enabled state on each VNUMA node according to the number of multiple VNUMA nodes and the number of second resources. The second resources include the resources to be disabled corresponding to each VNUMA node. For each NUMA node, setting the permission state of the resources to be disabled to a disabled state.
[0134] In the embodiment of the present application, for each VNUMA node, the resources to be disabled corresponding to each VNUMA node are determined, and the resources to be disabled corresponding to each VNUMA node are set to an enabled state. In this way, by determining the resources to be disabled corresponding to each VNUMA node, when the target virtual machine reduces the available resources, the available resources of each VNUMA node are relatively balanced, and the resource hot adjustment of the target virtual machine including multiple VNUMA nodes is realized, specifically, resource shrinkage, thereby improving the performance of the target virtual machine.
[0135] Optionally, determining the resources to be disabled from the resources currently enabled on each VNUMA node according to the number of the plurality of VNUMA nodes and the number of the second resources includes: determining the number to be reduced on each VNUMA node according to the number of the plurality of VNUMA nodes and the number of the second resources. Determining the resources to be disabled from the resources currently enabled on each VNUMA node.
[0136] In the embodiment of the present application, for each VNUMA node of the target virtual machine, first, the number to be reduced on each VNUMA node is determined, so as to determine the resources to be disabled corresponding to the number to be reduced on each VNUMA node. In this way, the resources to be disabled on each VNUMA node can be determined more accurately and reasonably.
[0137] Exemplarily, according to the number of multiple VNUMA nodes and the number of the second resource, determining the number to be reduced on each VNUMA node includes: obtaining a second calculation result of the number of the second resource / the number of multiple VNUMA nodes. If the second calculation result is an integer, the integer of the second calculation result is determined as the number to be reduced on each VNUMA node. In this way, the number to be reduced determined in this way is a balanced reduction of the second resource from multiple VNUMA nodes, so that the number of available resources on each VNUMA node remains balanced.
[0138] like Figure 5 As shown, an embodiment of the present application provides another schematic diagram of a target virtual machine before and after resource adjustment. Figure 5 In the figure, the target virtual machine includes two VNUMA nodes, namely VNUMA0 and VNUMA1, where the available resources on VNUMA0 are: VCPU0 and VCPU1, and the available resources on VNUMA1 are: VCPU4 and VCPU5, and the memory of each VNUMA node is 4G. Based on this, if the number of second resources is 2. Then, the calculation result of the number of second resources / the number of multiple VNUMA nodes is 1, and the number to be reduced on each VNUMA node is 1. It is necessary to determine 1 resource to be disabled from the resources currently enabled on each VNUMA node. The resources to be disabled in the figure are VCPU1 and VCPU5.
[0139] Exemplarily, if the second calculation result is not an integer, the integer part of the second calculation result is used as the number to be reduced on the third node, and (Z+1) is used as the number to be reduced on the fourth second node, where Z is the integer part of the second calculation result. In this way, when the second resource cannot be completely evenly reduced from each VNUMA node, a relatively balanced reduction of the second resource can still be achieved for multiple VNUMA nodes.
[0140] The multiple VNUMA nodes include a third node and a fourth node, the number of the fourth nodes is P, P is the remainder part of the second calculation result, and the third node is all nodes in the multiple VNUMA nodes except the fourth node.
[0141] Specifically, the fourth node is P VNUMA nodes whose available resource quantity meets the second preset quantity condition among the multiple VNUMA nodes. The second preset quantity condition indicates that the available resource quantity is relatively large. For example, if there are three VNUMA nodes, VNUMA0, VNUMA1, and VNUMA2, the available resources of VNUMA0 are 4, the available resources of VNUMA1 are 5, and the available resources of VNUMA2 are 4. If P is 2, the second nodes are VNUMA0 and VNUMA2.
[0142] For example, the target virtual machine includes three VNUMA nodes, namely VNUMA0, VNUMA1, and VNUMA2, wherein the available resources on VNUMA0 are VCPU0, VCPU1, VCPU2, and VCPU3, the available resources on VNUMA1 are VCPU4, VCPU5, VCPU6, and VCPU7, and the available resources on VNUMA1 are VCPU8, VCPU9, VCPU10, and VCPU11. Based on this, if the number of the second resource is 7. Then, the second calculation result is 2 more than 1 (not an integer), then the number of the fourth node is 1 (the remainder of the second calculation result), and the number of the third node is 2. Based on this, the number to be reduced on the third node is 2 (the integer part of the second calculation result), and the number to be reduced on the fourth node is 3 (Z+1).
[0143] Exemplarily, determining the resources to be reduced and disabled on each VNUMA node from the resources currently enabled on each VNUMA node includes: determining the resources corresponding to the number to be reduced on each VNUMA node from the resources currently enabled on each VNUMA node by random selection or user-specified method, and using them as the resources to be disabled. Alternatively, sorting the resources currently enabled on each VNUMA node according to resource identifiers, and based on the sorting order, selecting the resources to be reduced with a lower sorting order, and using them as the resources to be disabled. Alternatively, determining the usage of available resources on each VNUMA node, and using the available resources with a lower usage rate to be reduced on each VNUMA node as the resources to be disabled. In this way, the resources to be disabled can be determined more flexibly.
[0144] In some embodiments, the host includes a non-uniform memory access architecture NUMA node, each NUMA node includes a second preset number of host resources. The NUMA node is composed of a group of CPUs and local memory, and the CPUs in the same NUMA node can achieve optimal performance when accessing the local memory.
[0145] Exemplarily, the second preset number can be set according to the number of host resources and NUMA nodes. For example, if the result of host resources / NUMA node number is an integer, the second preset number is the host resources / NUMA node number.
[0146] In one implementation, the virtualization processing module responds to the resource adjustment demand corresponding to the target virtual machine in the host machine, and before determining the resource adjustment target, it also includes: in response to a request to instruct the creation of a target virtual machine, determining the number of VNUMA nodes included in the target virtual machine and the host machine resources corresponding to each VNUMA node. The number of VNUMA nodes is consistent with the number of NUMA nodes on the host machine. According to the fourth target number in the request, the number to be enabled on each VNUMA node is determined. From the host machine resources corresponding to each VNUMA node, the permission state of the resources of the number to be enabled is set to an enabled state, and the permission state of the remaining resources is set to a disabled state.
[0147] In the embodiment of the present application, it is mainly applied to the scenario where the target virtual machine includes multiple VNUMA nodes. By setting the permission state of the host resources of the number to be enabled to the enabled state for each VNUMA node, when creating a target virtual machine including multiple VNUMA nodes, the resources of the multiple VNUMA nodes are evenly allocated, thereby improving the performance of the target virtual machine.
[0148] Exemplarily, in response to a request for instructing to create a target virtual machine, determining the number of VNUMA nodes included in the target virtual machine and the host resources corresponding to each VNUMA node includes: determining the host resources corresponding to each VNUMA node based on the fourth target number in the request and the number of VNUMA nodes, as well as the correspondence between the resources of the target virtual machine and the host resources. In this way, the host resources corresponding to each VNUMA node can be determined, and the host resources corresponding to each VNUMA node can determine the number of host resources to be enabled, and the host resources are evenly allocated to each VNUMA node, thereby improving the performance of the target virtual machine.
[0149] Exemplarily, the correspondence between the VCPU of the target virtual machine and the CPU of the host machine (expressed as CPUset) is as follows:
[0150]
[0151] It can be understood that each VCPU corresponds to a range of a host machine CPU, which means that the process corresponding to the VCPU of the target virtual machine can be scheduled to the designated mapped host machine CPU.
[0152] In an embodiment of the present application, for a host machine including a NUMA node, a target virtual machine including a VNUMA node is created, so that the VNUMA node of the target virtual machine is configured based on the NUMA of the host machine, and by adjusting the permission status of the host machine resources in each VNUMA node, the host machine resources can be flexibly managed, so that it is convenient to subsequently adjust the resource situation used by the target virtual machine when the target virtual machine is running, thereby realizing hot adjustment of the resources of the target virtual machine.
[0153] Exemplarily, if the host machine resources are 8 VCPUs, the fourth target number is 4, and the number of VNUMA nodes of the target virtual machine is 2, the configuration is as follows:
[0154]
[0155]
[0156] In this way, different from the prior art in which a target virtual machine including multiple VNUMA nodes is created, the quantity of resources in the multiple VNUMA nodes in the target virtual machine is relatively balanced.
[0157] like Figure 6 As shown, an embodiment of the present application provides a schematic diagram of a target virtual machine, wherein the target virtual machine includes two VNUMA nodes, namely VNUMA0 and VNUMA1, wherein the available resources on VNUMA0 are VCPU0 and VCPU1; the available resources on VNUMA1 are VCPU4 and VCPU5, and the memory of each VNUMA node is 4G.
[0158] In some embodiments, the resource hot adjustment method further includes: if the resource adjustment target indicates to increase VCPU resources, then increasing the memory resources of the target virtual machine. And / or, if the resource adjustment target indicates to reduce VCPU resources, then reducing the memory resources of the target virtual machine.
[0159] In an embodiment of the present application, by dynamically adjusting the memory resources of the target virtual machine in a positive correlation according to the VCPU resources of the target virtual machine, the resource configuration of the target virtual machine can be made more in line with its actual operating needs. For example, when increasing the VCPU, the corresponding increase in memory resources can provide sufficient data storage and processing space for the business running on the target virtual machine, thereby improving operating efficiency; and when reducing the VCPU, reducing the memory resources of the target virtual machine can avoid resource waste and improve the overall resource utilization of the host machine. In this way, by dynamically adjusting the memory resources according to the VCPU resources, the target virtual machine can maintain good operating performance under different load conditions, thereby optimizing the virtual machine system.
[0160] In some other embodiments, the target virtual machine includes a VNUMA node. In this way, the VNUMA node can be regarded as a complete target virtual machine.
[0161] In one implementation, in response to a resource adjustment requirement corresponding to a target virtual machine in a host machine, before determining a resource adjustment target, the method further includes: in response to a request indicating creation of a target virtual machine, setting a permission state of a fourth target number of host machine resources in the request to an enabled state.
[0162] In an embodiment of the present application, when creating a target virtual machine, the permission state of the fourth target number of host resources in the request is set to an enabled state, so that the number of available resources of the target virtual machine is the fourth target number, which meets the creation requirements of the target virtual machine. At the same time, by adjusting the permission state of the host resources, the host resources can be flexibly managed, which facilitates the subsequent adjustment of the resources used by the target virtual machine when the target virtual machine is running, thereby realizing hot adjustment of the resources of the target virtual machine.
[0163] Exemplarily, the request to create a target virtual machine indicates the creation of a virtual machine with 2 VCPUs, and the host machine has 8 VCPUs, and the configuration is as follows:
[0164]
[0165] In this way, the available VCPUs of the target virtual machine are controlled by managing the permission status of the VCPU.
[0166] In some embodiments, before the virtualization processing module responds to the request for instructing to create the target virtual machine, the method further includes: obtaining the request for instructing to create the target virtual machine through the resource scheduling module. Determining the target host from multiple host machines according to the request for instructing to create the target virtual machine through the resource scheduling module. Automatically identifying the host machine resources corresponding to the target host through the resource scheduling module. The resource scheduling module sends the host machine resources corresponding to the target host to the virtualization processing module.
[0167] In an embodiment of the present application, the resource scheduling module automatically identifies the host resources (that is, the host resources) corresponding to the target host based on the determined target virtual machine. There is no need for the user to set the upper limit of the available resources of the target virtual machine. Instead, the resource scheduling module automatically identifies the upper limit of the number of available resources allowed to be configured for all virtual machines on the target host as the host resources, thereby increasing the upper limit of the available resources of the target virtual machine.
[0168] Exemplarily, the number of host machine resources of the target host machine is greater than or equal to the fourth target number in the request. In this way, the host machine resources can meet the creation requirements of the target virtual machine.
[0169] In some embodiments, the virtualization processing module responds to resource adjustment requirements corresponding to the target virtual machine in the host machine, and before determining the resource adjustment target, it also includes: in response to a request to create multiple target virtual machines, for each target virtual machine, setting the permission status of the target number of host machine resources corresponding to the target virtual machine in the request to an enabled state.
[0170] In an embodiment of the present application, by setting the permission status of the target number of host machine resources corresponding to the target virtual machine to an enabled state, the available resource requirements of each target virtual machine are met when creating target virtual machines in batches.
[0171] The above mainly introduces the solution provided by the embodiment of the present application from the perspective of the method. In order to achieve the above functions, it includes hardware structures and / or software modules corresponding to the execution of each function. It should be easy to realize that the technical goals in this field are combined with the units and algorithm steps of each example described in the embodiments disclosed in this article, and the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical goals can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0172] In an exemplary embodiment, the present application also provides a resource thermal adjustment device. Figure 7 Schematic diagram of the composition of the resource heat adjustment device 70 provided in the embodiment of the present application. Figure 7 As shown, the resource thermal adjustment device 70 includes: a determination module 701 and a setting module 702 .
[0173] The determination module 701 is used to determine a resource adjustment target in response to a resource adjustment requirement corresponding to a target virtual machine in a host machine.
[0174] Setting module 702 is used to increase the first resource according to the resource adjustment target indication, and set the target virtual machine's permission state for the first resource to an enabled state; and / or, reduce the second resource according to the resource adjustment target indication, and set the target virtual machine's permission state for the second resource to a disabled state.
[0175] The target virtual machine is configured to run based on enabled host machine resources, where the host machine resources include a first resource and a second resource.
[0176] In an exemplary embodiment, the present application also provides a readable storage medium, which includes software instructions. When the software instructions are executed in an electronic device, the electronic device implements the above method.
[0177] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using a software program, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer-executable instructions. When the computer-executable instructions are loaded and executed on a computer, the process or function according to the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer-executable instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer-executable instructions can be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (digital subscriber line, DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that can be integrated with one or more media. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a solid state disk (SSD), etc.
[0178] Although the present application is described herein in conjunction with various embodiments, in the process of implementing the claimed application, those skilled in the art may understand and implement other changes to the disclosed embodiments by viewing the drawings, the disclosure, and the appended claims. In the claims, the word "comprising" does not exclude other components or steps, and "one" or "an" does not exclude multiple situations. A single processor or other unit can implement several functions listed in the claims. Certain measures are recorded in different dependent claims, but this does not mean that these measures cannot be combined to produce good results.
[0179] Although the present application has been described in conjunction with specific features and embodiments thereof, it is obvious that various modifications and combinations may be made thereto without departing from the spirit and scope of the present application. Accordingly, this specification and the drawings are merely exemplary illustrations of the present application as defined by the appended claims, and are deemed to have covered any and all modifications, variations, combinations or equivalents within the scope of the present application. Obviously, those skilled in the art may make various modifications and variations to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
[0180] The above are only specific implementations of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A resource thermal adjustment method, characterized in that: Applied to a host machine, the host machine includes at least one virtual machine; the method includes: In response to a resource adjustment demand corresponding to a target virtual machine in the host machine, determining a resource adjustment target; Indicating an increase in a first resource according to the resource adjustment target, and setting the permission state of the target virtual machine to the first resource to an enabled state; and / or indicating a decrease in a second resource according to the resource adjustment target, and setting the permission state of the target virtual machine to the second resource to a disabled state; The target virtual machine is configured to run based on the enabled host machine resources, and the host machine resources include the first resource and the second resource.
2. The resource heat adjustment method according to claim 1, characterized in that: For the target virtual machine, the upper limit of the number of the enabled host machine resources is the upper limit of the number of resources on the host machine used to run the at least one virtual machine.
3. The resource heat adjustment method according to claim 1, characterized in that: The adding of the first resource according to the resource adjustment target indication and setting the permission state of the target virtual machine to the first resource to an enabled state includes: Binding the first resource to the target virtual machine; The reducing the second resource according to the resource adjustment target indication and setting the permission state of the target virtual machine to the second resource to a disabled state includes: Unbind the second resource from the target virtual machine.
4. The resource thermal adjustment method according to claim 1, characterized in that: The resource adjustment requirement includes a first target quantity; The step of determining a resource adjustment target in response to a resource adjustment requirement corresponding to the target virtual machine includes: If the first target quantity is greater than the second target quantity, then according to the second target quantity and the first target quantity, the first resource is increased by a first quantity and determined as the resource adjustment target; the second target quantity is the quantity of resources in the enabled state in the resource configuration information at the current moment; If the first target quantity is less than the second target quantity, the second resource is reduced by a second quantity according to the second target quantity and the first target quantity, and is determined as the resource adjustment target.
5. The resource thermal adjustment method according to claim 4, characterized in that: The reducing the second resource according to the resource adjustment target indication and setting the permission state of the target virtual machine to the second resource to a disabled state includes: Determining, from the resources in the enabled state, second resources whose usage rates of the second quantity meet a preset disabling condition; The second number of the second resources is set to the disabled state.
6. The resource thermal adjustment method according to claim 1 or 4, characterized in that: The method further comprises: In response to the startup of the target virtual machine, the permission status of the target virtual machine to the third resource is set to an enabled state according to a third target quantity; the third target quantity represents the number of host machine resources that are enabled during the startup of the target virtual machine, and the third target quantity is greater than or equal to the second target quantity.
7. The resource thermal adjustment method according to claim 6, characterized in that: Before determining the resource adjustment target in response to the resource adjustment demand corresponding to the target virtual machine in the host machine, the method further includes: In response to completion of startup of the target virtual machine, the resource adjustment demand is generated; the resource adjustment demand includes a first target quantity, which is a first preset quantity.
8. The resource thermal adjustment method according to claim 1, characterized in that: The target virtual machine includes a plurality of virtual non-uniform memory access architecture VNUMA nodes, each of the VNUMA nodes runs based on the host machine resources in the enabled state; the adding of the first resource according to the resource adjustment target indication and setting the permission state of the target virtual machine to the first resource to the enabled state include: According to the number of the plurality of VNUMA nodes and the number of the first resources, determining resources to be enabled from the resources currently in the disabled state on each of the VNUMA nodes; the first resources include resources to be enabled corresponding to each VNUMA node; For each of the VNUMA nodes, setting the permission state of the resource to be enabled to the enabled state; The reducing the second resource according to the resource adjustment target indication and setting the permission state of the target virtual machine to the second resource to an enabled state includes: According to the number of the plurality of VNUMA nodes and the number of the second resources, determining the resources to be disabled from the resources currently in the enabled state on each of the VNUMA nodes; the second resources include the resources to be disabled corresponding to each VNUMA node; For each NUMA node, the permission state of the resource to be disabled is set to the disabled state.
9. A resource heat adjustment device, characterized in that: Applied to a host machine, the host machine includes at least one virtual machine; the device includes: a determination module and a setting module; The determination module is used to determine a resource adjustment target in response to a resource adjustment demand corresponding to a target virtual machine in the host machine; The setting module is used to increase the first resource according to the resource adjustment target indication, and set the permission state of the target virtual machine to the first resource to an enabled state; and / or reduce the second resource according to the resource adjustment target indication, and set the permission state of the target virtual machine to the second resource to a disabled state; The target virtual machine is configured to run based on the enabled host machine resources, and the host machine resources include the first resource and the second resource.
10. An electronic device, characterized in that: include: Processor and memory; The memory stores instructions executable by the processor; When the processor is configured to execute the instructions, the electronic device implements the method according to any one of claims 1 to 8.