WO2018077030A1 - Method for scheduling memory resource of virtual machine and apparatus - Google Patents
Method for scheduling memory resource of virtual machine and apparatus Download PDFInfo
- Publication number
- WO2018077030A1 WO2018077030A1 PCT/CN2017/105629 CN2017105629W WO2018077030A1 WO 2018077030 A1 WO2018077030 A1 WO 2018077030A1 CN 2017105629 W CN2017105629 W CN 2017105629W WO 2018077030 A1 WO2018077030 A1 WO 2018077030A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- memory
- virtual machine
- sum
- available
- memory allocation
- Prior art date
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5027—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
- G06F9/505—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the load
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
- G06F2009/45583—Memory management, e.g. access or allocation
Definitions
- the present application relates to the field of virtualization technologies, and in particular, to a method for scheduling virtual machine memory resources.
- the present application also relates to a scheduling device for virtual machine memory resources, and an electronic device.
- virtualization technology is to put various physical resources of computers, such as servers, networks, memory and storage. Abstraction, rendering after transformation, breaking the uncuttable barrier between the physical structures, so that users can apply these resources in a better way than the original configuration, and these virtualized resources are not subject to the existing resources. Or physical configuration restrictions.
- all virtual machines on the same physical machine share memory resources, but each virtual machine has different load at runtime. Therefore, the virtual machine needs different physical memory.
- the same virtual machine is in the same virtual machine.
- the demand for physical memory at different times of the load at runtime is also dynamically changing. Therefore, in order to improve the utilization of physical memory and accurately analyze the actual demand of the virtual machine for physical memory, it is important to adjust the physical memory of the virtual machine according to the actual amount of physical memory allocated by the virtual machine.
- the scheduling method of the virtual machine memory resource generally monitors the memory usage of the virtual machine in real time through software, and adjusts the physical memory according to the real-time physical memory requirement of the virtual machine, if the virtual machine is actually The required physical memory is smaller than the physical memory allocated to it. The virtual machine needs to free some of the unused physical memory. If the virtual machine actually needs more physical memory than the physical memory allocated to it, you need to allocate physical memory to the virtual machine. For example, VMM (Virtual Machine Monitor) allocates physical memory to the virtual machine.
- VMM Virtual Machine Monitor
- the scheduling method of the virtual machine memory resource provided by the above prior art has obvious drawbacks.
- the scheduling method of the virtual machine memory resource provided by the prior art has low utilization rate of physical memory, and the memory resource on the physical machine may have idle resources that are not allocated to the virtual machine, resulting in low utilization of the memory resource;
- the physical resources given to the virtual machine may be idle for a period of time and are not being run by the virtual machine. Used, resulting in lower utilization of memory resources.
- the present invention provides a scheduling method for a virtual machine memory resource to solve the problem of low memory resource utilization in the prior art.
- the present application also relates to a scheduling device for virtual machine memory resources, and an electronic device.
- the application provides a scheduling method for a virtual machine memory resource, including:
- the configuration parameters include:
- a lower limit value of the target memory scheduling interval is equal to a sum of a memory lower limit value of each virtual machine included in the resource scheduling instruction
- the upper limit value of the target memory scheduling interval is equal to the sum of the memory upper limit values of the virtual machines included in the resource scheduling instruction.
- the virtual machine on the physical machine is detected according to a preset detection period. After detecting that the virtual machine on the physical machine releases the memory, perform the following steps:
- the allocating a virtual machine to the resource scheduling instruction on the physical machine according to the resource scheduling configuration parameter, and allocating the available memory to the virtual machine is implemented as follows:
- the first memory allocation threshold is equal to a sum of an actual occupied memory of the virtual machine and the maximum free memory
- the second memory allocation threshold is equal to a sum of an actual occupied memory of the virtual machine and the minimum free memory
- the third memory allocation threshold is equal to a sum of the memory lower limit value and the maximum free memory
- the fourth memory allocation threshold is equal to a sum of the memory lower limit value and the minimum free memory
- the available memory is equal to the physical memory of the physical machine minus the memory occupied by the virtual machine and the operating system on the physical machine.
- the allocating a virtual machine to the resource scheduling instruction on the physical machine according to the resource scheduling configuration parameter, and allocating the available memory to the virtual machine is implemented as follows:
- the first memory allocation threshold is equal to a sum of the maximum free memory and an actual occupied memory of the virtual machine.
- the allocating a virtual machine to the resource scheduling instruction on the physical machine according to the resource scheduling configuration parameter, and allocating the available memory to the virtual machine is implemented as follows:
- the second memory allocation threshold is equal to a sum of the minimum free memory and an actual occupied memory of the virtual machine.
- the allocating a virtual machine to the resource scheduling instruction on the physical machine according to the resource scheduling configuration parameter, and allocating the available memory to the virtual machine is implemented as follows:
- the third memory allocation threshold is equal to a sum of the memory lower limit value and the maximum free memory.
- the allocating a virtual machine to the resource scheduling instruction on the physical machine according to the resource scheduling configuration parameter, and allocating the available memory to the virtual machine is implemented as follows:
- the fourth memory allocation threshold is equal to a sum of the memory lower limit value and the minimum free memory.
- the available memory is equal to the actual memory of the physical machine minus the memory occupied by the virtual machine and the operating system on the physical machine.
- the determining whether the available memory on the physical machine is within the corresponding range of the target memory scheduling interval is implemented as follows:
- the step of determining whether the available memory is smaller than an upper limit value of the target memory scheduling interval, if the available memory is greater than or equal to an upper limit value of the target memory scheduling interval, according to the memory The limit allocates memory for each virtual machine in the configuration parameters.
- the virtual machines on the physical machine are deployed in a preset sequence, wherein the virtual machine in the first place has the right to schedule memory of other virtual machines.
- the application also provides a scheduling device for a virtual machine memory resource, including:
- a target memory scheduling interval calculating unit configured to calculate a target memory scheduling interval of the resource scheduling instruction according to a configuration parameter included in a resource scheduling instruction of the physical machine
- a memory allocation judging unit configured to determine whether the available memory on the physical machine is within a corresponding range of the target memory scheduling interval, and if so, running a memory allocation unit;
- the memory allocation unit is configured to allocate a virtual machine to the resource scheduling instruction on the physical machine according to the configuration parameter, and allocate the available memory to the virtual machine.
- the configuration parameters include:
- the scheduling device of the virtual machine memory resource includes:
- the memory detecting unit is configured to detect the virtual machine on the physical machine according to a preset detection period, and after detecting that the virtual machine on the physical machine releases the memory, run the release memory allocation unit;
- the release memory allocation unit is configured to determine, according to the actual occupied memory of the virtual machine on the physical machine and the upper limit of the memory, whether the actual occupied memory of the virtual machine is smaller than the upper limit of the memory, and if so, The memory released on the physical machine is allocated to the virtual machine.
- the memory allocation unit includes:
- the first calculating subunit is configured to calculate, according to the configuration parameter and the actual occupied memory of the remaining virtual machine, a first memory allocation threshold, a second memory allocation threshold, a third memory allocation threshold, and a first Four memory allocation thresholds;
- the second calculating subunit is configured to respectively sum the first memory allocation threshold, the second memory allocation threshold, the third memory allocation threshold, and the fourth memory allocation threshold of the remaining virtual machines;
- the first determining subunit is configured to determine whether the available memory is greater than or equal to a sum of the first memory allocation thresholds
- the first memory allocation subunit If the sum of the first memory allocation threshold is greater than or equal to, the first memory allocation subunit is operated;
- the first memory allocation subunit is configured to allocate memory according to the first memory allocation threshold
- the second determining subunit is operated
- the second determining subunit is configured to determine whether the available memory is greater than or equal to a sum of the second memory allocation thresholds
- the second memory allocation subunit If the sum of the second memory allocation threshold is greater than or equal to, the second memory allocation subunit is operated;
- the second memory allocation subunit is configured to allocate memory according to the second memory allocation threshold
- the third determining subunit is configured to determine whether the available memory is greater than or equal to a sum of the third memory allocation thresholds
- the third memory allocation subunit is configured to allocate memory according to the third memory allocation threshold
- the fourth determining subunit is configured to determine whether the available memory is greater than or equal to a sum of the fourth memory allocation thresholds
- the fourth memory allocation subunit If the sum of the fourth memory allocation threshold is greater than or equal to, the fourth memory allocation subunit is operated;
- the fourth memory allocation subunit is configured to allocate memory according to the fourth memory allocation threshold
- the first memory allocation threshold is equal to a sum of an actual occupied memory of the virtual machine and the maximum free memory
- the second memory allocation threshold is equal to a sum of an actual occupied memory of the virtual machine and the minimum free memory
- the third memory allocation threshold is equal to a sum of the memory lower limit value and the maximum free memory
- the fourth memory allocation threshold is equal to a sum of the memory lower limit value and the minimum free memory
- the available memory is equal to the physical memory of the physical machine minus the memory occupied by the virtual machine and the operating system on the physical machine.
- the application also provides an electronic device, including:
- Memory Memory, and processor
- the memory is for storing computer executable instructions for executing the computer executable instructions:
- the method for scheduling a virtual machine memory resource includes: calculating a target memory scheduling interval of the resource scheduling instruction according to a configuration parameter included in a resource scheduling instruction of the physical machine; and determining whether the available memory on the physical machine is in the Within the corresponding range of the target memory scheduling interval, if yes, performing the next step; allocating a virtual machine to the resource scheduling instruction on the physical machine according to the configuration parameter, and allocating the available memory to the virtual machine.
- the method for scheduling the virtual machine memory resource calculates a target memory scheduling interval of the resource scheduling instruction according to a configuration parameter included in the resource scheduling instruction, and determines whether the available memory on the physical machine is in the target And determining, in the corresponding range of the memory scheduling interval, whether the available memory can meet the requirement of the resource scheduling instruction for the memory resource, and if yes, assigning the virtual machine to the resource scheduling instruction on the physical machine according to the configuration parameter, And allocating the available memory to the virtual machine, and using the configuration parameter to perform scheduling management on a memory resource of the virtual machine on the physical machine, and reducing idle memory resources on the physical machine, and Scheduling management is more comprehensive, which improves the utilization of memory resources.
- FIG. 1 is a process flowchart of an embodiment of a method for scheduling virtual machine memory resources provided by the present application
- FIG. 2 is a schematic diagram of an embodiment of a scheduling device for a virtual machine memory resource provided by the present application
- FIG. 3 is a schematic diagram of an embodiment of an electronic device provided by the present application.
- the present application provides a scheduling method for a virtual machine memory resource, and the present application further provides a scheduling device for a virtual machine memory resource, and an electronic device.
- a scheduling method for a virtual machine memory resource and the present application further provides a scheduling device for a virtual machine memory resource, and an electronic device.
- the method for scheduling a virtual machine memory resource is as follows:
- FIG. 1 is a flowchart of processing a method for scheduling a virtual machine memory resource provided by the present application, and further, a relationship between steps of the virtual machine memory resource scheduling method embodiment, Please according to Figure 1 is determined.
- Step S101 Calculate a target memory scheduling interval of the resource scheduling instruction according to a configuration parameter included in a resource scheduling instruction of the physical machine.
- the resource scheduling instruction in the embodiment of the present application is a scheduling instruction sent by a physical machine for scheduling physical memory of a virtual machine on a physical machine. For example, a dispatch instruction sent by an external business party when applying for a memory resource.
- the resource scheduling instruction includes configuration parameters of the specifically invoked virtual machine. The configuration parameters include: the number of virtual machines, the identifier, the lower limit of the memory, the upper limit of the memory, the minimum free memory, and the maximum free memory.
- the number of the virtual machines refers to the number of virtual machines that need to be scheduled, and the identifiers are used to distinguish each virtual machine that needs to be scheduled.
- the lower limit of the memory refers to the minimum memory allocated to the virtual machine.
- the lower limit of the memory may be the minimum physical memory required for the virtual machine to run on the physical machine. This part of the physical memory must be satisfied. Otherwise, the virtual machine may not be able to start.
- the upper memory limit value refers to the maximum memory allocated to the virtual machine.
- the upper memory limit value may be the maximum physical memory required for the virtual machine to run on the physical machine and reach the maximum load. When the memory resources on the physical machine are relatively tight, the physical memory can be scheduled by compressing the upper memory limit.
- the minimum free memory refers to the physical memory required to ensure the worst performance of the virtual machine (excluding the physical memory required for the virtual machine itself to run), when scheduling the memory resources on the physical machine, this part Physical memory is not compressed, because once the virtual machine's minimum free memory is compressed, the virtual machine is likely to fail due to failure to meet the minimum load.
- the maximum free memory refers to the physical memory allocated to the virtual machine when the memory resources are sufficient (excluding the physical memory required for the virtual machine itself to run), and when the memory resources on the physical machine are relatively tight, Scheduling physical memory by compressing the maximum free memory.
- the configuration parameters included in the resource scheduling instruction A are as follows:
- the number of virtual machines is N: 5;
- the upper limit of memory is upper: 20G;
- the configuration parameters included in the resource scheduling instruction B are as follows:
- the number of virtual machines is N: 4;
- Vm1 memory lower limit lower 1G
- memory upper limit upper 2G
- minimum free memory lower_free 100M
- maximum free memory upper_free 200M
- Vm2 memory lower limit lower 1G
- memory upper limit upper 2G
- minimum free memory lower_free 100M
- maximum free memory upper_free 200M
- Vm3 memory lower limit lower 10G, memory upper limit upper: 20G, minimum free memory lower_free: 1G, maximum free memory upper_free: 2G;
- Vm4 memory lower limit lower 10G
- memory upper limit upper 20G
- minimum free memory lower_free 1G
- maximum free memory upper_free 2G.
- the physical memory of each virtual machine on the physical machine is scheduled to be: the physical memory of each virtual machine on the physical machine can support its startup, and the memory resources on the physical machine are in a state of tension, that is: The physical memory allocated to the virtual machine is greater than the lower memory limit and smaller than the upper memory limit. In this case, the physical memory of each virtual machine on the physical machine needs to be scheduled.
- the target memory scheduling interval refers to a scheduling condition that can be satisfied for scheduling physical memory of each virtual machine on the physical machine, where the target memory scheduling interval is set with an upper limit value and a lower limit value, where The lower limit value of the target memory scheduling interval is equal to the sum of the memory lower limit values of the virtual machines included in the resource scheduling instruction; the upper limit value of the target memory scheduling interval is equal to the resource scheduling instruction The sum of the memory upper limits of each virtual machine.
- the configuration parameters included in the resource scheduling instruction A are: the number of virtual machines N: 5; the lower limit of memory lower: 10G; the upper limit of memory upper: 20G; the minimum free memory lower_free: 1G; the maximum free memory upper_free: 2G ;
- the virtual machines deployed on the physical machine may be deployed in a preset sequence. If the virtual machine is deployed on the physical machine according to a preset sequence, the virtual machine in the first place has scheduling other Permissions for virtual machine memory. For example, 10 virtual machines deployed on a physical machine: vm1 to vm10, wherein vm1 has the authority to manage vm2 to vm10.
- Step S102 determining whether the available memory on the physical machine is within the corresponding range of the target memory scheduling interval.
- an available memory computing operation is performed to calculate available memory on the physical machine, the available memory is equal to the physical memory of the physical machine minus the virtual machine and the operation on the physical machine.
- the system occupies memory, ie:
- Available memory memory_used physical machine actual memory host_total-virtual machine memory - The operating system occupies memory host_used;
- n is the number of virtual machines on the physical machine.
- the specific implementation is as follows:
- step S103 allocating a virtual machine to the resource scheduling instruction on the physical machine according to the configuration parameter, and allocating the available memory to the virtual machine;
- the lower limit of the memory of the above five virtual machines is 10G
- the lower limit of the target memory scheduling interval is 50G
- the available memory memory_used is 48G, which is less than the lower limit of the target memory scheduling interval, and 4 virtual before the startup.
- the memory allocated by each virtual machine is 10G.
- the fifth virtual machine is started, because the remaining memory 8G on the physical machine is less than the lower limit of the memory lower10G, the fifth virtual machine cannot be started, indicating that the physical There is no way for the memory resources on the machine to satisfy the current resource scheduling instruction. The virtual machine is no longer started for the current resource scheduling instruction and the memory allocation is performed, and a reminder message for insufficient memory is issued.
- the target memory scheduling interval If it is greater than or equal to the upper limit value of the target memory scheduling interval, it indicates that, for the current resource scheduling instruction, the memory resources on the physical machine are sufficient, and there is no resource between the virtual machines on the physical machine. Competing for the maximum demand for memory resources of each virtual machine included in the resource scheduling instruction, where, for each virtual machine in the configuration parameter, the memory upper limit value is used in the configuration parameter.
- Each virtual machine allocates memory, that is, allocates the maximum physical memory corresponding to the upper limit of the memory to each virtual machine in the configuration parameter.
- the upper limit of the upper limit of the above five virtual machines is 20G, and the upper limit of the target memory scheduling interval is 100G; the available memory memory_used is 120G, which is greater than the upper limit of the target memory scheduling interval of 100G, for each virtual Machines, respectively, allocate 20G of physical memory.
- Step S103 Allocate a virtual machine for the resource scheduling instruction on the physical machine according to the configuration parameter, and allocate the available memory to the virtual machine.
- step S02 determines whether the available memory on the physical machine is within the corresponding range of the target memory scheduling interval, that is, the available memory on the physical machine is smaller than the target memory scheduling interval.
- the upper limit value is greater than or equal to the lower limit value of the target memory scheduling interval.
- a virtual machine is allocated to the resource scheduling instruction on the physical machine according to the configuration parameter, and the available memory is allocated to the virtual machine, and the specific implementation is as follows:
- the first memory allocation threshold is equal to a sum of an actual occupied memory of the virtual machine and the maximum free memory
- the second memory allocation threshold is equal to a sum of an actual occupied memory of the virtual machine and the minimum free memory
- the third memory allocation threshold is equal to a sum of the memory lower limit value and the maximum free memory
- the fourth memory allocation threshold is equal to a sum of the memory lower limit value and the minimum free memory.
- the resource scheduling instruction A includes the parameters of the five virtual machines
- the first memory allocation threshold memory_value1 is 16G
- the available memory memory_used of the physical machine is 80G, which is equal to the sum of the first memory allocation thresholds of 80G, and allocates 16G physical memory to the first virtual machine vm1;
- the memory allocation operation is repeated, and the memory allocated by the virtual machine vm2 to the virtual machine vm5 is 16G.
- the second memory allocation threshold memory_value1 is 15G
- the available memory memory_used of the physical machine is 79G, which is greater than the sum of the second memory allocation threshold and 75G, and allocates 15G physical memory to the first virtual machine vm1;
- the memory allocation operation is repeated, and the memory allocated by the virtual machine vm2 to the virtual machine vm5 is 16G.
- the resource scheduling instruction A includes the parameters of the five virtual machines
- the third memory allocation threshold memory_value1 is 12G
- the memory allocation operation is repeated, and the memory allocated by the virtual machine vm2 to the virtual machine vm5 is sequentially: 12G, 15G, 15G, and 15G.
- the fourth memory allocation threshold memory_value1 is 11G
- the available memory memory_used of the physical machine is 57G, which is greater than the sum of the fourth memory allocation threshold of 60G, and allocates 11G physical memory to the first virtual machine vm1;
- the memory allocation operation is repeated, and the memory allocated by the virtual machine vm2 to the virtual machine vm5 is sequentially: 11G, 11G, 12G, and 12G.
- the execution sequence of each step in the memory allocation operation is limited to the foregoing implementation manner, and may be implemented in other similar manners. For example, in the foregoing memory allocation operation, first determining whether the available memory is greater than or equal to the foregoing. a sum of the fourth memory allocation thresholds, and then sequentially determining whether the available memory is greater than or equal to a sum of the third memory allocation thresholds, and whether the available memory is greater than or equal to a sum of the second memory allocation thresholds, and finally determining Whether the available memory is greater than or equal to a sum of the first memory allocation thresholds.
- the memory allocation operation can be implemented by using various specific implementation manners.
- the various forms of the implementation of the memory allocation operation are only changes of the specific implementation, and do not deviate from the core of the present application, and therefore are within the protection scope of the present application.
- the following provides several implementations of the memory allocation operation:
- the first memory allocation threshold is equal to a sum of the maximum free memory and an actual occupied memory of the virtual machine.
- the second memory allocation threshold is equal to a sum of the minimum free memory and an actual occupied memory of the virtual machine.
- the third memory allocation threshold is equal to a sum of the memory lower limit value and the maximum free memory.
- the fourth memory allocation threshold is equal to a sum of the memory lower limit value and the minimum free memory.
- the virtual machine on the physical machine is detected according to a preset detection period. After detecting that the virtual machine on the physical machine releases the memory, perform the following steps:
- the preset detection period may be adjusted according to actual service requirements, thereby implementing control of the detection frequency of the memory detection operation, such as increasing the memory detection operation by reducing the preset detection period.
- the detection frequency increases the scheduling management of the memory resources on the physical machine, further reduces the idle memory resources on the physical machine, and further improves the utilization of the memory resources on the physical machine; meanwhile, based on the memory detection operation Dynamic management of memory resources on the physical machine, thereby achieving overselling of memory resources, that is, realizing overselling of virtual machines and increasing revenue.
- the method for scheduling virtual machine memory resources calculates a target memory scheduling interval of the resource scheduling instruction according to configuration parameters included in the resource scheduling instruction, and determines available memory on the physical machine. Whether it is within the corresponding range of the target memory scheduling interval, to determine whether the available memory can satisfy the requirement of the resource scheduling instruction for the memory resource, and if so, scheduling the resource on the physical machine according to the configuration parameter
- the instruction allocates a virtual machine, and allocates the available memory to the virtual machine, and uses the configuration parameter to more accurately schedule and manage memory resources of the virtual machine on the physical machine, thereby reducing idle memory resources on the physical machine.
- the scheduling management of memory resources is more comprehensive, thereby improving the utilization of memory resources.
- the scheduling device for a virtual machine memory resource provided by the present application is as follows:
- a scheduling method for a virtual machine memory resource is provided.
- the present application further provides a scheduling device for a virtual machine memory resource, which will be described below with reference to the accompanying drawings.
- FIG. 2 a schematic diagram of an embodiment of a scheduling device for a virtual machine memory resource provided by the present application is shown.
- the application provides a scheduling device for a virtual machine memory resource, including:
- the target memory scheduling interval calculating unit 201 is configured to: according to the configuration parameter included in the resource scheduling instruction of the physical machine Calculating a target memory scheduling interval of the resource scheduling instruction;
- the memory allocation determining unit 202 is configured to determine whether the available memory on the physical machine is within the corresponding range of the target memory scheduling interval, and if so, running the memory allocation unit 203;
- the memory allocation unit 203 is configured to allocate a virtual machine to the resource scheduling instruction on the physical machine according to the configuration parameter, and allocate the available memory to the virtual machine.
- the configuration parameters include:
- a lower limit value of the target memory scheduling interval is equal to a sum of a memory lower limit value of each virtual machine included in the resource scheduling instruction
- the upper limit value of the target memory scheduling interval is equal to the sum of the memory upper limit values of the virtual machines included in the resource scheduling instruction.
- the scheduling device of the virtual machine memory resource includes:
- the memory detecting unit is configured to detect the virtual machine on the physical machine according to a preset detection period, and after detecting that the virtual machine on the physical machine releases the memory, run the release memory allocation unit;
- the release memory allocation unit is configured to determine, according to the actual occupied memory of the virtual machine on the physical machine and the upper limit of the memory, whether the actual occupied memory of the virtual machine is smaller than the upper limit of the memory, and if so, The memory released on the physical machine is allocated to the virtual machine.
- the memory allocation unit 203 includes:
- the first calculating subunit is configured to calculate, according to the configuration parameter and the actual occupied memory of the remaining virtual machine, a first memory allocation threshold, a second memory allocation threshold, a third memory allocation threshold, and a first Four memory allocation thresholds;
- the second calculating subunit is configured to respectively sum the first memory allocation threshold, the second memory allocation threshold, the third memory allocation threshold, and the fourth memory allocation threshold of the remaining virtual machines;
- the first determining subunit is configured to determine whether the available memory is greater than or equal to a sum of the first memory allocation thresholds
- the first memory allocation subunit If the sum of the first memory allocation threshold is greater than or equal to, the first memory allocation subunit is operated;
- the first memory allocation subunit is configured to allocate memory according to the first memory allocation threshold
- the second determining subunit is operated
- the second determining subunit is configured to determine whether the available memory is greater than or equal to a sum of the second memory allocation thresholds
- the second memory allocation subunit If the sum of the second memory allocation threshold is greater than or equal to, the second memory allocation subunit is operated;
- the second memory allocation subunit is configured to allocate memory according to the second memory allocation threshold
- the third determining subunit is configured to determine whether the available memory is greater than or equal to a sum of the third memory allocation thresholds
- the third memory allocation subunit is configured to allocate memory according to the third memory allocation threshold
- the fourth determining subunit is configured to determine whether the available memory is greater than or equal to a sum of the fourth memory allocation thresholds
- the fourth memory allocation subunit If the sum of the fourth memory allocation threshold is greater than or equal to, the fourth memory allocation subunit is operated;
- the fourth memory allocation subunit is configured to allocate memory according to the fourth memory allocation threshold
- the first memory allocation threshold is equal to a sum of an actual occupied memory of the virtual machine and the maximum free memory
- the second memory allocation threshold is equal to a sum of an actual occupied memory of the virtual machine and the minimum free memory
- the third memory allocation threshold is equal to a sum of the memory lower limit value and the maximum free memory
- the fourth memory allocation threshold is equal to a sum of the memory lower limit value and the minimum free memory
- the available memory is equal to the physical memory of the physical machine minus the memory occupied by the virtual machine and the operating system on the physical machine.
- the memory allocation unit 203 includes:
- a first memory allocation threshold calculation subunit configured to separately calculate a first memory allocation of each virtual machine in the configuration parameter according to the maximum free memory and the actual occupied memory of each virtual machine in the obtained configuration parameter Threshold value
- a first memory allocation threshold summation subunit configured to sum the first memory allocation thresholds of all virtual machines in the configuration parameter
- a first available memory determining subunit configured to determine whether the available memory is greater than or equal to a sum of the first memory allocation thresholds, and if so, running a first available memory allocation subunit;
- the first available memory allocation subunit configured to allocate the available memory to all virtual machines in the configuration parameter according to the first memory allocation threshold; or, equally allocate the available memory to the configuration parameter All the virtual machines in the virtual machine; or, according to the value of the actual occupied memory of the virtual machine, preferentially allocate the available memory to a virtual machine having a large value of actually occupying the memory;
- the first memory allocation threshold is equal to a sum of the maximum free memory and an actual occupied memory of the virtual machine.
- the memory allocation unit 203 includes:
- a second memory allocation threshold calculation subunit configured to separately calculate a second memory allocation of each virtual machine in the configuration parameter according to the minimum free memory and the actual occupied memory of each virtual machine in the obtained configuration parameter Threshold value
- a second memory allocation threshold summation subunit configured to sum the second memory allocation thresholds of all virtual machines in the configuration parameter
- a second available memory determining subunit configured to determine whether the available memory is greater than or equal to a sum of the second memory allocation thresholds, and if so, running a second available memory allocation subunit;
- the second available memory allocation sub-unit is configured to allocate the available memory to all virtual machines in the configuration parameter according to the second memory allocation threshold; or, equally allocate the available memory to the configuration parameter All the virtual machines in the virtual machine; or, according to the value of the actual occupied memory of the virtual machine, preferentially allocate the available memory to a virtual machine having a large value of actually occupying the memory;
- the second memory allocation threshold is equal to a sum of the minimum free memory and an actual occupied memory of the virtual machine.
- the memory allocation unit 203 includes:
- a third memory allocation threshold calculation subunit configured to calculate a third memory allocation threshold of each virtual machine in the configuration parameter according to the memory lower limit value and the maximum free memory
- a third memory allocation threshold summation subunit configured to sum three third memory allocation thresholds of all virtual machines in the configuration parameter
- a third available memory determining subunit configured to determine whether the available memory is greater than or equal to a sum of the third memory allocation threshold, and if so, running a third available memory allocation subunit;
- the third available memory allocation sub-unit is configured to allocate the available memory to all virtual machines in the configuration parameter according to the third memory allocation threshold; or, equally allocate the available memory to the configuration parameter All virtual machines in the middle; or, according to the value of the actual occupied memory of the virtual machine, preferentially allocate the available memory Give the virtual machine with a large value of the actual memory;
- the third memory allocation threshold is equal to a sum of the memory lower limit value and the maximum free memory.
- the memory allocation unit 203 includes:
- a fourth memory allocation threshold calculation subunit configured to calculate a fourth memory allocation threshold of each virtual machine in the configuration parameter according to the memory lower limit value and the minimum free memory
- a fourth memory allocation threshold summation subunit configured to sum the fourth memory allocation thresholds of all the virtual machines in the configuration parameter
- a fourth available memory determining subunit configured to determine whether the available memory is greater than or equal to a sum of the fourth memory allocation threshold, and if so, running a fourth available memory allocation subunit;
- the fourth available memory allocation subunit is configured to allocate the available memory to all virtual machines in the configuration parameter according to the fourth memory allocation threshold; or, equally allocate the available memory to the configuration parameter All the virtual machines in the virtual machine; or, according to the value of the actual occupied memory of the virtual machine, preferentially allocate the available memory to a virtual machine having a large value of actually occupying the memory;
- the fourth memory allocation threshold is equal to a sum of the memory lower limit value and the minimum free memory.
- the scheduling device of the virtual machine memory resource includes:
- the available memory is equal to the actual memory of the physical machine minus the memory occupied by the virtual machine and the operating system on the physical machine.
- the memory allocation determining unit 202 includes:
- a first memory allocation determining subunit configured to determine whether the available memory is less than an upper limit value of the target memory scheduling interval, and if so, running a second memory allocation determining subunit;
- the second memory allocation determining sub-unit is configured to determine whether the available memory is greater than or equal to a lower limit value of the target memory scheduling interval, and if so, running the memory allocation unit 203;
- a third memory allocation determining sub-unit configured to determine whether the available memory is greater than or equal to a lower limit value of the target memory scheduling interval, and if so, running a fourth memory allocation determining sub-unit;
- the fourth memory allocation determining sub-unit is configured to determine whether the available memory is smaller than an upper limit value of the target memory scheduling interval, and if so, run the memory allocation unit 203.
- the available memory is greater than or equal to an upper limit value of the target memory scheduling interval, then running the fifth Memory allocation subunit;
- the fifth memory allocation sub-unit is configured to allocate memory according to the memory upper limit value for each virtual machine in the configuration parameter.
- the available memory is less than a lower limit value of the target memory scheduling interval, running a reminder message issuing unit ;
- the reminder message issuing unit is configured to issue a reminder message that the memory is insufficient.
- the virtual machines on the physical machine are deployed in a preset sequence, wherein the virtual machine in the first place has the right to schedule memory of other virtual machines.
- An electronic device implementation provided by the present application is as follows:
- a method for scheduling a virtual machine memory resource is provided.
- the present application further provides an electronic device for implementing a scheduling method of the virtual machine memory resource, which is described below with reference to the accompanying drawings. .
- FIG. 3 a schematic diagram of an electronic device provided by the embodiment is shown.
- the application provides an electronic device, including:
- the memory 301 is configured to store computer executable instructions, and the processor 302 is configured to execute the computer executable instructions:
- the configuration parameters include:
- a lower limit value of the target memory scheduling interval is equal to a sum of a memory lower limit value of each virtual machine included in the resource scheduling instruction
- the upper limit value of the target memory scheduling interval is equal to the sum of the memory upper limit values of the virtual machines included in the resource scheduling instruction.
- the virtual machine is allocated to the resource scheduling instruction on the physical machine according to the configuration parameter, After the available memory is allocated to the execution of the virtual machine instructions, the processor 302 is further configured to execute the following computer executable instructions:
- the virtual machine on the physical machine is detected according to a preset detection period. After detecting the virtual machine on the physical machine to release the memory, determining, according to the actual occupied memory of the virtual machine on the physical machine and the upper limit of the memory, Whether the actual occupied memory of the virtual machine is smaller than the upper limit of the memory, and if so, the memory released on the physical machine is allocated to the virtual machine.
- the allocating a virtual machine to the resource scheduling instruction on the physical machine according to the resource scheduling configuration parameter, and allocating the available memory to the virtual machine is implemented as follows:
- the first memory allocation threshold is equal to the actual occupied memory of the virtual machine and the maximum free memory. with;
- the second memory allocation threshold is equal to a sum of an actual occupied memory of the virtual machine and the minimum free memory
- the third memory allocation threshold is equal to a sum of the memory lower limit value and the maximum free memory
- the fourth memory allocation threshold is equal to a sum of the memory lower limit value and the minimum free memory
- the available memory is equal to the physical memory of the physical machine minus the memory occupied by the virtual machine and the operating system on the physical machine.
- the allocating a virtual machine to the resource scheduling instruction on the physical machine according to the resource scheduling configuration parameter, and allocating the available memory to the virtual machine is implemented as follows:
- the first memory allocation threshold is equal to a sum of the maximum free memory and an actual occupied memory of the virtual machine.
- the allocating a virtual machine to the resource scheduling instruction on the physical machine according to the resource scheduling configuration parameter, and allocating the available memory to the virtual machine is implemented as follows:
- the second memory allocation threshold is equal to a sum of the minimum free memory and an actual occupied memory of the virtual machine.
- the allocating a virtual machine to the resource scheduling instruction on the physical machine according to the resource scheduling configuration parameter, and allocating the available memory to the virtual machine is implemented as follows:
- the third memory allocation threshold is equal to a sum of the memory lower limit value and the maximum free memory.
- the allocating a virtual machine to the resource scheduling instruction on the physical machine according to the resource scheduling configuration parameter, and allocating the available memory to the virtual machine is implemented as follows:
- the fourth memory allocation threshold is equal to a sum of the memory lower limit value and the minimum free memory.
- the processor 302 is further configured to execute the following computer executable instructions:
- the available memory is equal to the actual memory of the physical machine minus the memory occupied by the virtual machine and the operating system on the physical machine.
- the determining whether the available memory on the physical machine is within the corresponding range of the target memory scheduling interval is implemented as follows:
- an alert message indicating that the memory is insufficient is issued.
- the virtual machines on the physical machine are deployed in a preset sequence, wherein the virtual machine in the first place has the right to schedule memory of other virtual machines.
- a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
- processors CPUs
- input/output interfaces network interfaces
- memory volatile and non-volatile memory
- the memory may include non-persistent memory, random access memory (RAM), and/or non-volatile memory in a computer readable medium, such as read only memory (ROM) or flash memory.
- RAM random access memory
- ROM read only memory
- Memory is an example of a computer readable medium.
- Computer readable media including both permanent and non-persistent, removable and non-removable media may be implemented by any method or technology.
- the information can be computer readable instructions, data structures, modules of programs, or other data.
- Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read only memory. (ROM), electrically erasable programmable read only memory (EEPROM), flash memory or other memory technology, compact disk read only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, Magnetic tape cartridges, magnetic tape storage or other magnetic storage devices or any other non-transportable media can be used to store information that can be accessed by a computing device.
- computer readable media does not include non-transitory computer readable media, such as modulated data signals and carrier waves.
- embodiments of the present application can be provided as a method, system, or computer program product.
- the present application can take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment in combination of software and hardware.
- the application may employ one or more computers including computer usable program code therein.
- a computer program product embodied on a storage medium, including but not limited to disk storage, CD-ROM, optical storage, and the like.
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Memory System (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
A method for scheduling a memory resource of a virtual machine, comprising: calculating a target memory scheduling interval of a resource scheduling instruction of a physical machine according to configuration parameters comprised in the resource scheduling instruction (S101); determining whether an available memory on the physical machine is within a corresponding range of the target memory scheduling interval (S102); if yes, executing the next step; and allocating a virtual machine to the resource scheduling instruction on the physical machine according to the configuration parameters, and allocating the available memory to the virtual machine (S103). The method for scheduling memory resources of a virtual machine is more accurate in scheduling and managing memory resources of a virtual machine on a physical machine and reduces memory resources idle on the physical machine, thereby improving the utilization of the memory resources on the physical machine.
Description
本申请要求2016年10月24日递交的申请号为201610925036.X、发明名称为“一种虚拟机内存资源的调度方法以及装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。The present application claims priority to Chinese Patent Application No. 201610925036.X filed on October 24, 2016, entitled "Scheduling Method and Apparatus for Memory Memory of Virtual Machines", the entire contents of which are incorporated herein by reference. In the application.
本申请涉及虚拟化技术领域,具体涉及一种虚拟机内存资源的调度方法。本申请同时涉及一种虚拟机内存资源的调度装置,以及一种电子设备。The present application relates to the field of virtualization technologies, and in particular, to a method for scheduling virtual machine memory resources. The present application also relates to a scheduling device for virtual machine memory resources, and an electronic device.
随着云计算的快速发展,虚拟化技术也得到了迅速发展,作为一种资源管理技术,虚拟化(Virtualization)技术是将计算机的各种实体资源,如服务器、网络、内存及存储等,予以抽象、转换后呈现出来,打破实体结构间的不可切割的障碍,使用户可以比原本的组态更好的方式来应用这些资源,并且这些虚拟化资源的不受现有资源的架设方式、地域或物理组态的限制。在虚拟化环境下,同一台物理机上的所有虚拟机共享内存资源,但各个虚拟机在运行时的负载各不相同,因此各个虚拟机对物理内存的需求也有所不同,此外,同一虚拟机在运行时的负载在不同时刻对物理内存的需求也是动态变化的。因此,为了提高物理内存的利用率,准确地分析虚拟机对物理内存的实际需求,根据虚拟机对物理内存的实际需求分配相应数量的物理内存,对虚拟机的物理内存进行调整具有重要意义。With the rapid development of cloud computing, virtualization technology has also developed rapidly. As a resource management technology, virtualization technology is to put various physical resources of computers, such as servers, networks, memory and storage. Abstraction, rendering after transformation, breaking the uncuttable barrier between the physical structures, so that users can apply these resources in a better way than the original configuration, and these virtualized resources are not subject to the existing resources. Or physical configuration restrictions. In a virtualized environment, all virtual machines on the same physical machine share memory resources, but each virtual machine has different load at runtime. Therefore, the virtual machine needs different physical memory. In addition, the same virtual machine is in the same virtual machine. The demand for physical memory at different times of the load at runtime is also dynamically changing. Therefore, in order to improve the utilization of physical memory and accurately analyze the actual demand of the virtual machine for physical memory, it is important to adjust the physical memory of the virtual machine according to the actual amount of physical memory allocated by the virtual machine.
现有技术提供的虚拟机内存资源的调度方法,一般是通过软件的方式来实时监控虚拟机的内存使用情况,根据虚拟机实时对物理内存的需求对其物理内存进行调整,如果虚拟机当前实际需要的物理内存比分配给它的物理内存小,则虚拟机需要释放一部分闲置的物理内存;如果虚拟机当前实际需要的物理内存比分配给它的物理内存大,则需要向虚拟机分配物理内存,比如通过VMM(Virtual Machine Monitor,虚拟机监控器)向虚拟机分配物理内存。The scheduling method of the virtual machine memory resource provided by the prior art generally monitors the memory usage of the virtual machine in real time through software, and adjusts the physical memory according to the real-time physical memory requirement of the virtual machine, if the virtual machine is actually The required physical memory is smaller than the physical memory allocated to it. The virtual machine needs to free some of the unused physical memory. If the virtual machine actually needs more physical memory than the physical memory allocated to it, you need to allocate physical memory to the virtual machine. For example, VMM (Virtual Machine Monitor) allocates physical memory to the virtual machine.
上述现有技术提供的虚拟机内存资源的调度方法存在明显的缺陷。The scheduling method of the virtual machine memory resource provided by the above prior art has obvious drawbacks.
现有技术提供的虚拟机内存资源的调度方法,对物理内存的利用率较低,物理机上内存资源,可能存在没有分配给虚拟机的空闲资源,导致内存资源的利用率较低;此外,分配给虚拟机的物理资源可能在一段时间内处于空闲状态,并没有被虚拟机的运行负载
所使用,从而导致内存资源的利用率较低。The scheduling method of the virtual machine memory resource provided by the prior art has low utilization rate of physical memory, and the memory resource on the physical machine may have idle resources that are not allocated to the virtual machine, resulting in low utilization of the memory resource; The physical resources given to the virtual machine may be idle for a period of time and are not being run by the virtual machine.
Used, resulting in lower utilization of memory resources.
发明内容Summary of the invention
本申请提供一种虚拟机内存资源的调度方法,以解决现有技术存在的内存资源利用率低的问题。The present invention provides a scheduling method for a virtual machine memory resource to solve the problem of low memory resource utilization in the prior art.
本申请同时涉及一种虚拟机内存资源的调度装置,以及一种电子设备。The present application also relates to a scheduling device for virtual machine memory resources, and an electronic device.
本申请提供一种虚拟机内存资源的调度方法,包括:The application provides a scheduling method for a virtual machine memory resource, including:
根据物理机的资源调度指令中包含的配置参数,计算所述资源调度指令的目标内存调度区间;Calculating a target memory scheduling interval of the resource scheduling instruction according to a configuration parameter included in a resource scheduling instruction of the physical machine;
判断所述物理机上的可用内存是否处于所述目标内存调度区间对应范围内,若是,执行下一步;Determining whether the available memory on the physical machine is within a corresponding range of the target memory scheduling interval; if yes, performing the next step;
根据所述配置参数在所述物理机上为所述资源调度指令分配虚拟机,并将所述可用内存分配给所述虚拟机。Allocating a virtual machine to the resource scheduling instruction on the physical machine according to the configuration parameter, and allocating the available memory to the virtual machine.
可选的,所述配置参数包括:Optionally, the configuration parameters include:
虚拟机的数目、标识、内存下限值、内存上限值、最小自由内存和最大自由内存。Number of virtual machines, identification, memory lower limit, memory upper limit, minimum free memory, and maximum free memory.
可选的,所述目标内存调度区间的下限值,等于所述资源调度指令中包含的各虚拟机的内存下限值之和;Optionally, a lower limit value of the target memory scheduling interval is equal to a sum of a memory lower limit value of each virtual machine included in the resource scheduling instruction;
所述目标内存调度区间的上限值,等于所述资源调度指令中包含的各虚拟机的内存上限值之和。The upper limit value of the target memory scheduling interval is equal to the sum of the memory upper limit values of the virtual machines included in the resource scheduling instruction.
可选的,所述根据所述配置参数在所述物理机上为所述资源调度指令分配虚拟机,并将所述可用内存分配给所述虚拟机步骤执行之后,执行下述步骤:Optionally, after the step of allocating a virtual machine to the resource scheduling instruction on the physical machine according to the configuration parameter, and allocating the available memory to the virtual machine, perform the following steps:
按照预设检测周期对所述物理机上的虚拟机进行检测,当检测到所述物理机上的虚拟机释放内存后,执行下述步骤:The virtual machine on the physical machine is detected according to a preset detection period. After detecting that the virtual machine on the physical machine releases the memory, perform the following steps:
根据所述物理机上的虚拟机实际占用内存和所述内存上限值,判断所述虚拟机的实际占用内存是否小于所述内存上限值,若是,将所述物理机上释放的内存分配给所述虚拟机。Determining, according to the actual occupied memory of the virtual machine on the physical machine and the upper limit of the memory, whether the actual occupied memory of the virtual machine is smaller than the upper limit of the memory, and if so, allocating the memory released on the physical machine to the Describe the virtual machine.
可选的,所述根据所述资源调度配置参数,在所述物理机上为所述资源调度指令分配虚拟机,并将所述可用内存分配给所述虚拟机,采用如下方式实现:Optionally, the allocating a virtual machine to the resource scheduling instruction on the physical machine according to the resource scheduling configuration parameter, and allocating the available memory to the virtual machine, is implemented as follows:
针对所述配置参数中每一个虚拟机,分别执行下述操作,并且每分配一个虚拟机,计算一次所述物理机的可用内存,并将计算获得的所述可用内存代入下述操作:
For each virtual machine in the configuration parameter, the following operations are respectively performed, and each time a virtual machine is allocated, the available memory of the physical machine is calculated once, and the calculated available memory is substituted into the following operations:
根据所述配置参数以及剩余虚拟机实际占用内存,分别计算所述剩余虚拟机的第一内存分配阈值、第二内存分配阈值、第三内存分配阈值和第四内存分配阈值;Calculating, according to the configuration parameter and the actual occupied memory of the remaining virtual machine, a first memory allocation threshold, a second memory allocation threshold, a third memory allocation threshold, and a fourth memory allocation threshold of the remaining virtual machines;
对所述剩余虚拟机的第一内存分配阈值、第二内存分配阈值、第三内存分配阈值和第四内存分配阈值分别进行求和;And summing, by the first memory allocation threshold, the second memory allocation threshold, the third memory allocation threshold, and the fourth memory allocation threshold, respectively, of the remaining virtual machines;
判断所述可用内存是否大于或者等于所述第一内存分配阈值之和;Determining whether the available memory is greater than or equal to a sum of the first memory allocation thresholds;
若大于或者等于所述第一内存分配阈值之和,按照所述第一内存分配阈值为所述虚拟机分配内存;If greater than or equal to the sum of the first memory allocation thresholds, allocate memory according to the first memory allocation threshold;
若小于所述第一内存分配阈值之和,执行下一步;If the sum is less than the sum of the first memory allocation thresholds, perform the next step;
判断所述可用内存是否大于或者等于所述第二内存分配阈值之和;Determining whether the available memory is greater than or equal to a sum of the second memory allocation thresholds;
若大于或者等于所述第二内存分配阈值之和,按照所述第二内存分配阈值为所述虚拟机分配内存;If greater than or equal to the sum of the second memory allocation thresholds, allocate memory according to the second memory allocation threshold;
若小于所述第二内存分配阈值之和,执行下一步;If the sum is less than the sum of the second memory allocation thresholds, perform the next step;
判断所述可用内存是否大于或者等于所述第三内存分配阈值之和;Determining whether the available memory is greater than or equal to a sum of the third memory allocation thresholds;
若大于或者等于所述第三内存分配阈值之和,按照所述第三内存分配阈值为所述虚拟机分配内存;If greater than or equal to the sum of the third memory allocation thresholds, allocate memory according to the third memory allocation threshold;
若小于所述第三内存分配阈值之和,执行下一步;If the sum is less than the sum of the third memory allocation thresholds, perform the next step;
判断所述可用内存是否大于或者等于所述第四内存分配阈值之和;Determining whether the available memory is greater than or equal to a sum of the fourth memory allocation thresholds;
若大于或者等于所述第四内存分配阈值之和,按照所述第四内存分配阈值为所述虚拟机分配内存;If greater than or equal to the sum of the fourth memory allocation thresholds, allocate memory according to the fourth memory allocation threshold;
其中,所述第一内存分配阈值等于所述虚拟机实际占用内存与所述最大自由内存之和;The first memory allocation threshold is equal to a sum of an actual occupied memory of the virtual machine and the maximum free memory;
所述第二内存分配阈值等于所述虚拟机实际占用内存与所述最小自由内存之和;The second memory allocation threshold is equal to a sum of an actual occupied memory of the virtual machine and the minimum free memory;
所述第三内存分配阈值等于所述内存下限值与所述最大自由内存之和;The third memory allocation threshold is equal to a sum of the memory lower limit value and the maximum free memory;
所述第四内存分配阈值等于所述内存下限值与所述最小自由内存之和;The fourth memory allocation threshold is equal to a sum of the memory lower limit value and the minimum free memory;
所述可用内存等于所述物理机实际内存减去所述物理机上虚拟机和操作系统占用内存。The available memory is equal to the physical memory of the physical machine minus the memory occupied by the virtual machine and the operating system on the physical machine.
可选的,所述根据所述资源调度配置参数,在所述物理机上为所述资源调度指令分配虚拟机,并将所述可用内存分配给所述虚拟机,采用如下方式实现:Optionally, the allocating a virtual machine to the resource scheduling instruction on the physical machine according to the resource scheduling configuration parameter, and allocating the available memory to the virtual machine, is implemented as follows:
根据所述最大自由内存,以及获取的所述配置参数中每一个虚拟机实际占用内存,分别计算所述配置参数中每一个虚拟机的第一内存分配阈值;
Calculating a first memory allocation threshold of each virtual machine in the configuration parameter according to the maximum free memory and the actual occupied memory of each virtual machine in the obtained configuration parameter;
对所述配置参数中所有虚拟机的第一内存分配阈值进行求和;And summing a first memory allocation threshold of all virtual machines in the configuration parameter;
判断所述可用内存是否大于或者等于所述第一内存分配阈值之和,若是,执行下一步;Determining whether the available memory is greater than or equal to a sum of the first memory allocation thresholds, and if yes, performing the next step;
按照所述第一内存分配阈值将所述可用内存分配给所述配置参数中所有虚拟机;或者,将所述可用内存平均分配给所述配置参数中所有虚拟机;或者,按照所述虚拟机实际占用内存的数值大小,优先将所述可用内存分配给实际占用内存的数值较大的虚拟机;Allocating the available memory to all virtual machines in the configuration parameter according to the first memory allocation threshold; or distributing the available memory evenly to all virtual machines in the configuration parameter; or, according to the virtual machine Actually occupying the value of the memory, and preferentially allocating the available memory to a virtual machine having a large value that actually occupies the memory;
其中,所述第一内存分配阈值等于所述最大自由内存与所述虚拟机实际占用内存之和。The first memory allocation threshold is equal to a sum of the maximum free memory and an actual occupied memory of the virtual machine.
可选的,所述根据所述资源调度配置参数,在所述物理机上为所述资源调度指令分配虚拟机,并将所述可用内存分配给所述虚拟机,采用如下方式实现:Optionally, the allocating a virtual machine to the resource scheduling instruction on the physical machine according to the resource scheduling configuration parameter, and allocating the available memory to the virtual machine, is implemented as follows:
根据所述最小自由内存,以及获取的所述配置参数中每一个虚拟机实际占用内存,分别计算所述配置参数中每一个虚拟机的第二内存分配阈值;Calculating a second memory allocation threshold of each virtual machine in the configuration parameter according to the minimum free memory and the actual occupied memory of each virtual machine in the obtained configuration parameter;
对所述配置参数中所有虚拟机的第二内存分配阈值进行求和;And summing a second memory allocation threshold of all virtual machines in the configuration parameter;
判断所述可用内存是否大于或者等于所述第二内存分配阈值之和,若是,执行下一步;Determining whether the available memory is greater than or equal to a sum of the second memory allocation thresholds; if yes, performing the next step;
按照所述第二内存分配阈值将所述可用内存分配给所述配置参数中所有虚拟机;或者,将所述可用内存平均分配给所述配置参数中所有虚拟机;或者,按照所述虚拟机实际占用内存的数值大小,优先将所述可用内存分配给实际占用内存的数值较大的虚拟机;Allocating the available memory to all virtual machines in the configuration parameter according to the second memory allocation threshold; or equally allocating the available memory to all virtual machines in the configuration parameter; or, according to the virtual machine Actually occupying the value of the memory, and preferentially allocating the available memory to a virtual machine having a large value that actually occupies the memory;
其中,所述第二内存分配阈值等于所述最小自由内存与所述虚拟机实际占用内存之和。The second memory allocation threshold is equal to a sum of the minimum free memory and an actual occupied memory of the virtual machine.
可选的,所述根据所述资源调度配置参数,在所述物理机上为所述资源调度指令分配虚拟机,并将所述可用内存分配给所述虚拟机,采用如下方式实现:Optionally, the allocating a virtual machine to the resource scheduling instruction on the physical machine according to the resource scheduling configuration parameter, and allocating the available memory to the virtual machine, is implemented as follows:
根据所述内存下限值和所述最大自由内存,分别计算所述配置参数中每一个虚拟机的第三内存分配阈值;Calculating, according to the memory lower limit value and the maximum free memory, a third memory allocation threshold of each virtual machine in the configuration parameter;
对所述配置参数中所有虚拟机的第三内存分配阈值进行求和;And summing a third memory allocation threshold of all virtual machines in the configuration parameter;
判断所述可用内存是否大于或者等于所述第三内存分配阈值之和,若是,执行下一步;Determining whether the available memory is greater than or equal to a sum of the third memory allocation thresholds, and if yes, performing the next step;
按照所述第三内存分配阈值将所述可用内存分配给所述配置参数中所有虚拟机;或者,将所述可用内存平均分配给所述配置参数中所有虚拟机;或者,按照所述虚拟机实际占用内存的数值大小,优先将所述可用内存分配给实际占用内存的数值较大的虚拟机;
Allocating the available memory to all virtual machines in the configuration parameter according to the third memory allocation threshold; or distributing the available memory evenly to all virtual machines in the configuration parameter; or, according to the virtual machine Actually occupying the value of the memory, and preferentially allocating the available memory to a virtual machine having a large value that actually occupies the memory;
其中,所述第三内存分配阈值等于所述内存下限值与所述最大自由内存之和。The third memory allocation threshold is equal to a sum of the memory lower limit value and the maximum free memory.
可选的,所述根据所述资源调度配置参数,在所述物理机上为所述资源调度指令分配虚拟机,并将所述可用内存分配给所述虚拟机,采用如下方式实现:Optionally, the allocating a virtual machine to the resource scheduling instruction on the physical machine according to the resource scheduling configuration parameter, and allocating the available memory to the virtual machine, is implemented as follows:
根据所述内存下限值和所述最小自由内存,分别计算所述配置参数中每一个虚拟机的第四内存分配阈值;Calculating, according to the memory lower limit value and the minimum free memory, a fourth memory allocation threshold of each virtual machine in the configuration parameter;
对所述配置参数中所有虚拟机的第四内存分配阈值进行求和;And summing a fourth memory allocation threshold of all virtual machines in the configuration parameter;
判断所述可用内存是否大于或者等于所述第四内存分配阈值之和,若是,执行下一步;Determining whether the available memory is greater than or equal to a sum of the fourth memory allocation threshold, and if yes, performing the next step;
按照所述第四内存分配阈值将所述可用内存分配给所述配置参数中所有虚拟机;或者,将所述可用内存平均分配给所述配置参数中所有虚拟机;或者,按照所述虚拟机实际占用内存的数值大小,优先将所述可用内存分配给实际占用内存的数值较大的虚拟机;Allocating the available memory to all virtual machines in the configuration parameter according to the fourth memory allocation threshold; or distributing the available memory evenly to all virtual machines in the configuration parameter; or, according to the virtual machine Actually occupying the value of the memory, and preferentially allocating the available memory to a virtual machine having a large value that actually occupies the memory;
其中,所述第四内存分配阈值等于所述内存下限值与所述最小自由内存之和。The fourth memory allocation threshold is equal to a sum of the memory lower limit value and the minimum free memory.
可选的,所述判断所述物理机上的可用内存是否处于所述目标内存调度区间对应范围内步骤执行之前,执行下述步骤:Optionally, before the step of determining whether the available memory on the physical machine is within the corresponding range of the target memory scheduling interval, perform the following steps:
计算所述物理机上的所述可用内存;Calculating the available memory on the physical machine;
其中,所述可用内存等于所述物理机实际内存减去所述物理机上虚拟机和操作系统占用内存。The available memory is equal to the actual memory of the physical machine minus the memory occupied by the virtual machine and the operating system on the physical machine.
可选的,所述判断所述物理机上的可用内存是否处于所述目标内存调度区间对应范围内,采用如下方式实现:Optionally, the determining whether the available memory on the physical machine is within the corresponding range of the target memory scheduling interval is implemented as follows:
判断所述可用内存是否小于所述目标内存调度区间的上限值,若是,判断所述可用内存是否大于或者等于所述目标内存调度区间的下限值,若是,执行下一步;Determining whether the available memory is less than an upper limit value of the target memory scheduling interval, and if yes, determining whether the available memory is greater than or equal to a lower limit value of the target memory scheduling interval, and if yes, performing a next step;
或者,or,
判断所述可用内存是否大于或者等于所述目标内存调度区间的下限值,若是,判断所述可用内存是否小于所述目标内存调度区间的上限值,若是,执行下一步。Determining whether the available memory is greater than or equal to a lower limit value of the target memory scheduling interval, and if yes, determining whether the available memory is less than an upper limit value of the target memory scheduling interval, and if yes, performing the next step.
可选的,所述判断所述可用内存是否小于所述目标内存调度区间的上限值子步骤,若所述可用内存大于或者等于所述目标内存调度区间的上限值,按照所述内存上限值为所述配置参数中每一个虚拟机分配内存。Optionally, the step of determining whether the available memory is smaller than an upper limit value of the target memory scheduling interval, if the available memory is greater than or equal to an upper limit value of the target memory scheduling interval, according to the memory The limit allocates memory for each virtual machine in the configuration parameters.
可选的,所述判断所述可用内存是否大于或者等于所述目标内存调度区间的下限值子步骤,若所述可用内存小于所述目标内存调度区间的下限值,则发出内存不足的提醒消息。
Optionally, the step of determining whether the available memory is greater than or equal to a lower limit value of the target memory scheduling interval, and if the available memory is less than a lower limit value of the target memory scheduling interval, issuing an insufficient memory Reminder message.
可选的,所述物理机上的虚拟机按照预设排列顺序进行部署,其中居于首位的虚拟机具有调度其他虚拟机内存的权限。Optionally, the virtual machines on the physical machine are deployed in a preset sequence, wherein the virtual machine in the first place has the right to schedule memory of other virtual machines.
本申请还提供一种虚拟机内存资源的调度装置,包括:The application also provides a scheduling device for a virtual machine memory resource, including:
目标内存调度区间计算单元,用于根据物理机的资源调度指令中包含的配置参数,计算所述资源调度指令的目标内存调度区间;a target memory scheduling interval calculating unit, configured to calculate a target memory scheduling interval of the resource scheduling instruction according to a configuration parameter included in a resource scheduling instruction of the physical machine;
内存分配判断单元,用于判断所述物理机上的可用内存是否处于所述目标内存调度区间对应范围内,若是,运行内存分配单元;a memory allocation judging unit, configured to determine whether the available memory on the physical machine is within a corresponding range of the target memory scheduling interval, and if so, running a memory allocation unit;
所述内存分配单元,用于根据所述配置参数在所述物理机上为所述资源调度指令分配虚拟机,并将所述可用内存分配给所述虚拟机。The memory allocation unit is configured to allocate a virtual machine to the resource scheduling instruction on the physical machine according to the configuration parameter, and allocate the available memory to the virtual machine.
可选的,所述配置参数包括:Optionally, the configuration parameters include:
虚拟机的数目、标识、内存下限值、内存上限值、最小自由内存和最大自由内存。Number of virtual machines, identification, memory lower limit, memory upper limit, minimum free memory, and maximum free memory.
可选的,所述虚拟机内存资源的调度装置,包括:Optionally, the scheduling device of the virtual machine memory resource includes:
释放内存检测单元,用于按照预设检测周期对所述物理机上的虚拟机进行检测,当检测到所述物理机上的虚拟机释放内存后,运行释放内存分配单元;The memory detecting unit is configured to detect the virtual machine on the physical machine according to a preset detection period, and after detecting that the virtual machine on the physical machine releases the memory, run the release memory allocation unit;
所述释放内存分配单元,用于根据所述物理机上的虚拟机实际占用内存和所述内存上限值,判断所述虚拟机的实际占用内存是否小于所述内存上限值,若是,将所述物理机上释放的内存分配给所述虚拟机。The release memory allocation unit is configured to determine, according to the actual occupied memory of the virtual machine on the physical machine and the upper limit of the memory, whether the actual occupied memory of the virtual machine is smaller than the upper limit of the memory, and if so, The memory released on the physical machine is allocated to the virtual machine.
可选的,所述内存分配单元,包括:Optionally, the memory allocation unit includes:
针对所述配置参数中每一个虚拟机,分别运行第一计算子单元、第二计算子单元和第一判断子单元,并且每分配一个虚拟机,计算一次所述物理机的可用内存,并将计算获得的所述可用内存代入所述第一判断子单元:Performing, for each virtual machine in the configuration parameter, a first computing subunit, a second computing subunit, and a first determining subunit, and calculating a available memory of the physical machine once for each virtual machine, and Computing the obtained available memory into the first determining subunit:
所述第一计算子单元,用于根据所述配置参数以及剩余虚拟机实际占用内存,分别计算所述剩余虚拟机的第一内存分配阈值、第二内存分配阈值、第三内存分配阈值和第四内存分配阈值;The first calculating subunit is configured to calculate, according to the configuration parameter and the actual occupied memory of the remaining virtual machine, a first memory allocation threshold, a second memory allocation threshold, a third memory allocation threshold, and a first Four memory allocation thresholds;
所述第二计算子单元,用于对所述剩余虚拟机的第一内存分配阈值、第二内存分配阈值、第三内存分配阈值和第四内存分配阈值分别进行求和;The second calculating subunit is configured to respectively sum the first memory allocation threshold, the second memory allocation threshold, the third memory allocation threshold, and the fourth memory allocation threshold of the remaining virtual machines;
所述第一判断子单元,用于判断所述可用内存是否大于或者等于所述第一内存分配阈值之和;The first determining subunit is configured to determine whether the available memory is greater than or equal to a sum of the first memory allocation thresholds;
若大于或者等于所述第一内存分配阈值之和,运行第一内存分配子单元;If the sum of the first memory allocation threshold is greater than or equal to, the first memory allocation subunit is operated;
所述第一内存分配子单元,用于按照所述第一内存分配阈值为所述虚拟机分配内存;
The first memory allocation subunit is configured to allocate memory according to the first memory allocation threshold;
若小于所述第一内存分配阈值之和,运行第二判断子单元;If the sum of the first memory allocation threshold is less than, the second determining subunit is operated;
所述第二判断子单元,用于判断所述可用内存是否大于或者等于所述第二内存分配阈值之和;The second determining subunit is configured to determine whether the available memory is greater than or equal to a sum of the second memory allocation thresholds;
若大于或者等于所述第二内存分配阈值之和,运行第二内存分配子单元;If the sum of the second memory allocation threshold is greater than or equal to, the second memory allocation subunit is operated;
所述第二内存分配子单元,用于按照所述第二内存分配阈值为所述虚拟机分配内存;The second memory allocation subunit is configured to allocate memory according to the second memory allocation threshold;
若小于所述第二内存分配阈值之和,运行第三判断子单元;If the sum is less than the sum of the second memory allocation thresholds, running a third determining subunit;
所述第三判断子单元,用于判断所述可用内存是否大于或者等于所述第三内存分配阈值之和;The third determining subunit is configured to determine whether the available memory is greater than or equal to a sum of the third memory allocation thresholds;
若大于或者等于所述第三内存分配阈值之和,运行第三内存分配子单元;If greater than or equal to the sum of the third memory allocation thresholds, running a third memory allocation sub-unit;
所述第三内存分配子单元,用于按照所述第三内存分配阈值为所述虚拟机分配内存;The third memory allocation subunit is configured to allocate memory according to the third memory allocation threshold;
若小于所述第三内存分配阈值之和,运行第四判断子单元;If the sum is less than the sum of the third memory allocation thresholds, running the fourth determining subunit;
所述第四判断子单元,用于判断所述可用内存是否大于或者等于所述第四内存分配阈值之和;The fourth determining subunit is configured to determine whether the available memory is greater than or equal to a sum of the fourth memory allocation thresholds;
若大于或者等于所述第四内存分配阈值之和,运行第四内存分配子单元;If the sum of the fourth memory allocation threshold is greater than or equal to, the fourth memory allocation subunit is operated;
所述第四内存分配子单元,用于按照所述第四内存分配阈值为所述虚拟机分配内存;The fourth memory allocation subunit is configured to allocate memory according to the fourth memory allocation threshold;
其中,所述第一内存分配阈值等于所述虚拟机实际占用内存与所述最大自由内存之和;The first memory allocation threshold is equal to a sum of an actual occupied memory of the virtual machine and the maximum free memory;
所述第二内存分配阈值等于所述虚拟机实际占用内存与所述最小自由内存之和;The second memory allocation threshold is equal to a sum of an actual occupied memory of the virtual machine and the minimum free memory;
所述第三内存分配阈值等于所述内存下限值与所述最大自由内存之和;The third memory allocation threshold is equal to a sum of the memory lower limit value and the maximum free memory;
所述第四内存分配阈值等于所述内存下限值与所述最小自由内存之和;The fourth memory allocation threshold is equal to a sum of the memory lower limit value and the minimum free memory;
所述可用内存等于所述物理机实际内存减去所述物理机上虚拟机和操作系统占用内存。The available memory is equal to the physical memory of the physical machine minus the memory occupied by the virtual machine and the operating system on the physical machine.
本申请还提供一种电子设备,包括:The application also provides an electronic device, including:
存储器,以及处理器;Memory, and processor;
所述存储器用于存储计算机可执行指令,所述处理器用于执行所述计算机可执行指令:The memory is for storing computer executable instructions for executing the computer executable instructions:
根据物理机的资源调度指令中包含的配置参数,计算所述资源调度指令的目标内存调度区间;Calculating a target memory scheduling interval of the resource scheduling instruction according to a configuration parameter included in a resource scheduling instruction of the physical machine;
判断所述物理机上的可用内存是否处于所述目标内存调度区间对应范围内,若是,根据所述配置参数在所述物理机上为所述资源调度指令分配虚拟机,并将所述可用内存
分配给所述虚拟机。Determining whether the available memory on the physical machine is within the corresponding range of the target memory scheduling interval, and if yes, allocating a virtual machine to the resource scheduling instruction on the physical machine according to the configuration parameter, and using the available memory
Assigned to the virtual machine.
与现有技术相比,本申请具有以下优点:Compared with the prior art, the present application has the following advantages:
本申请提供的虚拟机内存资源的调度方法,包括:根据物理机的资源调度指令中包含的配置参数,计算所述资源调度指令的目标内存调度区间;判断所述物理机上的可用内存是否处于所述目标内存调度区间对应范围内,若是,执行下一步;根据所述配置参数在所述物理机上为所述资源调度指令分配虚拟机,并将所述可用内存分配给所述虚拟机。The method for scheduling a virtual machine memory resource provided by the present application includes: calculating a target memory scheduling interval of the resource scheduling instruction according to a configuration parameter included in a resource scheduling instruction of the physical machine; and determining whether the available memory on the physical machine is in the Within the corresponding range of the target memory scheduling interval, if yes, performing the next step; allocating a virtual machine to the resource scheduling instruction on the physical machine according to the configuration parameter, and allocating the available memory to the virtual machine.
本申请提供的所述虚拟机内存资源的调度方法,根据资源调度指令中包含的配置参数计算所述资源调度指令的目标内存调度区间,并通过判断所述物理机上的可用内存是否处于所述目标内存调度区间对应范围内,来判断所述可用内存是否能够满足所述资源调度指令对内存资源的需求,若是,则根据所述配置参数在所述物理机上为所述资源调度指令分配虚拟机,并将所述可用内存分配给所述虚拟机,利用所述配置参数对所述物理机上的虚拟机的内存资源的调度管理更加精准,减少了所述物理机上闲置的内存资源,对内存资源的调度管理更加全面,从而提升了内存资源的利用率。The method for scheduling the virtual machine memory resource provided by the application, calculates a target memory scheduling interval of the resource scheduling instruction according to a configuration parameter included in the resource scheduling instruction, and determines whether the available memory on the physical machine is in the target And determining, in the corresponding range of the memory scheduling interval, whether the available memory can meet the requirement of the resource scheduling instruction for the memory resource, and if yes, assigning the virtual machine to the resource scheduling instruction on the physical machine according to the configuration parameter, And allocating the available memory to the virtual machine, and using the configuration parameter to perform scheduling management on a memory resource of the virtual machine on the physical machine, and reducing idle memory resources on the physical machine, and Scheduling management is more comprehensive, which improves the utilization of memory resources.
附图1是本申请提供的一种虚拟机内存资源的调度方法实施例的处理流程图;1 is a process flowchart of an embodiment of a method for scheduling virtual machine memory resources provided by the present application;
附图2是本申请提供的一种虚拟机内存资源的调度装置实施例的示意图;2 is a schematic diagram of an embodiment of a scheduling device for a virtual machine memory resource provided by the present application;
附图3是本申请提供的一种电子设备实施例的示意图。3 is a schematic diagram of an embodiment of an electronic device provided by the present application.
在下面的描述中阐述了很多具体细节以便于充分理解本申请。但是本申请能够以很多不同于在此描述的其他方式来实施,本领域技术人员可以在不违背本申请内涵的情况下做类似推广,因此本申请不受下面公开的具体实施的限制。Numerous specific details are set forth in the description below in order to provide a thorough understanding of the application. However, the present invention can be implemented in many other ways than those described herein, and those skilled in the art can make similar promotion without departing from the scope of the present application, and thus the present application is not limited by the specific embodiments disclosed below.
本申请提供一种虚拟机内存资源的调度方法,本申请还提供一种虚拟机内存资源的调度装置,以及一种电子设备。以下分别结合本申请提供的实施例的附图逐一进行详细说明,并且对方法的各个步骤进行说明。The present application provides a scheduling method for a virtual machine memory resource, and the present application further provides a scheduling device for a virtual machine memory resource, and an electronic device. The following is a detailed description of the embodiments of the embodiments provided herein, and the various steps of the method are explained.
本申请提供的一种虚拟机内存资源的调度方法实施例如下:The method for scheduling a virtual machine memory resource provided by the present application is as follows:
参照附图1,其示出了本申请提供的一种虚拟机内存资源的调度方法实施例的处理流程图,此外,所述虚拟机内存资源的调度方法实施例的各个步骤之间的关系,请根据
附图1确定。1 is a flowchart of processing a method for scheduling a virtual machine memory resource provided by the present application, and further, a relationship between steps of the virtual machine memory resource scheduling method embodiment, Please according to
Figure 1 is determined.
步骤S101,根据物理机的资源调度指令中包含的配置参数,计算所述资源调度指令的目标内存调度区间。Step S101: Calculate a target memory scheduling interval of the resource scheduling instruction according to a configuration parameter included in a resource scheduling instruction of the physical machine.
本申请实施例所述资源调度指令,是指向物理机发送的用于调度物理机上虚拟机物理内存的调度指令。例如,外部的业务方在申请内存资源时发送的调度指令。所述资源调度指令中包含有具体调用的虚拟机的配置参数。所述配置参数包括:虚拟机的数目、标识、内存下限值、内存上限值、最小自由内存和最大自由内存。The resource scheduling instruction in the embodiment of the present application is a scheduling instruction sent by a physical machine for scheduling physical memory of a virtual machine on a physical machine. For example, a dispatch instruction sent by an external business party when applying for a memory resource. The resource scheduling instruction includes configuration parameters of the specifically invoked virtual machine. The configuration parameters include: the number of virtual machines, the identifier, the lower limit of the memory, the upper limit of the memory, the minimum free memory, and the maximum free memory.
其中,所述虚拟机的数目是指需要调度的虚拟机的个数,通过所述标识来区分需要调度的各个虚拟机。The number of the virtual machines refers to the number of virtual machines that need to be scheduled, and the identifiers are used to distinguish each virtual machine that needs to be scheduled.
所述内存下限值是指分配给虚拟机的最小内存,在实际中,所述内存下限值可能是虚拟机在所述物理机上运行所需的最小物理内存,这部分物理内存是必须满足的,否则虚拟机可能无法启动。The lower limit of the memory refers to the minimum memory allocated to the virtual machine. In practice, the lower limit of the memory may be the minimum physical memory required for the virtual machine to run on the physical machine. This part of the physical memory must be satisfied. Otherwise, the virtual machine may not be able to start.
所述内存上限值是指分配给虚拟机的最大内存,在实际中,所述内存上限值可能是虚拟机在所述物理机上运行且达到最大负载时所需的最大物理内存,在所述物理机上的内存资源较为紧张的情况下,可通过压缩所述内存上限值实现对物理内存的调度。The upper memory limit value refers to the maximum memory allocated to the virtual machine. In practice, the upper memory limit value may be the maximum physical memory required for the virtual machine to run on the physical machine and reach the maximum load. When the memory resources on the physical machine are relatively tight, the physical memory can be scheduled by compressing the upper memory limit.
所述最小自由内存是指为了保证虚拟机的最差性能所需的物理内存(其中不包括虚拟机自身运行所需的物理内存),在对所述物理机上的内存资源进行调度时,这部分物理内存不会被压缩,因为一旦虚拟机的最小自由内存被压缩,虚拟机很可能因无法满足最小负载出现宕机等故障。The minimum free memory refers to the physical memory required to ensure the worst performance of the virtual machine (excluding the physical memory required for the virtual machine itself to run), when scheduling the memory resources on the physical machine, this part Physical memory is not compressed, because once the virtual machine's minimum free memory is compressed, the virtual machine is likely to fail due to failure to meet the minimum load.
所述最大自由内存是指在内存资源较为充足时分配给虚拟机的物理内存(其中不包括虚拟机自身运行所需的物理内存),在所述物理机上的内存资源较为紧张的情况下,可通过压缩所述最大自由内存实现对物理内存的调度。The maximum free memory refers to the physical memory allocated to the virtual machine when the memory resources are sufficient (excluding the physical memory required for the virtual machine itself to run), and when the memory resources on the physical machine are relatively tight, Scheduling physical memory by compressing the maximum free memory.
例如,资源调度指令A中包含的配置参数具体如下:For example, the configuration parameters included in the resource scheduling instruction A are as follows:
虚拟机的数目N:5;The number of virtual machines is N: 5;
内存下限值lower:10G;Lower memory limit lower: 10G;
内存上限值upper:20G;The upper limit of memory is upper: 20G;
最小自由内存lower_free:1G;Minimum free memory lower_free: 1G;
最大自由内存upper_free:2G。Maximum free memory upper_free: 2G.
或者,资源调度指令B中包含的配置参数具体如下:Alternatively, the configuration parameters included in the resource scheduling instruction B are as follows:
虚拟机的数目N:4;
The number of virtual machines is N: 4;
标识:vm1、vm2、vm3和vm4;Identification: vm1, vm2, vm3 and vm4;
vm1内存下限值lower:1G,内存上限值upper:2G,最小自由内存lower_free:100M,最大自由内存upper_free:200M;Vm1 memory lower limit lower: 1G, memory upper limit upper: 2G, minimum free memory lower_free: 100M, maximum free memory upper_free: 200M;
vm2内存下限值lower:1G,内存上限值upper:2G,最小自由内存lower_free:100M,最大自由内存upper_free:200M;Vm2 memory lower limit lower: 1G, memory upper limit upper: 2G, minimum free memory lower_free: 100M, maximum free memory upper_free: 200M;
vm3内存下限值lower:10G,内存上限值upper:20G,最小自由内存lower_free:1G,最大自由内存upper_free:2G;Vm3 memory lower limit lower: 10G, memory upper limit upper: 20G, minimum free memory lower_free: 1G, maximum free memory upper_free: 2G;
vm4内存下限值lower:10G,内存上限值upper:20G,最小自由内存lower_free:1G,最大自由内存upper_free:2G。Vm4 memory lower limit lower: 10G, memory upper limit upper: 20G, minimum free memory lower_free: 1G, maximum free memory upper_free: 2G.
需要说明的是,对所述物理机上各虚拟机的物理内存进行调度的前提是:所述物理机上各虚拟机的物理内存能够支持其启动,并且所述物理机上内存资源处于紧张状态,即:分配给虚拟机的物理内存大于所述内存下限值,并且小于所述内存上限值,在这种情况下,需要对所述物理机上的各虚拟机的物理内存进行调度。基于此,所述目标内存调度区间,是指可以对所述物理机上各虚拟机的物理内存进行调度需要满足的调度条件,所述目标内存调度区间设置有上限值和下限值,其中,所述目标内存调度区间的下限值,等于所述资源调度指令中包含的各虚拟机的内存下限值之和;所述目标内存调度区间的上限值,等于所述资源调度指令中包含的各虚拟机的内存上限值之和。It should be noted that the physical memory of each virtual machine on the physical machine is scheduled to be: the physical memory of each virtual machine on the physical machine can support its startup, and the memory resources on the physical machine are in a state of tension, that is: The physical memory allocated to the virtual machine is greater than the lower memory limit and smaller than the upper memory limit. In this case, the physical memory of each virtual machine on the physical machine needs to be scheduled. Based on this, the target memory scheduling interval refers to a scheduling condition that can be satisfied for scheduling physical memory of each virtual machine on the physical machine, where the target memory scheduling interval is set with an upper limit value and a lower limit value, where The lower limit value of the target memory scheduling interval is equal to the sum of the memory lower limit values of the virtual machines included in the resource scheduling instruction; the upper limit value of the target memory scheduling interval is equal to the resource scheduling instruction The sum of the memory upper limits of each virtual machine.
例如,上述资源调度指令A包含的配置参数为:虚拟机的数目N:5;内存下限值lower:10G;内存上限值upper:20G;最小自由内存lower_free:1G;最大自由内存upper_free:2G;For example, the configuration parameters included in the resource scheduling instruction A are: the number of virtual machines N: 5; the lower limit of memory lower: 10G; the upper limit of memory upper: 20G; the minimum free memory lower_free: 1G; the maximum free memory upper_free: 2G ;
则目标内存调度区间的下限值为:lower*5=10G*5=50G;Then the lower limit of the target memory scheduling interval is lower*5=10G*5=50G;
目标内存调度区间的上限值为:upper*5=20G*5=100G。The upper limit of the target memory scheduling interval is: upper*5=20G*5=100G.
在具体实施时,对于所述物理机上部署的虚拟机,可按照预设排列顺序进行部署,如果按照预设排列顺序在所述物理机上部署所述虚拟机,则居于首位的虚拟机具有调度其他虚拟机内存的权限。例如,物理机上部署的10个虚拟机:vm1至vm10,其中,vm1具有管理vm2至vm10的权限。In a specific implementation, the virtual machines deployed on the physical machine may be deployed in a preset sequence. If the virtual machine is deployed on the physical machine according to a preset sequence, the virtual machine in the first place has scheduling other Permissions for virtual machine memory. For example, 10 virtual machines deployed on a physical machine: vm1 to vm10, wherein vm1 has the authority to manage vm2 to vm10.
步骤S102,判断所述物理机上的可用内存是否处于所述目标内存调度区间对应范围内。Step S102, determining whether the available memory on the physical machine is within the corresponding range of the target memory scheduling interval.
在具体实施时,在本步骤执行之前,执行可用内存计算操作,来计算所述物理机上的可用内存,所述可用内存,等于所述物理机实际内存减去所述物理机上虚拟机和操作
系统占用内存,即:In a specific implementation, before the execution of this step, an available memory computing operation is performed to calculate available memory on the physical machine, the available memory is equal to the physical memory of the physical machine minus the virtual machine and the operation on the physical machine.
The system occupies memory, ie:
可用内存memory_used=物理机实际内存host_total-虚拟机占用内存-操作系统占用内存host_used;Available memory memory_used=physical machine actual memory host_total-virtual machine memory - The operating system occupies memory host_used;
其中,n为物理机上虚拟机的数目。Where n is the number of virtual machines on the physical machine.
基于此,根据上述计算的所述物理机的可用内存,以及根据上述步骤S101获得的所述目标内存调度区间,本步骤中,判断所述物理机上的可用内存是否处于所述目标内存调度区间对应范围内,具体实现如下:Based on the above, the available memory of the physical machine calculated according to the above, and the target memory scheduling interval obtained according to the above step S101, in this step, determining whether the available memory on the physical machine is in the target memory scheduling interval. Within the scope, the specific implementation is as follows:
判断所述可用内存是否小于所述目标内存调度区间的上限值;Determining whether the available memory is less than an upper limit value of the target memory scheduling interval;
若小于,判断所述可用内存是否大于或者等于所述目标内存调度区间的下限值;If it is smaller, determining whether the available memory is greater than or equal to a lower limit value of the target memory scheduling interval;
若是,执行下述步骤S103,根据所述配置参数在所述物理机上为所述资源调度指令分配虚拟机,并将所述可用内存分配给所述虚拟机;If yes, performing the following step S103, allocating a virtual machine to the resource scheduling instruction on the physical machine according to the configuration parameter, and allocating the available memory to the virtual machine;
若否,则表明针对当前的所述资源调度指令,所述物理机上的内存资源无法满足所述资源调度指令对内存资源的需求,发出内存不足的提醒消息。If not, it indicates that, for the current resource scheduling instruction, the memory resource on the physical machine cannot meet the requirement of the resource scheduling instruction for the memory resource, and sends a reminder message that the memory is insufficient.
例如,上述5个虚拟机的内存下限值lower均为10G,目标内存调度区间的下限值为50G;可用内存memory_used为48G,小于目标内存调度区间的下限值,在启动前4台虚拟机的时候,每台虚拟机分配的内存为10G,在启动第5台虚拟机的时候,由于物理机上的剩余内存8G小于内存下限值lower10G,因此第5台虚拟机无法启动,则表示物理机上的内存资源没有办法满足当前资源调度指令,不再针对当前资源调度指令启动虚拟机以及进行内存分配,发出内存不足的提醒消息。For example, the lower limit of the memory of the above five virtual machines is 10G, the lower limit of the target memory scheduling interval is 50G; the available memory memory_used is 48G, which is less than the lower limit of the target memory scheduling interval, and 4 virtual before the startup. When the machine is running, the memory allocated by each virtual machine is 10G. When the fifth virtual machine is started, because the remaining memory 8G on the physical machine is less than the lower limit of the memory lower10G, the fifth virtual machine cannot be started, indicating that the physical There is no way for the memory resources on the machine to satisfy the current resource scheduling instruction. The virtual machine is no longer started for the current resource scheduling instruction and the memory allocation is performed, and a reminder message for insufficient memory is issued.
若大于或者等于所述目标内存调度区间的上限值,则表明针对当前的所述资源调度指令,所述物理机上的内存资源时充足的,在所述物理机上的各虚拟机之间没有资源争抢,可满足所述资源调度指令中包含的各虚拟机对内存资源的最大需求,在此,针对所述配置参数中每一个虚拟机,按照所述内存上限值为所述配置参数中每一个虚拟机分配内存,即向所述配置参数中每一个虚拟机分配内存上限值对应的最大物理内存。If it is greater than or equal to the upper limit value of the target memory scheduling interval, it indicates that, for the current resource scheduling instruction, the memory resources on the physical machine are sufficient, and there is no resource between the virtual machines on the physical machine. Competing for the maximum demand for memory resources of each virtual machine included in the resource scheduling instruction, where, for each virtual machine in the configuration parameter, the memory upper limit value is used in the configuration parameter. Each virtual machine allocates memory, that is, allocates the maximum physical memory corresponding to the upper limit of the memory to each virtual machine in the configuration parameter.
例如,上述5个虚拟机的内存上限值upper均为20G,目标内存调度区间的上限值为100G;可用内存memory_used为120G,大于目标内存调度区间的上限值100G,则针对每一个虚拟机,分别向其分配20G的物理内存。For example, the upper limit of the upper limit of the above five virtual machines is 20G, and the upper limit of the target memory scheduling interval is 100G; the available memory memory_used is 120G, which is greater than the upper limit of the target memory scheduling interval of 100G, for each virtual Machines, respectively, allocate 20G of physical memory.
此外,在具体实施时,本步骤所述的判断所述物理机上的可用内存是否处于所述目标内存调度区间对应范围内,除本实施例提供的上述实现方式之外,还可以采用其他方
式实现,例如,判断所述可用内存是否大于或者等于所述目标内存调度区间的下限值;若大于或者等于所述目标内存调度区间的下限值,判断所述可用内存是否小于所述目标内存调度区间的上限值;若小于,执行下述步骤S103,根据所述配置参数在所述物理机上为所述资源调度指令分配虚拟机,并将所述可用内存分配给所述虚拟机;若大于或者等于所述目标内存调度区间的上限值,按照所述内存上限值为所述配置参数中每一个虚拟机分配内存;若小于所述目标内存调度区间的下限值,则表明针对当前的所述资源调度指令,所述物理机上的内存资源无法满足所述资源调度指令对内存资源的需求,发出内存不足的提醒消息。In addition, in a specific implementation, it is determined whether the available memory on the physical machine is in the range corresponding to the target memory scheduling interval, and other parties may be used in addition to the foregoing implementation manner provided in this embodiment.
For example, determining whether the available memory is greater than or equal to a lower limit value of the target memory scheduling interval; if greater than or equal to a lower limit value of the target memory scheduling interval, determining whether the available memory is smaller than the target An upper limit value of the memory scheduling interval; if less, performing the following step S103, allocating a virtual machine to the resource scheduling instruction on the physical machine according to the configuration parameter, and allocating the available memory to the virtual machine; If it is greater than or equal to the upper limit value of the target memory scheduling interval, the memory upper limit value is allocated to each virtual machine in the configuration parameter; if less than the lower limit value of the target memory scheduling interval, it indicates For the current resource scheduling instruction, the memory resource on the physical machine cannot meet the requirement of the resource scheduling instruction for the memory resource, and sends a reminder message that the memory is insufficient.
步骤S103,根据所述配置参数在所述物理机上为所述资源调度指令分配虚拟机,并将所述可用内存分配给所述虚拟机。Step S103: Allocate a virtual machine for the resource scheduling instruction on the physical machine according to the configuration parameter, and allocate the available memory to the virtual machine.
本步骤得以实施的前提是上述步骤S02判断所述物理机上的可用内存是否处于所述目标内存调度区间对应范围内的判断结果为是,即所述物理机上的可用内存小于所述目标内存调度区间的上限值,并且大于或者等于所述目标内存调度区间的下限值。本步骤中,根据所述配置参数在所述物理机上为所述资源调度指令分配虚拟机,并将所述可用内存分配给所述虚拟机,具体实现如下:The premise that the step is implemented is that the step S02 determines whether the available memory on the physical machine is within the corresponding range of the target memory scheduling interval, that is, the available memory on the physical machine is smaller than the target memory scheduling interval. The upper limit value is greater than or equal to the lower limit value of the target memory scheduling interval. In this step, a virtual machine is allocated to the resource scheduling instruction on the physical machine according to the configuration parameter, and the available memory is allocated to the virtual machine, and the specific implementation is as follows:
针对所述配置参数中每一个虚拟机,分别执行下述内存分配操作,并且每分配一个虚拟机,计算一次所述物理机的可用内存,并将计算获得的所述可用内存代入下述内存分配操作:Performing the following memory allocation operation for each virtual machine in the configuration parameter, and calculating the available memory of the physical machine once for each virtual machine, and substituting the calculated available memory into the following memory allocation operating:
1)根据所述配置参数以及所述配置参数中每一个虚拟机实际占用内存,分别计算所述配置参数中每一个虚拟机的第一内存分配阈值、第二内存分配阈值、第三内存分配阈值和第四内存分配阈值;1) calculating, according to the configuration parameter and the actual occupied memory of each virtual machine in the configuration parameter, a first memory allocation threshold, a second memory allocation threshold, and a third memory allocation threshold of each virtual machine in the configuration parameter. And a fourth memory allocation threshold;
其中,所述第一内存分配阈值等于所述虚拟机实际占用内存与所述最大自由内存之和;所述第二内存分配阈值等于所述虚拟机实际占用内存与所述最小自由内存之和;所述第三内存分配阈值等于所述内存下限值与所述最大自由内存之和;所述第四内存分配阈值等于所述内存下限值与所述最小自由内存之和。The first memory allocation threshold is equal to a sum of an actual occupied memory of the virtual machine and the maximum free memory; and the second memory allocation threshold is equal to a sum of an actual occupied memory of the virtual machine and the minimum free memory; The third memory allocation threshold is equal to a sum of the memory lower limit value and the maximum free memory; and the fourth memory allocation threshold is equal to a sum of the memory lower limit value and the minimum free memory.
例如,针对虚拟机vm1:For example, for virtual machine vm1:
第一内存分配阈值memory_value1=实际占用内存memory_current+最大自由内存upper_free=14G+2G=16G;The first memory allocation threshold memory_value1=the actual occupied memory memory_current+the largest free memory upper_free=14G+2G=16G;
第二内存分配阈值memory_value2=实际占用内存memory_current+最小自由内存lower_free=14G+1G=15G;
The second memory allocation threshold memory_value2=the actual occupied memory memory_current+the minimum free memory lower_free=14G+1G=15G;
第三内存分配阈值memory_value3=内存下限值lower+最大自由内存upper_free=10G+2G=12G;The third memory allocation threshold memory_value3=memory lower limit lower+max free memory upper_free=10G+2G=12G;
第四内存分配阈值memory_value4=内存下限值lower+最小自由内存lower_free=10G+1G=11G。The fourth memory allocation threshold memory_value4=memory lower limit lower+minimum free memory lower_free=10G+1G=11G.
2)对所述剩余虚拟机的第一内存分配阈值、第二内存分配阈值、第三内存分配阈值和第四内存分配阈值分别进行求和;2) summing, respectively, a first memory allocation threshold, a second memory allocation threshold, a third memory allocation threshold, and a fourth memory allocation threshold of the remaining virtual machines;
3)判断所述可用内存是否大于或者等于所述第一内存分配阈值之和;3) determining whether the available memory is greater than or equal to a sum of the first memory allocation thresholds;
若大于或者等于所述第一内存分配阈值之和,按照所述第一内存分配阈值为所述虚拟机分配内存;If greater than or equal to the sum of the first memory allocation thresholds, allocate memory according to the first memory allocation threshold;
例如,上述资源调度指令A包含5个虚拟机的参数一致,则第一内存分配阈值memory_value1均为16G,第一内存分配阈值之和为16G*5=80G;For example, if the resource scheduling instruction A includes the parameters of the five virtual machines, the first memory allocation threshold memory_value1 is 16G, and the sum of the first memory allocation thresholds is 16G*5=80G;
假设物理机的可用内存memory_used为80G,等于第一内存分配阈值之和80G,则向第一个虚拟机vm1分配16G的物理内存;Assume that the available memory memory_used of the physical machine is 80G, which is equal to the sum of the first memory allocation thresholds of 80G, and allocates 16G physical memory to the first virtual machine vm1;
重复内存分配操作,依次获得虚拟机vm2至虚拟机vm5分配的内存均为16G。The memory allocation operation is repeated, and the memory allocated by the virtual machine vm2 to the virtual machine vm5 is 16G.
若小于所述第一内存分配阈值之和,执行下一步;If the sum is less than the sum of the first memory allocation thresholds, perform the next step;
4)判断所述可用内存是否大于或者等于所述第二内存分配阈值之和;4) determining whether the available memory is greater than or equal to a sum of the second memory allocation thresholds;
若大于或者等于所述第二内存分配阈值之和,按照所述第二内存分配阈值为所述虚拟机分配内存;If greater than or equal to the sum of the second memory allocation thresholds, allocate memory according to the second memory allocation threshold;
例如,上述资源调度指令A包含5个虚拟机的参数一致,则第二内存分配阈值memory_value1均为15G,第一内存分配阈值之和为15G*5=75G;For example, if the resource scheduling instruction A includes the parameters of the five virtual machines, the second memory allocation threshold memory_value1 is 15G, and the sum of the first memory allocation thresholds is 15G*5=75G;
假设物理机的可用内存memory_used为79G,大于第二内存分配阈值之和75G,则向第一个虚拟机vm1分配15G的物理内存;Assume that the available memory memory_used of the physical machine is 79G, which is greater than the sum of the second memory allocation threshold and 75G, and allocates 15G physical memory to the first virtual machine vm1;
重复内存分配操作,依次获得虚拟机vm2至虚拟机vm5分配的内存均为16G。The memory allocation operation is repeated, and the memory allocated by the virtual machine vm2 to the virtual machine vm5 is 16G.
若小于所述第二内存分配阈值之和,执行下一步;If the sum is less than the sum of the second memory allocation thresholds, perform the next step;
5)判断所述可用内存是否大于或者等于所述第三内存分配阈值之和;5) determining whether the available memory is greater than or equal to a sum of the third memory allocation thresholds;
若大于或者等于所述第三内存分配阈值之和,按照所述第三内存分配阈值为所述虚拟机分配内存;If greater than or equal to the sum of the third memory allocation thresholds, allocate memory according to the third memory allocation threshold;
例如,上述资源调度指令A包含5个虚拟机的参数一致,则第三内存分配阈值memory_value1均为12G,第一内存分配阈值之和为12G*5=60G;For example, if the resource scheduling instruction A includes the parameters of the five virtual machines, the third memory allocation threshold memory_value1 is 12G, and the sum of the first memory allocation thresholds is 12G*5=60G;
假设物理机的可用内存memory_used为69G,大于第三内存分配阈值之和60G,则
向第一个虚拟机vm1分配12G的物理内存;Assume that the available memory memory_used of the physical machine is 69G, which is greater than the sum of the third memory allocation threshold and 60G.
Allocate 12G of physical memory to the first virtual machine vm1;
重复内存分配操作,依次获得虚拟机vm2至虚拟机vm5分配的内存依次为:12G、15G、15G、15G。The memory allocation operation is repeated, and the memory allocated by the virtual machine vm2 to the virtual machine vm5 is sequentially: 12G, 15G, 15G, and 15G.
若小于所述第三内存分配阈值之和,执行下一步;If the sum is less than the sum of the third memory allocation thresholds, perform the next step;
6)判断所述可用内存是否大于或者等于所述第四内存分配阈值之和;6) determining whether the available memory is greater than or equal to a sum of the fourth memory allocation threshold;
若大于或者等于所述第四内存分配阈值之和,按照所述第四内存分配阈值为所述虚拟机分配内存;If greater than or equal to the sum of the fourth memory allocation thresholds, allocate memory according to the fourth memory allocation threshold;
例如,上述资源调度指令A包含5个虚拟机的参数一致,则第四内存分配阈值memory_value1均为11G,第一内存分配阈值之和为11G*5=55G;For example, if the resource scheduling instruction A includes the parameters of the five virtual machines, the fourth memory allocation threshold memory_value1 is 11G, and the sum of the first memory allocation thresholds is 11G*5=55G;
假设物理机的可用内存memory_used为57G,大于第四内存分配阈值之和60G,则向第一个虚拟机vm1分配11G的物理内存;Assume that the available memory memory_used of the physical machine is 57G, which is greater than the sum of the fourth memory allocation threshold of 60G, and allocates 11G physical memory to the first virtual machine vm1;
重复内存分配操作,依次获得虚拟机vm2至虚拟机vm5分配的内存依次为:11G、11G、12G、12G。The memory allocation operation is repeated, and the memory allocated by the virtual machine vm2 to the virtual machine vm5 is sequentially: 11G, 11G, 12G, and 12G.
若否,不作处理即可。If not, no treatment is required.
在具体实施时,所述内存分配操作中各步骤的执行先后顺序并限于上述实现方式,还可以采用其他类似方式实现,比如上述内存分配操作中,首先判断所述可用内存是否大于或者等于所述第四内存分配阈值之和,然后依次判断所述可用内存是否大于或者等于所述第三内存分配阈值之和,以及所述可用内存是否大于或者等于所述第二内存分配阈值之和,最后判断所述可用内存是否大于或者等于所述第一内存分配阈值之和。In a specific implementation, the execution sequence of each step in the memory allocation operation is limited to the foregoing implementation manner, and may be implemented in other similar manners. For example, in the foregoing memory allocation operation, first determining whether the available memory is greater than or equal to the foregoing. a sum of the fourth memory allocation thresholds, and then sequentially determining whether the available memory is greater than or equal to a sum of the third memory allocation thresholds, and whether the available memory is greater than or equal to a sum of the second memory allocation thresholds, and finally determining Whether the available memory is greater than or equal to a sum of the first memory allocation thresholds.
在实际应用中,可以采用多种具体的实现方式,实现所述内存分配操作。实现所述内存分配操作的各种形式的变化,都只是具体实现方式的变更,都不偏离本申请的核心,因此都在本申请的保护范围之内。例如下述提供所述内存分配操作的几种实现方式:In practical applications, the memory allocation operation can be implemented by using various specific implementation manners. The various forms of the implementation of the memory allocation operation are only changes of the specific implementation, and do not deviate from the core of the present application, and therefore are within the protection scope of the present application. For example, the following provides several implementations of the memory allocation operation:
1)根据所述最大自由内存,以及获取的所述配置参数中每一个虚拟机实际占用内存,分别计算所述配置参数中每一个虚拟机的第一内存分配阈值;1) calculating, according to the maximum free memory, and the actual occupied memory of each virtual machine in the obtained configuration parameters, respectively calculating a first memory allocation threshold of each virtual machine in the configuration parameter;
对所述配置参数中所有虚拟机的第一内存分配阈值进行求和;And summing a first memory allocation threshold of all virtual machines in the configuration parameter;
判断所述可用内存是否大于或者等于所述第一内存分配阈值之和,若是,执行下一步;Determining whether the available memory is greater than or equal to a sum of the first memory allocation thresholds, and if yes, performing the next step;
按照所述第一内存分配阈值将所述可用内存分配给所述配置参数中所有虚拟机;或者,将所述可用内存平均分配给所述配置参数中所有虚拟机;或者,按照所述虚拟机实际占用内存的数值大小,优先将所述可用内存分配给实际占用内存的数值较大的虚拟机;
Allocating the available memory to all virtual machines in the configuration parameter according to the first memory allocation threshold; or distributing the available memory evenly to all virtual machines in the configuration parameter; or, according to the virtual machine Actually occupying the value of the memory, and preferentially allocating the available memory to a virtual machine having a large value that actually occupies the memory;
其中,所述第一内存分配阈值等于所述最大自由内存与所述虚拟机实际占用内存之和。The first memory allocation threshold is equal to a sum of the maximum free memory and an actual occupied memory of the virtual machine.
2)根据所述最小自由内存,以及获取的所述配置参数中每一个虚拟机实际占用内存,分别计算所述配置参数中每一个虚拟机的第二内存分配阈值;2) calculating a second memory allocation threshold of each virtual machine in the configuration parameter according to the minimum free memory and the actual occupied memory of each virtual machine in the obtained configuration parameter;
对所述配置参数中所有虚拟机的第二内存分配阈值进行求和;And summing a second memory allocation threshold of all virtual machines in the configuration parameter;
判断所述可用内存是否大于或者等于所述第二内存分配阈值之和,若是,执行下一步;Determining whether the available memory is greater than or equal to a sum of the second memory allocation thresholds; if yes, performing the next step;
按照所述第二内存分配阈值将所述可用内存分配给所述配置参数中所有虚拟机;或者,将所述可用内存平均分配给所述配置参数中所有虚拟机;或者,按照所述虚拟机实际占用内存的数值大小,优先将所述可用内存分配给实际占用内存的数值较大的虚拟机;Allocating the available memory to all virtual machines in the configuration parameter according to the second memory allocation threshold; or equally allocating the available memory to all virtual machines in the configuration parameter; or, according to the virtual machine Actually occupying the value of the memory, and preferentially allocating the available memory to a virtual machine having a large value that actually occupies the memory;
其中,所述第二内存分配阈值等于所述最小自由内存与所述虚拟机实际占用内存之和。The second memory allocation threshold is equal to a sum of the minimum free memory and an actual occupied memory of the virtual machine.
3)根据所述内存下限值和所述最大自由内存,分别计算所述配置参数中每一个虚拟机的第三内存分配阈值;3) calculating, according to the memory lower limit value and the maximum free memory, a third memory allocation threshold of each virtual machine in the configuration parameter;
对所述配置参数中所有虚拟机的第三内存分配阈值进行求和;And summing a third memory allocation threshold of all virtual machines in the configuration parameter;
判断所述可用内存是否大于或者等于所述第三内存分配阈值之和,若是,执行下一步;Determining whether the available memory is greater than or equal to a sum of the third memory allocation thresholds, and if yes, performing the next step;
按照所述第三内存分配阈值将所述可用内存分配给所述配置参数中所有虚拟机;或者,将所述可用内存平均分配给所述配置参数中所有虚拟机;或者,按照所述虚拟机实际占用内存的数值大小,优先将所述可用内存分配给实际占用内存的数值较大的虚拟机;Allocating the available memory to all virtual machines in the configuration parameter according to the third memory allocation threshold; or distributing the available memory evenly to all virtual machines in the configuration parameter; or, according to the virtual machine Actually occupying the value of the memory, and preferentially allocating the available memory to a virtual machine having a large value that actually occupies the memory;
其中,所述第三内存分配阈值等于所述内存下限值与所述最大自由内存之和。The third memory allocation threshold is equal to a sum of the memory lower limit value and the maximum free memory.
4)根据所述内存下限值和所述最小自由内存,分别计算所述配置参数中每一个虚拟机的第四内存分配阈值;4) calculating, according to the memory lower limit value and the minimum free memory, a fourth memory allocation threshold of each virtual machine in the configuration parameter;
对所述配置参数中所有虚拟机的第四内存分配阈值进行求和;And summing a fourth memory allocation threshold of all virtual machines in the configuration parameter;
判断所述可用内存是否大于或者等于所述第四内存分配阈值之和,若是,执行下一步;Determining whether the available memory is greater than or equal to a sum of the fourth memory allocation threshold, and if yes, performing the next step;
按照所述第四内存分配阈值将所述可用内存分配给所述配置参数中所有虚拟机;或者,将所述可用内存平均分配给所述配置参数中所有虚拟机;或者,按照所述虚拟机实际占用内存的数值大小,优先将所述可用内存分配给实际占用内存的数值较大的虚拟机;Allocating the available memory to all virtual machines in the configuration parameter according to the fourth memory allocation threshold; or distributing the available memory evenly to all virtual machines in the configuration parameter; or, according to the virtual machine Actually occupying the value of the memory, and preferentially allocating the available memory to a virtual machine having a large value that actually occupies the memory;
其中,所述第四内存分配阈值等于所述内存下限值与所述最小自由内存之和。
The fourth memory allocation threshold is equal to a sum of the memory lower limit value and the minimum free memory.
此外,在具体实施时,在本步骤执行之后,执行内存检测操作,实现对所述物理机上内存资源的动态调度,减少所述物理机上闲置的内存资源,从而来提升所述物理机上内存资源的利用率。所述内存检测操作具体实现:In addition, in a specific implementation, after the execution of the step, performing a memory detection operation, implementing dynamic scheduling of memory resources on the physical machine, and reducing idle memory resources on the physical machine, thereby improving memory resources on the physical machine. Utilization rate. The memory detection operation is specifically implemented:
按照预设检测周期对所述物理机上的虚拟机进行检测,当检测到所述物理机上的虚拟机释放内存后,执行下述步骤:The virtual machine on the physical machine is detected according to a preset detection period. After detecting that the virtual machine on the physical machine releases the memory, perform the following steps:
根据所述物理机上的虚拟机实际占用内存和所述内存上限值,判断所述虚拟机的实际占用内存是否小于所述内存上限值,若是,将所述物理机上释放的内存分配给所述虚拟机。Determining, according to the actual occupied memory of the virtual machine on the physical machine and the upper limit of the memory, whether the actual occupied memory of the virtual machine is smaller than the upper limit of the memory, and if so, allocating the memory released on the physical machine to the Describe the virtual machine.
在实际应用中,可根据实际业务需求调整所述预设检测周期,从而实现对所述内存检测操作的检测频率的控制,比如通过减小所述预设检测周期来加大所述内存检测操作的检测频率,加大对所述物理机上内存资源的调度管理,进一步减少所述物理机上闲置的内存资源,进一步提升所述物理机上内存资源的利用率;同时,基于所述内存检测操作可实现对所述物理机上内存资源的动态管理,从而实现内存资源的超卖,即实现虚拟机的超卖,增加营收。In an actual application, the preset detection period may be adjusted according to actual service requirements, thereby implementing control of the detection frequency of the memory detection operation, such as increasing the memory detection operation by reducing the preset detection period. The detection frequency increases the scheduling management of the memory resources on the physical machine, further reduces the idle memory resources on the physical machine, and further improves the utilization of the memory resources on the physical machine; meanwhile, based on the memory detection operation Dynamic management of memory resources on the physical machine, thereby achieving overselling of memory resources, that is, realizing overselling of virtual machines and increasing revenue.
综上所述,本申请提供的所述虚拟机内存资源的调度方法,根据资源调度指令中包含的配置参数计算所述资源调度指令的目标内存调度区间,并通过判断所述物理机上的可用内存是否处于所述目标内存调度区间对应范围内,来判断所述可用内存是否能够满足所述资源调度指令对内存资源的需求,若是,则根据所述配置参数在所述物理机上为所述资源调度指令分配虚拟机,并将所述可用内存分配给所述虚拟机,利用所述配置参数对所述物理机上的虚拟机的内存资源的调度管理更加精准,减少了所述物理机上闲置的内存资源,对内存资源的调度管理更加全面,从而提升了内存资源的利用率。In summary, the method for scheduling virtual machine memory resources provided by the present application calculates a target memory scheduling interval of the resource scheduling instruction according to configuration parameters included in the resource scheduling instruction, and determines available memory on the physical machine. Whether it is within the corresponding range of the target memory scheduling interval, to determine whether the available memory can satisfy the requirement of the resource scheduling instruction for the memory resource, and if so, scheduling the resource on the physical machine according to the configuration parameter The instruction allocates a virtual machine, and allocates the available memory to the virtual machine, and uses the configuration parameter to more accurately schedule and manage memory resources of the virtual machine on the physical machine, thereby reducing idle memory resources on the physical machine. The scheduling management of memory resources is more comprehensive, thereby improving the utilization of memory resources.
本申请提供的一种虚拟机内存资源的调度装置实施例如下:The scheduling device for a virtual machine memory resource provided by the present application is as follows:
在上述的实施例中,提供了一种虚拟机内存资源的调度方法,与之相对应的,本申请还提供了一种虚拟机内存资源的调度装置,下面结合附图进行说明。In the foregoing embodiment, a scheduling method for a virtual machine memory resource is provided. Correspondingly, the present application further provides a scheduling device for a virtual machine memory resource, which will be described below with reference to the accompanying drawings.
参照附图2,其示出了本申请提供的一种虚拟机内存资源的调度装置实施例的示意图。Referring to FIG. 2, a schematic diagram of an embodiment of a scheduling device for a virtual machine memory resource provided by the present application is shown.
由于装置实施例基本相似于方法实施例,所以描述得比较简单,相关的部分请参见上述提供的方法实施例的对应说明即可。下述描述的装置实施例仅仅是示意性的。Since the device embodiment is basically similar to the method embodiment, the description is relatively simple. For related parts, refer to the corresponding description of the method embodiment provided above. The device embodiments described below are merely illustrative.
本申请提供一种虚拟机内存资源的调度装置,包括:The application provides a scheduling device for a virtual machine memory resource, including:
目标内存调度区间计算单元201,用于根据物理机的资源调度指令中包含的配置参
数,计算所述资源调度指令的目标内存调度区间;The target memory scheduling interval calculating unit 201 is configured to: according to the configuration parameter included in the resource scheduling instruction of the physical machine
Calculating a target memory scheduling interval of the resource scheduling instruction;
内存分配判断单元202,用于判断所述物理机上的可用内存是否处于所述目标内存调度区间对应范围内,若是,运行内存分配单元203;The memory allocation determining unit 202 is configured to determine whether the available memory on the physical machine is within the corresponding range of the target memory scheduling interval, and if so, running the memory allocation unit 203;
所述内存分配单元203,用于根据所述配置参数在所述物理机上为所述资源调度指令分配虚拟机,并将所述可用内存分配给所述虚拟机。The memory allocation unit 203 is configured to allocate a virtual machine to the resource scheduling instruction on the physical machine according to the configuration parameter, and allocate the available memory to the virtual machine.
可选的,所述配置参数包括:Optionally, the configuration parameters include:
虚拟机的数目、标识、内存下限值、内存上限值、最小自由内存和最大自由内存。Number of virtual machines, identification, memory lower limit, memory upper limit, minimum free memory, and maximum free memory.
可选的,所述目标内存调度区间的下限值,等于所述资源调度指令中包含的各虚拟机的内存下限值之和;Optionally, a lower limit value of the target memory scheduling interval is equal to a sum of a memory lower limit value of each virtual machine included in the resource scheduling instruction;
所述目标内存调度区间的上限值,等于所述资源调度指令中包含的各虚拟机的内存上限值之和。The upper limit value of the target memory scheduling interval is equal to the sum of the memory upper limit values of the virtual machines included in the resource scheduling instruction.
可选的,所述虚拟机内存资源的调度装置,包括:Optionally, the scheduling device of the virtual machine memory resource includes:
释放内存检测单元,用于按照预设检测周期对所述物理机上的虚拟机进行检测,当检测到所述物理机上的虚拟机释放内存后,运行释放内存分配单元;The memory detecting unit is configured to detect the virtual machine on the physical machine according to a preset detection period, and after detecting that the virtual machine on the physical machine releases the memory, run the release memory allocation unit;
所述释放内存分配单元,用于根据所述物理机上的虚拟机实际占用内存和所述内存上限值,判断所述虚拟机的实际占用内存是否小于所述内存上限值,若是,将所述物理机上释放的内存分配给所述虚拟机。The release memory allocation unit is configured to determine, according to the actual occupied memory of the virtual machine on the physical machine and the upper limit of the memory, whether the actual occupied memory of the virtual machine is smaller than the upper limit of the memory, and if so, The memory released on the physical machine is allocated to the virtual machine.
可选的,所述内存分配单元203,包括:Optionally, the memory allocation unit 203 includes:
针对所述配置参数中每一个虚拟机,分别运行第一计算子单元、第二计算子单元和第一判断子单元,并且每分配一个虚拟机,计算一次所述物理机的可用内存,并将计算获得的所述可用内存代入所述第一判断子单元:Performing, for each virtual machine in the configuration parameter, a first computing subunit, a second computing subunit, and a first determining subunit, and calculating a available memory of the physical machine once for each virtual machine, and Computing the obtained available memory into the first determining subunit:
所述第一计算子单元,用于根据所述配置参数以及剩余虚拟机实际占用内存,分别计算所述剩余虚拟机的第一内存分配阈值、第二内存分配阈值、第三内存分配阈值和第四内存分配阈值;The first calculating subunit is configured to calculate, according to the configuration parameter and the actual occupied memory of the remaining virtual machine, a first memory allocation threshold, a second memory allocation threshold, a third memory allocation threshold, and a first Four memory allocation thresholds;
所述第二计算子单元,用于对所述剩余虚拟机的第一内存分配阈值、第二内存分配阈值、第三内存分配阈值和第四内存分配阈值分别进行求和;The second calculating subunit is configured to respectively sum the first memory allocation threshold, the second memory allocation threshold, the third memory allocation threshold, and the fourth memory allocation threshold of the remaining virtual machines;
所述第一判断子单元,用于判断所述可用内存是否大于或者等于所述第一内存分配阈值之和;The first determining subunit is configured to determine whether the available memory is greater than or equal to a sum of the first memory allocation thresholds;
若大于或者等于所述第一内存分配阈值之和,运行第一内存分配子单元;If the sum of the first memory allocation threshold is greater than or equal to, the first memory allocation subunit is operated;
所述第一内存分配子单元,用于按照所述第一内存分配阈值为所述虚拟机分配内存;
The first memory allocation subunit is configured to allocate memory according to the first memory allocation threshold;
若小于所述第一内存分配阈值之和,运行第二判断子单元;If the sum of the first memory allocation threshold is less than, the second determining subunit is operated;
所述第二判断子单元,用于判断所述可用内存是否大于或者等于所述第二内存分配阈值之和;The second determining subunit is configured to determine whether the available memory is greater than or equal to a sum of the second memory allocation thresholds;
若大于或者等于所述第二内存分配阈值之和,运行第二内存分配子单元;If the sum of the second memory allocation threshold is greater than or equal to, the second memory allocation subunit is operated;
所述第二内存分配子单元,用于按照所述第二内存分配阈值为所述虚拟机分配内存;The second memory allocation subunit is configured to allocate memory according to the second memory allocation threshold;
若小于所述第二内存分配阈值之和,运行第三判断子单元;If the sum is less than the sum of the second memory allocation thresholds, running a third determining subunit;
所述第三判断子单元,用于判断所述可用内存是否大于或者等于所述第三内存分配阈值之和;The third determining subunit is configured to determine whether the available memory is greater than or equal to a sum of the third memory allocation thresholds;
若大于或者等于所述第三内存分配阈值之和,运行第三内存分配子单元;If greater than or equal to the sum of the third memory allocation thresholds, running a third memory allocation sub-unit;
所述第三内存分配子单元,用于按照所述第三内存分配阈值为所述虚拟机分配内存;The third memory allocation subunit is configured to allocate memory according to the third memory allocation threshold;
若小于所述第三内存分配阈值之和,运行第四判断子单元;If the sum is less than the sum of the third memory allocation thresholds, running the fourth determining subunit;
所述第四判断子单元,用于判断所述可用内存是否大于或者等于所述第四内存分配阈值之和;The fourth determining subunit is configured to determine whether the available memory is greater than or equal to a sum of the fourth memory allocation thresholds;
若大于或者等于所述第四内存分配阈值之和,运行第四内存分配子单元;If the sum of the fourth memory allocation threshold is greater than or equal to, the fourth memory allocation subunit is operated;
所述第四内存分配子单元,用于按照所述第四内存分配阈值为所述虚拟机分配内存;The fourth memory allocation subunit is configured to allocate memory according to the fourth memory allocation threshold;
其中,所述第一内存分配阈值等于所述虚拟机实际占用内存与所述最大自由内存之和;The first memory allocation threshold is equal to a sum of an actual occupied memory of the virtual machine and the maximum free memory;
所述第二内存分配阈值等于所述虚拟机实际占用内存与所述最小自由内存之和;The second memory allocation threshold is equal to a sum of an actual occupied memory of the virtual machine and the minimum free memory;
所述第三内存分配阈值等于所述内存下限值与所述最大自由内存之和;The third memory allocation threshold is equal to a sum of the memory lower limit value and the maximum free memory;
所述第四内存分配阈值等于所述内存下限值与所述最小自由内存之和;The fourth memory allocation threshold is equal to a sum of the memory lower limit value and the minimum free memory;
所述可用内存等于所述物理机实际内存减去所述物理机上虚拟机和操作系统占用内存。The available memory is equal to the physical memory of the physical machine minus the memory occupied by the virtual machine and the operating system on the physical machine.
可选的,所述内存分配单元203,包括:Optionally, the memory allocation unit 203 includes:
第一内存分配阈值计算子单元,用于根据所述最大自由内存,以及获取的所述配置参数中每一个虚拟机实际占用内存,分别计算所述配置参数中每一个虚拟机的第一内存分配阈值;a first memory allocation threshold calculation subunit, configured to separately calculate a first memory allocation of each virtual machine in the configuration parameter according to the maximum free memory and the actual occupied memory of each virtual machine in the obtained configuration parameter Threshold value
第一内存分配阈值求和子单元,用于对所述配置参数中所有虚拟机的第一内存分配阈值进行求和;a first memory allocation threshold summation subunit, configured to sum the first memory allocation thresholds of all virtual machines in the configuration parameter;
第一可用内存判断子单元,用于判断所述可用内存是否大于或者等于所述第一内存分配阈值之和,若是,运行第一可用内存分配子单元;
a first available memory determining subunit, configured to determine whether the available memory is greater than or equal to a sum of the first memory allocation thresholds, and if so, running a first available memory allocation subunit;
所述第一可用内存分配子单元,用于按照所述第一内存分配阈值将所述可用内存分配给所述配置参数中所有虚拟机;或者,将所述可用内存平均分配给所述配置参数中所有虚拟机;或者,按照所述虚拟机实际占用内存的数值大小,优先将所述可用内存分配给实际占用内存的数值较大的虚拟机;The first available memory allocation subunit, configured to allocate the available memory to all virtual machines in the configuration parameter according to the first memory allocation threshold; or, equally allocate the available memory to the configuration parameter All the virtual machines in the virtual machine; or, according to the value of the actual occupied memory of the virtual machine, preferentially allocate the available memory to a virtual machine having a large value of actually occupying the memory;
其中,所述第一内存分配阈值等于所述最大自由内存与所述虚拟机实际占用内存之和。The first memory allocation threshold is equal to a sum of the maximum free memory and an actual occupied memory of the virtual machine.
可选的,所述内存分配单元203,包括:Optionally, the memory allocation unit 203 includes:
第二内存分配阈值计算子单元,用于根据所述最小自由内存,以及获取的所述配置参数中每一个虚拟机实际占用内存,分别计算所述配置参数中每一个虚拟机的第二内存分配阈值;a second memory allocation threshold calculation subunit, configured to separately calculate a second memory allocation of each virtual machine in the configuration parameter according to the minimum free memory and the actual occupied memory of each virtual machine in the obtained configuration parameter Threshold value
第二内存分配阈值求和子单元,用于对所述配置参数中所有虚拟机的第二内存分配阈值进行求和;a second memory allocation threshold summation subunit, configured to sum the second memory allocation thresholds of all virtual machines in the configuration parameter;
第二可用内存判断子单元,用于判断所述可用内存是否大于或者等于所述第二内存分配阈值之和,若是,运行第二可用内存分配子单元;a second available memory determining subunit, configured to determine whether the available memory is greater than or equal to a sum of the second memory allocation thresholds, and if so, running a second available memory allocation subunit;
所述第二可用内存分配子单元,用于按照所述第二内存分配阈值将所述可用内存分配给所述配置参数中所有虚拟机;或者,将所述可用内存平均分配给所述配置参数中所有虚拟机;或者,按照所述虚拟机实际占用内存的数值大小,优先将所述可用内存分配给实际占用内存的数值较大的虚拟机;The second available memory allocation sub-unit is configured to allocate the available memory to all virtual machines in the configuration parameter according to the second memory allocation threshold; or, equally allocate the available memory to the configuration parameter All the virtual machines in the virtual machine; or, according to the value of the actual occupied memory of the virtual machine, preferentially allocate the available memory to a virtual machine having a large value of actually occupying the memory;
其中,所述第二内存分配阈值等于所述最小自由内存与所述虚拟机实际占用内存之和。The second memory allocation threshold is equal to a sum of the minimum free memory and an actual occupied memory of the virtual machine.
可选的,所述内存分配单元203,包括:Optionally, the memory allocation unit 203 includes:
第三内存分配阈值计算子单元,用于根据所述内存下限值和所述最大自由内存,分别计算所述配置参数中每一个虚拟机的第三内存分配阈值;a third memory allocation threshold calculation subunit, configured to calculate a third memory allocation threshold of each virtual machine in the configuration parameter according to the memory lower limit value and the maximum free memory;
第三内存分配阈值求和子单元,用于对所述配置参数中所有虚拟机的第三内存分配阈值进行求和;a third memory allocation threshold summation subunit, configured to sum three third memory allocation thresholds of all virtual machines in the configuration parameter;
第三可用内存判断子单元,用于判断所述可用内存是否大于或者等于所述第三内存分配阈值之和,若是,运行第三可用内存分配子单元;a third available memory determining subunit, configured to determine whether the available memory is greater than or equal to a sum of the third memory allocation threshold, and if so, running a third available memory allocation subunit;
所述第三可用内存分配子单元,用于按照所述第三内存分配阈值将所述可用内存分配给所述配置参数中所有虚拟机;或者,将所述可用内存平均分配给所述配置参数中所有虚拟机;或者,按照所述虚拟机实际占用内存的数值大小,优先将所述可用内存分配
给实际占用内存的数值较大的虚拟机;The third available memory allocation sub-unit is configured to allocate the available memory to all virtual machines in the configuration parameter according to the third memory allocation threshold; or, equally allocate the available memory to the configuration parameter All virtual machines in the middle; or, according to the value of the actual occupied memory of the virtual machine, preferentially allocate the available memory
Give the virtual machine with a large value of the actual memory;
其中,所述第三内存分配阈值等于所述内存下限值与所述最大自由内存之和。The third memory allocation threshold is equal to a sum of the memory lower limit value and the maximum free memory.
可选的,所述内存分配单元203,包括:Optionally, the memory allocation unit 203 includes:
第四内存分配阈值计算子单元,用于根据所述内存下限值和所述最小自由内存,分别计算所述配置参数中每一个虚拟机的第四内存分配阈值;a fourth memory allocation threshold calculation subunit, configured to calculate a fourth memory allocation threshold of each virtual machine in the configuration parameter according to the memory lower limit value and the minimum free memory;
第四内存分配阈值求和子单元,用于对所述配置参数中所有虚拟机的第四内存分配阈值进行求和;a fourth memory allocation threshold summation subunit, configured to sum the fourth memory allocation thresholds of all the virtual machines in the configuration parameter;
第四可用内存判断子单元,用于判断所述可用内存是否大于或者等于所述第四内存分配阈值之和,若是,运行第四可用内存分配子单元;a fourth available memory determining subunit, configured to determine whether the available memory is greater than or equal to a sum of the fourth memory allocation threshold, and if so, running a fourth available memory allocation subunit;
所述第四可用内存分配子单元,用于按照所述第四内存分配阈值将所述可用内存分配给所述配置参数中所有虚拟机;或者,将所述可用内存平均分配给所述配置参数中所有虚拟机;或者,按照所述虚拟机实际占用内存的数值大小,优先将所述可用内存分配给实际占用内存的数值较大的虚拟机;The fourth available memory allocation subunit is configured to allocate the available memory to all virtual machines in the configuration parameter according to the fourth memory allocation threshold; or, equally allocate the available memory to the configuration parameter All the virtual machines in the virtual machine; or, according to the value of the actual occupied memory of the virtual machine, preferentially allocate the available memory to a virtual machine having a large value of actually occupying the memory;
其中,所述第四内存分配阈值等于所述内存下限值与所述最小自由内存之和。The fourth memory allocation threshold is equal to a sum of the memory lower limit value and the minimum free memory.
可选的,所述虚拟机内存资源的调度装置,包括:Optionally, the scheduling device of the virtual machine memory resource includes:
可用内存计算单元,用于计算所述物理机上的所述可用内存;An available memory computing unit for calculating the available memory on the physical machine;
其中,所述可用内存等于所述物理机实际内存减去所述物理机上虚拟机和操作系统占用内存。The available memory is equal to the actual memory of the physical machine minus the memory occupied by the virtual machine and the operating system on the physical machine.
可选的,所述内存分配判断单元202包括:Optionally, the memory allocation determining unit 202 includes:
第一内存分配判断子单元,用于判断所述可用内存是否小于所述目标内存调度区间的上限值,若是,运行第二内存分配判断子单元;a first memory allocation determining subunit, configured to determine whether the available memory is less than an upper limit value of the target memory scheduling interval, and if so, running a second memory allocation determining subunit;
所述第二内存分配判断子单元,用于判断所述可用内存是否大于或者等于所述目标内存调度区间的下限值,若是,运行所述内存分配单元203;The second memory allocation determining sub-unit is configured to determine whether the available memory is greater than or equal to a lower limit value of the target memory scheduling interval, and if so, running the memory allocation unit 203;
第三内存分配判断子单元,用于判断所述可用内存是否大于或者等于所述目标内存调度区间的下限值,若是,运行第四内存分配判断子单元;a third memory allocation determining sub-unit, configured to determine whether the available memory is greater than or equal to a lower limit value of the target memory scheduling interval, and if so, running a fourth memory allocation determining sub-unit;
所述第四内存分配判断子单元,用于判断所述可用内存是否小于所述目标内存调度区间的上限值,若是,运行所述内存分配单元203。The fourth memory allocation determining sub-unit is configured to determine whether the available memory is smaller than an upper limit value of the target memory scheduling interval, and if so, run the memory allocation unit 203.
可选的,若所述第一内存分配判断子单元或者第一内存分配判断子单元输出的判断结果为:所述可用内存大于或者等于所述目标内存调度区间的上限值,则运行第五内存分配子单元;
Optionally, if the judgment result of the output of the first memory allocation determining subunit or the first memory allocation determining subunit is: the available memory is greater than or equal to an upper limit value of the target memory scheduling interval, then running the fifth Memory allocation subunit;
其中,所述第五内存分配子单元,用于按照所述内存上限值为所述配置参数中每一个虚拟机分配内存。The fifth memory allocation sub-unit is configured to allocate memory according to the memory upper limit value for each virtual machine in the configuration parameter.
可选的,若所述第二内存分配判断子单元或者第三内存分配判断子单元输出的判断结果为:所述可用内存小于所述目标内存调度区间的下限值,则运行提醒消息发出单元;Optionally, if the determination result output by the second memory allocation determining subunit or the third memory allocation determining subunit is: the available memory is less than a lower limit value of the target memory scheduling interval, running a reminder message issuing unit ;
其中,所述提醒消息发出单元,用于发出内存不足的提醒消息。The reminder message issuing unit is configured to issue a reminder message that the memory is insufficient.
可选的,所述物理机上的虚拟机按照预设排列顺序进行部署,其中居于首位的虚拟机具有调度其他虚拟机内存的权限。Optionally, the virtual machines on the physical machine are deployed in a preset sequence, wherein the virtual machine in the first place has the right to schedule memory of other virtual machines.
本申请提供的一种电子设备实施例如下:An electronic device implementation provided by the present application is as follows:
在上述的实施例中,提供了一种虚拟机内存资源的调度方法,此外,本申请还提供了一种用于实现所述虚拟机内存资源的调度方法的电子设备,下面结合附图进行说明。In the foregoing embodiment, a method for scheduling a virtual machine memory resource is provided. In addition, the present application further provides an electronic device for implementing a scheduling method of the virtual machine memory resource, which is described below with reference to the accompanying drawings. .
参照附图3,其示出了本实施例提供的一种电子设备的示意图。Referring to FIG. 3, a schematic diagram of an electronic device provided by the embodiment is shown.
本申请提供的所述电子设备实施例描述得比较简单,相关的部分请参见上述提供的所述虚拟机内存资源的调度方法实施例的对应说明即可。下述描述的实施例仅仅是示意性的。The embodiment of the electronic device provided by the present application is described in a relatively simple manner. For related parts, refer to the corresponding description of the method for scheduling the virtual machine memory resource provided above. The embodiments described below are merely illustrative.
本申请提供一种电子设备,包括:The application provides an electronic device, including:
存储器301,以及处理器302;a memory 301, and a processor 302;
所述存储器301用于存储计算机可执行指令,所述处理器302用于执行所述计算机可执行指令:The memory 301 is configured to store computer executable instructions, and the processor 302 is configured to execute the computer executable instructions:
根据物理机的资源调度指令中包含的配置参数,计算所述资源调度指令的目标内存调度区间;Calculating a target memory scheduling interval of the resource scheduling instruction according to a configuration parameter included in a resource scheduling instruction of the physical machine;
判断所述物理机上的可用内存是否处于所述目标内存调度区间对应范围内,若是,根据所述配置参数在所述物理机上为所述资源调度指令分配虚拟机,并将所述可用内存分配给所述虚拟机。Determining whether the available memory on the physical machine is within the corresponding range of the target memory scheduling interval, and if so, allocating a virtual machine to the resource scheduling instruction on the physical machine according to the configuration parameter, and allocating the available memory to The virtual machine.
可选的,所述配置参数包括:Optionally, the configuration parameters include:
虚拟机的数目、标识、内存下限值、内存上限值、最小自由内存和最大自由内存。Number of virtual machines, identification, memory lower limit, memory upper limit, minimum free memory, and maximum free memory.
可选的,所述目标内存调度区间的下限值,等于所述资源调度指令中包含的各虚拟机的内存下限值之和;Optionally, a lower limit value of the target memory scheduling interval is equal to a sum of a memory lower limit value of each virtual machine included in the resource scheduling instruction;
所述目标内存调度区间的上限值,等于所述资源调度指令中包含的各虚拟机的内存上限值之和。The upper limit value of the target memory scheduling interval is equal to the sum of the memory upper limit values of the virtual machines included in the resource scheduling instruction.
可选的,所述根据所述配置参数在所述物理机上为所述资源调度指令分配虚拟机,
并将所述可用内存分配给所述虚拟机指令执行之后,所述处理器302还用于执行下述计算机可执行指令:Optionally, the virtual machine is allocated to the resource scheduling instruction on the physical machine according to the configuration parameter,
After the available memory is allocated to the execution of the virtual machine instructions, the processor 302 is further configured to execute the following computer executable instructions:
按照预设检测周期对所述物理机上的虚拟机进行检测,当检测到所述物理机上的虚拟机释放内存后,根据所述物理机上的虚拟机实际占用内存和所述内存上限值,判断所述虚拟机的实际占用内存是否小于所述内存上限值,若是,将所述物理机上释放的内存分配给所述虚拟机。The virtual machine on the physical machine is detected according to a preset detection period. After detecting the virtual machine on the physical machine to release the memory, determining, according to the actual occupied memory of the virtual machine on the physical machine and the upper limit of the memory, Whether the actual occupied memory of the virtual machine is smaller than the upper limit of the memory, and if so, the memory released on the physical machine is allocated to the virtual machine.
可选的,所述根据所述资源调度配置参数,在所述物理机上为所述资源调度指令分配虚拟机,并将所述可用内存分配给所述虚拟机,采用如下方式实现:Optionally, the allocating a virtual machine to the resource scheduling instruction on the physical machine according to the resource scheduling configuration parameter, and allocating the available memory to the virtual machine, is implemented as follows:
针对所述配置参数中每一个虚拟机,分别执行下述操作,并且每分配一个虚拟机,计算一次所述物理机的可用内存,并将计算获得的所述可用内存代入下述操作:For each virtual machine in the configuration parameter, the following operations are respectively performed, and each time a virtual machine is allocated, the available memory of the physical machine is calculated once, and the calculated available memory is substituted into the following operations:
根据所述配置参数以及剩余虚拟机实际占用内存,分别计算所述剩余虚拟机的第一内存分配阈值、第二内存分配阈值、第三内存分配阈值和第四内存分配阈值;Calculating, according to the configuration parameter and the actual occupied memory of the remaining virtual machine, a first memory allocation threshold, a second memory allocation threshold, a third memory allocation threshold, and a fourth memory allocation threshold of the remaining virtual machines;
对所述剩余虚拟机的第一内存分配阈值、第二内存分配阈值、第三内存分配阈值和第四内存分配阈值分别进行求和;And summing, by the first memory allocation threshold, the second memory allocation threshold, the third memory allocation threshold, and the fourth memory allocation threshold, respectively, of the remaining virtual machines;
判断所述可用内存是否大于或者等于所述第一内存分配阈值之和;Determining whether the available memory is greater than or equal to a sum of the first memory allocation thresholds;
若大于或者等于所述第一内存分配阈值之和,按照所述第一内存分配阈值为所述虚拟机分配内存;If greater than or equal to the sum of the first memory allocation thresholds, allocate memory according to the first memory allocation threshold;
若小于所述第一内存分配阈值之和,执行下一步;If the sum is less than the sum of the first memory allocation thresholds, perform the next step;
判断所述可用内存是否大于或者等于所述第二内存分配阈值之和;Determining whether the available memory is greater than or equal to a sum of the second memory allocation thresholds;
若大于或者等于所述第二内存分配阈值之和,按照所述第二内存分配阈值为所述虚拟机分配内存;If greater than or equal to the sum of the second memory allocation thresholds, allocate memory according to the second memory allocation threshold;
若小于所述第二内存分配阈值之和,执行下一步;If the sum is less than the sum of the second memory allocation thresholds, perform the next step;
判断所述可用内存是否大于或者等于所述第三内存分配阈值之和;Determining whether the available memory is greater than or equal to a sum of the third memory allocation thresholds;
若大于或者等于所述第三内存分配阈值之和,按照所述第三内存分配阈值为所述虚拟机分配内存;If greater than or equal to the sum of the third memory allocation thresholds, allocate memory according to the third memory allocation threshold;
若小于所述第三内存分配阈值之和,执行下一步;If the sum is less than the sum of the third memory allocation thresholds, perform the next step;
判断所述可用内存是否大于或者等于所述第四内存分配阈值之和;Determining whether the available memory is greater than or equal to a sum of the fourth memory allocation thresholds;
若大于或者等于所述第四内存分配阈值之和,按照所述第四内存分配阈值为所述虚拟机分配内存;If greater than or equal to the sum of the fourth memory allocation thresholds, allocate memory according to the fourth memory allocation threshold;
其中,所述第一内存分配阈值等于所述虚拟机实际占用内存与所述最大自由内存之
和;The first memory allocation threshold is equal to the actual occupied memory of the virtual machine and the maximum free memory.
with;
所述第二内存分配阈值等于所述虚拟机实际占用内存与所述最小自由内存之和;The second memory allocation threshold is equal to a sum of an actual occupied memory of the virtual machine and the minimum free memory;
所述第三内存分配阈值等于所述内存下限值与所述最大自由内存之和;The third memory allocation threshold is equal to a sum of the memory lower limit value and the maximum free memory;
所述第四内存分配阈值等于所述内存下限值与所述最小自由内存之和;The fourth memory allocation threshold is equal to a sum of the memory lower limit value and the minimum free memory;
所述可用内存等于所述物理机实际内存减去所述物理机上虚拟机和操作系统占用内存。The available memory is equal to the physical memory of the physical machine minus the memory occupied by the virtual machine and the operating system on the physical machine.
可选的,所述根据所述资源调度配置参数,在所述物理机上为所述资源调度指令分配虚拟机,并将所述可用内存分配给所述虚拟机,采用如下方式实现:Optionally, the allocating a virtual machine to the resource scheduling instruction on the physical machine according to the resource scheduling configuration parameter, and allocating the available memory to the virtual machine, is implemented as follows:
根据所述最大自由内存,以及获取的所述配置参数中每一个虚拟机实际占用内存,分别计算所述配置参数中每一个虚拟机的第一内存分配阈值;Calculating a first memory allocation threshold of each virtual machine in the configuration parameter according to the maximum free memory and the actual occupied memory of each virtual machine in the obtained configuration parameter;
对所述配置参数中所有虚拟机的第一内存分配阈值进行求和;And summing a first memory allocation threshold of all virtual machines in the configuration parameter;
判断所述可用内存是否大于或者等于所述第一内存分配阈值之和,若是,执行下一步;Determining whether the available memory is greater than or equal to a sum of the first memory allocation thresholds, and if yes, performing the next step;
按照所述第一内存分配阈值将所述可用内存分配给所述配置参数中所有虚拟机;或者,将所述可用内存平均分配给所述配置参数中所有虚拟机;或者,按照所述虚拟机实际占用内存的数值大小,优先将所述可用内存分配给实际占用内存的数值较大的虚拟机;Allocating the available memory to all virtual machines in the configuration parameter according to the first memory allocation threshold; or distributing the available memory evenly to all virtual machines in the configuration parameter; or, according to the virtual machine Actually occupying the value of the memory, and preferentially allocating the available memory to a virtual machine having a large value that actually occupies the memory;
其中,所述第一内存分配阈值等于所述最大自由内存与所述虚拟机实际占用内存之和。The first memory allocation threshold is equal to a sum of the maximum free memory and an actual occupied memory of the virtual machine.
可选的,所述根据所述资源调度配置参数,在所述物理机上为所述资源调度指令分配虚拟机,并将所述可用内存分配给所述虚拟机,采用如下方式实现:Optionally, the allocating a virtual machine to the resource scheduling instruction on the physical machine according to the resource scheduling configuration parameter, and allocating the available memory to the virtual machine, is implemented as follows:
根据所述最小自由内存,以及获取的所述配置参数中每一个虚拟机实际占用内存,分别计算所述配置参数中每一个虚拟机的第二内存分配阈值;Calculating a second memory allocation threshold of each virtual machine in the configuration parameter according to the minimum free memory and the actual occupied memory of each virtual machine in the obtained configuration parameter;
对所述配置参数中所有虚拟机的第二内存分配阈值进行求和;And summing a second memory allocation threshold of all virtual machines in the configuration parameter;
判断所述可用内存是否大于或者等于所述第二内存分配阈值之和,若是,执行下一步;Determining whether the available memory is greater than or equal to a sum of the second memory allocation thresholds; if yes, performing the next step;
按照所述第二内存分配阈值将所述可用内存分配给所述配置参数中所有虚拟机;或者,将所述可用内存平均分配给所述配置参数中所有虚拟机;或者,按照所述虚拟机实际占用内存的数值大小,优先将所述可用内存分配给实际占用内存的数值较大的虚拟机;Allocating the available memory to all virtual machines in the configuration parameter according to the second memory allocation threshold; or equally allocating the available memory to all virtual machines in the configuration parameter; or, according to the virtual machine Actually occupying the value of the memory, and preferentially allocating the available memory to a virtual machine having a large value that actually occupies the memory;
其中,所述第二内存分配阈值等于所述最小自由内存与所述虚拟机实际占用内存之和。
The second memory allocation threshold is equal to a sum of the minimum free memory and an actual occupied memory of the virtual machine.
可选的,所述根据所述资源调度配置参数,在所述物理机上为所述资源调度指令分配虚拟机,并将所述可用内存分配给所述虚拟机,采用如下方式实现:Optionally, the allocating a virtual machine to the resource scheduling instruction on the physical machine according to the resource scheduling configuration parameter, and allocating the available memory to the virtual machine, is implemented as follows:
根据所述内存下限值和所述最大自由内存,分别计算所述配置参数中每一个虚拟机的第三内存分配阈值;Calculating, according to the memory lower limit value and the maximum free memory, a third memory allocation threshold of each virtual machine in the configuration parameter;
对所述配置参数中所有虚拟机的第三内存分配阈值进行求和;And summing a third memory allocation threshold of all virtual machines in the configuration parameter;
判断所述可用内存是否大于或者等于所述第三内存分配阈值之和,若是,执行下一步;Determining whether the available memory is greater than or equal to a sum of the third memory allocation thresholds, and if yes, performing the next step;
按照所述第三内存分配阈值将所述可用内存分配给所述配置参数中所有虚拟机;或者,将所述可用内存平均分配给所述配置参数中所有虚拟机;或者,按照所述虚拟机实际占用内存的数值大小,优先将所述可用内存分配给实际占用内存的数值较大的虚拟机;Allocating the available memory to all virtual machines in the configuration parameter according to the third memory allocation threshold; or distributing the available memory evenly to all virtual machines in the configuration parameter; or, according to the virtual machine Actually occupying the value of the memory, and preferentially allocating the available memory to a virtual machine having a large value that actually occupies the memory;
其中,所述第三内存分配阈值等于所述内存下限值与所述最大自由内存之和。The third memory allocation threshold is equal to a sum of the memory lower limit value and the maximum free memory.
可选的,所述根据所述资源调度配置参数,在所述物理机上为所述资源调度指令分配虚拟机,并将所述可用内存分配给所述虚拟机,采用如下方式实现:Optionally, the allocating a virtual machine to the resource scheduling instruction on the physical machine according to the resource scheduling configuration parameter, and allocating the available memory to the virtual machine, is implemented as follows:
根据所述内存下限值和所述最小自由内存,分别计算所述配置参数中每一个虚拟机的第四内存分配阈值;Calculating, according to the memory lower limit value and the minimum free memory, a fourth memory allocation threshold of each virtual machine in the configuration parameter;
对所述配置参数中所有虚拟机的第四内存分配阈值进行求和;And summing a fourth memory allocation threshold of all virtual machines in the configuration parameter;
判断所述可用内存是否大于或者等于所述第四内存分配阈值之和,若是,执行下一步;Determining whether the available memory is greater than or equal to a sum of the fourth memory allocation threshold, and if yes, performing the next step;
按照所述第四内存分配阈值将所述可用内存分配给所述配置参数中所有虚拟机;或者,将所述可用内存平均分配给所述配置参数中所有虚拟机;或者,按照所述虚拟机实际占用内存的数值大小,优先将所述可用内存分配给实际占用内存的数值较大的虚拟机;Allocating the available memory to all virtual machines in the configuration parameter according to the fourth memory allocation threshold; or distributing the available memory evenly to all virtual machines in the configuration parameter; or, according to the virtual machine Actually occupying the value of the memory, and preferentially allocating the available memory to a virtual machine having a large value that actually occupies the memory;
其中,所述第四内存分配阈值等于所述内存下限值与所述最小自由内存之和。The fourth memory allocation threshold is equal to a sum of the memory lower limit value and the minimum free memory.
可选的,所述判断所述物理机上的可用内存是否处于所述目标内存调度区间对应范围内指令执行之前,所述处理器302还用于执行下述计算机可执行指令:Optionally, before determining whether the available memory on the physical machine is in the range corresponding to the target memory scheduling interval, the processor 302 is further configured to execute the following computer executable instructions:
计算所述物理机上的所述可用内存;Calculating the available memory on the physical machine;
其中,所述可用内存等于所述物理机实际内存减去所述物理机上虚拟机和操作系统占用内存。The available memory is equal to the actual memory of the physical machine minus the memory occupied by the virtual machine and the operating system on the physical machine.
可选的,所述判断所述物理机上的可用内存是否处于所述目标内存调度区间对应范围内,采用如下方式实现:Optionally, the determining whether the available memory on the physical machine is within the corresponding range of the target memory scheduling interval is implemented as follows:
判断所述可用内存是否小于所述目标内存调度区间的上限值,若是,判断所述可用
内存是否大于或者等于所述目标内存调度区间的下限值,若是,执行下一步;Determining whether the available memory is less than an upper limit value of the target memory scheduling interval, and if yes, determining that the available
Whether the memory is greater than or equal to the lower limit of the target memory scheduling interval, and if so, performing the next step;
或者,or,
判断所述可用内存是否大于或者等于所述目标内存调度区间的下限值,若是,判断所述可用内存是否小于所述目标内存调度区间的上限值,若是,执行下一步。Determining whether the available memory is greater than or equal to a lower limit value of the target memory scheduling interval, and if yes, determining whether the available memory is less than an upper limit value of the target memory scheduling interval, and if yes, performing the next step.
可选的,若所述判断所述可用内存是否小于所述目标内存调度区间的上限值指令的执行结果为否,按照所述内存上限值为所述配置参数中每一个虚拟机分配内存。Optionally, if the execution result of the instruction that the available memory is less than the upper limit value of the target memory scheduling interval is no, allocate the memory according to the memory upper limit value for each virtual machine in the configuration parameter. .
可选的,若所述判断所述可用内存是否大于或者等于所述目标内存调度区间的下限值指令的执行结果为否,则发出内存不足的提醒消息。Optionally, if the execution result of the instruction that the available memory is greater than or equal to the lower limit value of the target memory scheduling interval is no, an alert message indicating that the memory is insufficient is issued.
可选的,所述物理机上的虚拟机按照预设排列顺序进行部署,其中居于首位的虚拟机具有调度其他虚拟机内存的权限。Optionally, the virtual machines on the physical machine are deployed in a preset sequence, wherein the virtual machine in the first place has the right to schedule memory of other virtual machines.
本申请虽然以较佳实施例公开如上,但其并不是用来限定本申请,任何本领域技术人员在不脱离本申请的精神和范围内,都可以做出可能的变动和修改,因此本申请的保护范围应当以本申请权利要求所界定的范围为准。The present application is disclosed in the above preferred embodiments, but it is not intended to limit the present application, and any person skilled in the art can make possible changes and modifications without departing from the spirit and scope of the present application. The scope of protection should be based on the scope defined by the claims of the present application.
在一个典型的配置中,计算设备包括一个或多个处理器(CPU)、输入/输出接口、网络接口和内存。In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
内存可能包括计算机可读介质中的非永久性存储器,随机存取存储器(RAM)和/或非易失性内存等形式,如只读存储器(ROM)或闪存(flash RAM)。内存是计算机可读介质的示例。The memory may include non-persistent memory, random access memory (RAM), and/or non-volatile memory in a computer readable medium, such as read only memory (ROM) or flash memory. Memory is an example of a computer readable medium.
1、计算机可读介质包括永久性和非永久性、可移动和非可移动媒体可以由任何方法或技术来实现信息存储。信息可以是计算机可读指令、数据结构、程序的模块或其他数据。计算机的存储介质的例子包括,但不限于相变内存(PRAM)、静态随机存取存储器(SRAM)、动态随机存取存储器(DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字多功能光盘(DVD)或其他光学存储、磁盒式磁带,磁带磁磁盘存储或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。按照本文中的界定,计算机可读介质不包括非暂存电脑可读媒体(transitory media),如调制的数据信号和载波。1. Computer readable media including both permanent and non-persistent, removable and non-removable media may be implemented by any method or technology. The information can be computer readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read only memory. (ROM), electrically erasable programmable read only memory (EEPROM), flash memory or other memory technology, compact disk read only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, Magnetic tape cartridges, magnetic tape storage or other magnetic storage devices or any other non-transportable media can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include non-transitory computer readable media, such as modulated data signals and carrier waves.
2、本领域技术人员应明白,本申请的实施例可提供为方法、系统或计算机程序产品。因此,本申请可采用完全硬件实施例、完全软件实施例或结合软件和硬件方面的实施例的形式。而且,本申请可采用在一个或多个其中包含有计算机可用程序代码的计算机可
用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。
2. Those skilled in the art will appreciate that embodiments of the present application can be provided as a method, system, or computer program product. Thus, the present application can take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment in combination of software and hardware. Moreover, the application may employ one or more computers including computer usable program code therein.
In the form of a computer program product embodied on a storage medium, including but not limited to disk storage, CD-ROM, optical storage, and the like.
Claims (19)
- 一种虚拟机内存资源的调度方法,其特征在于,包括:A method for scheduling a virtual machine memory resource, comprising:根据物理机的资源调度指令中包含的配置参数,计算所述资源调度指令的目标内存调度区间;Calculating a target memory scheduling interval of the resource scheduling instruction according to a configuration parameter included in a resource scheduling instruction of the physical machine;判断所述物理机上的可用内存是否处于所述目标内存调度区间对应范围内,若是,执行下一步;Determining whether the available memory on the physical machine is within a corresponding range of the target memory scheduling interval; if yes, performing the next step;根据所述配置参数在所述物理机上为所述资源调度指令分配虚拟机,并将所述可用内存分配给所述虚拟机。Allocating a virtual machine to the resource scheduling instruction on the physical machine according to the configuration parameter, and allocating the available memory to the virtual machine.
- 根据权利要求1所述的虚拟机内存资源的调度方法,其特征在于,所述配置参数包括:The method for scheduling a virtual machine memory resource according to claim 1, wherein the configuration parameter comprises:虚拟机的数目、标识、内存下限值、内存上限值、最小自由内存和最大自由内存。Number of virtual machines, identification, memory lower limit, memory upper limit, minimum free memory, and maximum free memory.
- 根据权利要求2所述的虚拟机内存资源的调度方法,其特征在于,所述目标内存调度区间的下限值,等于所述资源调度指令中包含的各虚拟机的内存下限值之和;The method for scheduling a virtual machine memory resource according to claim 2, wherein a lower limit value of the target memory scheduling interval is equal to a sum of a memory lower limit value of each virtual machine included in the resource scheduling instruction;所述目标内存调度区间的上限值,等于所述资源调度指令中包含的各虚拟机的内存上限值之和。The upper limit value of the target memory scheduling interval is equal to the sum of the memory upper limit values of the virtual machines included in the resource scheduling instruction.
- 根据权利要求2所述的虚拟机内存资源的调度方法,其特征在于,所述根据所述配置参数在所述物理机上为所述资源调度指令分配虚拟机,并将所述可用内存分配给所述虚拟机步骤执行之后,执行下述步骤:The method for scheduling a virtual machine memory resource according to claim 2, wherein the virtual machine is allocated to the resource scheduling instruction on the physical machine according to the configuration parameter, and the available memory is allocated to the After the virtual machine step is executed, perform the following steps:按照预设检测周期对所述物理机上的虚拟机进行检测,当检测到所述物理机上的虚拟机释放内存后,执行下述步骤:The virtual machine on the physical machine is detected according to a preset detection period. After detecting that the virtual machine on the physical machine releases the memory, perform the following steps:根据所述物理机上的虚拟机实际占用内存和所述内存上限值,判断所述虚拟机的实际占用内存是否小于所述内存上限值,若是,将所述物理机上释放的内存分配给所述虚拟机。Determining, according to the actual occupied memory of the virtual machine on the physical machine and the upper limit of the memory, whether the actual occupied memory of the virtual machine is smaller than the upper limit of the memory, and if so, allocating the memory released on the physical machine to the Describe the virtual machine.
- 根据权利要求2所述的虚拟机内存资源的调度方法,其特征在于,所述根据所述资源调度配置参数,在所述物理机上为所述资源调度指令分配虚拟机,并将所述可用内存分配给所述虚拟机,采用如下方式实现:The method for scheduling a virtual machine memory resource according to claim 2, wherein the virtual machine is allocated to the resource scheduling instruction on the physical machine according to the resource scheduling configuration parameter, and the available memory is Assigned to the virtual machine is implemented as follows:针对所述配置参数中每一个虚拟机,分别执行下述操作,并且每分配一个虚拟机,计算一次所述物理机的可用内存,并将计算获得的所述可用内存代入下述操作:For each virtual machine in the configuration parameter, the following operations are respectively performed, and each time a virtual machine is allocated, the available memory of the physical machine is calculated once, and the calculated available memory is substituted into the following operations:根据所述配置参数以及剩余虚拟机实际占用内存,分别计算所述剩余虚拟机的第一内存分配阈值、第二内存分配阈值、第三内存分配阈值和第四内存分配阈值; Calculating, according to the configuration parameter and the actual occupied memory of the remaining virtual machine, a first memory allocation threshold, a second memory allocation threshold, a third memory allocation threshold, and a fourth memory allocation threshold of the remaining virtual machines;对所述剩余虚拟机的第一内存分配阈值、第二内存分配阈值、第三内存分配阈值和第四内存分配阈值分别进行求和;And summing, by the first memory allocation threshold, the second memory allocation threshold, the third memory allocation threshold, and the fourth memory allocation threshold, respectively, of the remaining virtual machines;判断所述可用内存是否大于或者等于所述第一内存分配阈值之和;Determining whether the available memory is greater than or equal to a sum of the first memory allocation thresholds;若大于或者等于所述第一内存分配阈值之和,按照所述第一内存分配阈值为所述虚拟机分配内存;If greater than or equal to the sum of the first memory allocation thresholds, allocate memory according to the first memory allocation threshold;若小于所述第一内存分配阈值之和,执行下一步;If the sum is less than the sum of the first memory allocation thresholds, perform the next step;判断所述可用内存是否大于或者等于所述第二内存分配阈值之和;Determining whether the available memory is greater than or equal to a sum of the second memory allocation thresholds;若大于或者等于所述第二内存分配阈值之和,按照所述第二内存分配阈值为所述虚拟机分配内存;If greater than or equal to the sum of the second memory allocation thresholds, allocate memory according to the second memory allocation threshold;若小于所述第二内存分配阈值之和,执行下一步;If the sum is less than the sum of the second memory allocation thresholds, perform the next step;判断所述可用内存是否大于或者等于所述第三内存分配阈值之和;Determining whether the available memory is greater than or equal to a sum of the third memory allocation thresholds;若大于或者等于所述第三内存分配阈值之和,按照所述第三内存分配阈值为所述虚拟机分配内存;If greater than or equal to the sum of the third memory allocation thresholds, allocate memory according to the third memory allocation threshold;若小于所述第三内存分配阈值之和,执行下一步;If the sum is less than the sum of the third memory allocation thresholds, perform the next step;判断所述可用内存是否大于或者等于所述第四内存分配阈值之和;Determining whether the available memory is greater than or equal to a sum of the fourth memory allocation thresholds;若大于或者等于所述第四内存分配阈值之和,按照所述第四内存分配阈值为所述虚拟机分配内存;If greater than or equal to the sum of the fourth memory allocation thresholds, allocate memory according to the fourth memory allocation threshold;其中,所述第一内存分配阈值等于所述虚拟机实际占用内存与所述最大自由内存之和;The first memory allocation threshold is equal to a sum of an actual occupied memory of the virtual machine and the maximum free memory;所述第二内存分配阈值等于所述虚拟机实际占用内存与所述最小自由内存之和;The second memory allocation threshold is equal to a sum of an actual occupied memory of the virtual machine and the minimum free memory;所述第三内存分配阈值等于所述内存下限值与所述最大自由内存之和;The third memory allocation threshold is equal to a sum of the memory lower limit value and the maximum free memory;所述第四内存分配阈值等于所述内存下限值与所述最小自由内存之和;The fourth memory allocation threshold is equal to a sum of the memory lower limit value and the minimum free memory;所述可用内存等于所述物理机实际内存减去所述物理机上虚拟机和操作系统占用内存。The available memory is equal to the physical memory of the physical machine minus the memory occupied by the virtual machine and the operating system on the physical machine.
- 根据权利要求2所述的虚拟机内存资源的调度方法,其特征在于,所述根据所述资源调度配置参数,在所述物理机上为所述资源调度指令分配虚拟机,并将所述可用内存分配给所述虚拟机,采用如下方式实现:The method for scheduling a virtual machine memory resource according to claim 2, wherein the virtual machine is allocated to the resource scheduling instruction on the physical machine according to the resource scheduling configuration parameter, and the available memory is Assigned to the virtual machine is implemented as follows:根据所述最大自由内存,以及获取的所述配置参数中每一个虚拟机实际占用内存,分别计算所述配置参数中每一个虚拟机的第一内存分配阈值;Calculating a first memory allocation threshold of each virtual machine in the configuration parameter according to the maximum free memory and the actual occupied memory of each virtual machine in the obtained configuration parameter;对所述配置参数中所有虚拟机的第一内存分配阈值进行求和; And summing a first memory allocation threshold of all virtual machines in the configuration parameter;判断所述可用内存是否大于或者等于所述第一内存分配阈值之和,若是,执行下一步;Determining whether the available memory is greater than or equal to a sum of the first memory allocation thresholds, and if yes, performing the next step;按照所述第一内存分配阈值将所述可用内存分配给所述配置参数中所有虚拟机;或者,将所述可用内存平均分配给所述配置参数中所有虚拟机;或者,按照所述虚拟机实际占用内存的数值大小,优先将所述可用内存分配给实际占用内存的数值较大的虚拟机;Allocating the available memory to all virtual machines in the configuration parameter according to the first memory allocation threshold; or distributing the available memory evenly to all virtual machines in the configuration parameter; or, according to the virtual machine Actually occupying the value of the memory, and preferentially allocating the available memory to a virtual machine having a large value that actually occupies the memory;其中,所述第一内存分配阈值等于所述最大自由内存与所述虚拟机实际占用内存之和。The first memory allocation threshold is equal to a sum of the maximum free memory and an actual occupied memory of the virtual machine.
- 根据权利要求2所述的虚拟机内存资源的调度方法,其特征在于,所述根据所述资源调度配置参数,在所述物理机上为所述资源调度指令分配虚拟机,并将所述可用内存分配给所述虚拟机,采用如下方式实现:The method for scheduling a virtual machine memory resource according to claim 2, wherein the virtual machine is allocated to the resource scheduling instruction on the physical machine according to the resource scheduling configuration parameter, and the available memory is Assigned to the virtual machine is implemented as follows:根据所述最小自由内存,以及获取的所述配置参数中每一个虚拟机实际占用内存,分别计算所述配置参数中每一个虚拟机的第二内存分配阈值;Calculating a second memory allocation threshold of each virtual machine in the configuration parameter according to the minimum free memory and the actual occupied memory of each virtual machine in the obtained configuration parameter;对所述配置参数中所有虚拟机的第二内存分配阈值进行求和;And summing a second memory allocation threshold of all virtual machines in the configuration parameter;判断所述可用内存是否大于或者等于所述第二内存分配阈值之和,若是,执行下一步;Determining whether the available memory is greater than or equal to a sum of the second memory allocation thresholds; if yes, performing the next step;按照所述第二内存分配阈值将所述可用内存分配给所述配置参数中所有虚拟机;或者,将所述可用内存平均分配给所述配置参数中所有虚拟机;或者,按照所述虚拟机实际占用内存的数值大小,优先将所述可用内存分配给实际占用内存的数值较大的虚拟机;Allocating the available memory to all virtual machines in the configuration parameter according to the second memory allocation threshold; or equally allocating the available memory to all virtual machines in the configuration parameter; or, according to the virtual machine Actually occupying the value of the memory, and preferentially allocating the available memory to a virtual machine having a large value that actually occupies the memory;其中,所述第二内存分配阈值等于所述最小自由内存与所述虚拟机实际占用内存之和。The second memory allocation threshold is equal to a sum of the minimum free memory and an actual occupied memory of the virtual machine.
- 根据权利要求2所述的虚拟机内存资源的调度方法,其特征在于,所述根据所述资源调度配置参数,在所述物理机上为所述资源调度指令分配虚拟机,并将所述可用内存分配给所述虚拟机,采用如下方式实现:The method for scheduling a virtual machine memory resource according to claim 2, wherein the virtual machine is allocated to the resource scheduling instruction on the physical machine according to the resource scheduling configuration parameter, and the available memory is Assigned to the virtual machine is implemented as follows:根据所述内存下限值和所述最大自由内存,分别计算所述配置参数中每一个虚拟机的第三内存分配阈值;Calculating, according to the memory lower limit value and the maximum free memory, a third memory allocation threshold of each virtual machine in the configuration parameter;对所述配置参数中所有虚拟机的第三内存分配阈值进行求和;And summing a third memory allocation threshold of all virtual machines in the configuration parameter;判断所述可用内存是否大于或者等于所述第三内存分配阈值之和,若是,执行下一步; Determining whether the available memory is greater than or equal to a sum of the third memory allocation thresholds, and if yes, performing the next step;按照所述第三内存分配阈值将所述可用内存分配给所述配置参数中所有虚拟机;或者,将所述可用内存平均分配给所述配置参数中所有虚拟机;或者,按照所述虚拟机实际占用内存的数值大小,优先将所述可用内存分配给实际占用内存的数值较大的虚拟机;Allocating the available memory to all virtual machines in the configuration parameter according to the third memory allocation threshold; or distributing the available memory evenly to all virtual machines in the configuration parameter; or, according to the virtual machine Actually occupying the value of the memory, and preferentially allocating the available memory to a virtual machine having a large value that actually occupies the memory;其中,所述第三内存分配阈值等于所述内存下限值与所述最大自由内存之和。The third memory allocation threshold is equal to a sum of the memory lower limit value and the maximum free memory.
- 根据权利要求2所述的虚拟机内存资源的调度方法,其特征在于,所述根据所述资源调度配置参数,在所述物理机上为所述资源调度指令分配虚拟机,并将所述可用内存分配给所述虚拟机,采用如下方式实现:The method for scheduling a virtual machine memory resource according to claim 2, wherein the virtual machine is allocated to the resource scheduling instruction on the physical machine according to the resource scheduling configuration parameter, and the available memory is Assigned to the virtual machine is implemented as follows:根据所述内存下限值和所述最小自由内存,分别计算所述配置参数中每一个虚拟机的第四内存分配阈值;Calculating, according to the memory lower limit value and the minimum free memory, a fourth memory allocation threshold of each virtual machine in the configuration parameter;对所述配置参数中所有虚拟机的第四内存分配阈值进行求和;And summing a fourth memory allocation threshold of all virtual machines in the configuration parameter;判断所述可用内存是否大于或者等于所述第四内存分配阈值之和,若是,执行下一步;Determining whether the available memory is greater than or equal to a sum of the fourth memory allocation threshold, and if yes, performing the next step;按照所述第四内存分配阈值将所述可用内存分配给所述配置参数中所有虚拟机;或者,将所述可用内存平均分配给所述配置参数中所有虚拟机;或者,按照所述虚拟机实际占用内存的数值大小,优先将所述可用内存分配给实际占用内存的数值较大的虚拟机;Allocating the available memory to all virtual machines in the configuration parameter according to the fourth memory allocation threshold; or distributing the available memory evenly to all virtual machines in the configuration parameter; or, according to the virtual machine Actually occupying the value of the memory, and preferentially allocating the available memory to a virtual machine having a large value that actually occupies the memory;其中,所述第四内存分配阈值等于所述内存下限值与所述最小自由内存之和。The fourth memory allocation threshold is equal to a sum of the memory lower limit value and the minimum free memory.
- 根据权利要求1所述的虚拟机内存资源的调度方法,其特征在于,所述判断所述物理机上的可用内存是否处于所述目标内存调度区间对应范围内步骤执行之前,执行下述步骤:The method for scheduling a virtual machine memory resource according to claim 1, wherein the step of determining whether the available memory on the physical machine is within the corresponding range of the target memory scheduling interval performs the following steps:计算所述物理机上的所述可用内存;Calculating the available memory on the physical machine;其中,所述可用内存等于所述物理机实际内存减去所述物理机上虚拟机和操作系统占用内存。The available memory is equal to the actual memory of the physical machine minus the memory occupied by the virtual machine and the operating system on the physical machine.
- 根据权利要求3所述的虚拟机内存资源的调度方法,其特征在于,所述判断所述物理机上的可用内存是否处于所述目标内存调度区间对应范围内,采用如下方式实现:The method for scheduling a virtual machine memory resource according to claim 3, wherein the determining whether the available memory on the physical machine is within a corresponding range of the target memory scheduling interval is implemented as follows:判断所述可用内存是否小于所述目标内存调度区间的上限值,若是,判断所述可用内存是否大于或者等于所述目标内存调度区间的下限值,若是,执行下一步;Determining whether the available memory is less than an upper limit value of the target memory scheduling interval, and if yes, determining whether the available memory is greater than or equal to a lower limit value of the target memory scheduling interval, and if yes, performing a next step;或者,or,判断所述可用内存是否大于或者等于所述目标内存调度区间的下限值,若是,判断 所述可用内存是否小于所述目标内存调度区间的上限值,若是,执行下一步。Determining whether the available memory is greater than or equal to a lower limit value of the target memory scheduling interval, and if so, determining Whether the available memory is less than an upper limit of the target memory scheduling interval, and if so, performing the next step.
- 根据权利要求11所述的虚拟机内存资源的调度方法,其特征在于,所述判断所述可用内存是否小于所述目标内存调度区间的上限值子步骤,若所述可用内存大于或者等于所述目标内存调度区间的上限值,按照所述内存上限值为所述配置参数中每一个虚拟机分配内存。The method for scheduling a virtual machine memory resource according to claim 11, wherein the determining whether the available memory is smaller than an upper limit sub-step of the target memory scheduling interval, if the available memory is greater than or equal to The upper limit value of the target memory scheduling interval is allocated according to the memory upper limit value for each virtual machine in the configuration parameter.
- 根据权利要求11所述的虚拟机内存资源的调度方法,其特征在于,所述判断所述可用内存是否大于或者等于所述目标内存调度区间的下限值子步骤,若所述可用内存小于所述目标内存调度区间的下限值,则发出内存不足的提醒消息。The method for scheduling a virtual machine memory resource according to claim 11, wherein the determining whether the available memory is greater than or equal to a lower limit sub-step of the target memory scheduling interval, if the available memory is smaller than When the lower limit value of the target memory scheduling interval is described, an alert message indicating that the memory is insufficient is issued.
- 根据权利要求1所述的虚拟机内存资源的调度方法,其特征在于,所述物理机上的虚拟机按照预设排列顺序进行部署,其中居于首位的虚拟机具有调度其他虚拟机内存的权限。The method for scheduling memory resources of a virtual machine according to claim 1, wherein the virtual machines on the physical machine are deployed in a preset sequence, wherein the virtual machine in the first place has the right to schedule memory of other virtual machines.
- 一种虚拟机内存资源的调度装置,其特征在于,包括:A scheduling device for a virtual machine memory resource, comprising:目标内存调度区间计算单元,用于根据物理机的资源调度指令中包含的配置参数,计算所述资源调度指令的目标内存调度区间;a target memory scheduling interval calculating unit, configured to calculate a target memory scheduling interval of the resource scheduling instruction according to a configuration parameter included in a resource scheduling instruction of the physical machine;内存分配判断单元,用于判断所述物理机上的可用内存是否处于所述目标内存调度区间对应范围内,若是,运行内存分配单元;a memory allocation judging unit, configured to determine whether the available memory on the physical machine is within a corresponding range of the target memory scheduling interval, and if so, running a memory allocation unit;所述内存分配单元,用于根据所述配置参数在所述物理机上为所述资源调度指令分配虚拟机,并将所述可用内存分配给所述虚拟机。The memory allocation unit is configured to allocate a virtual machine to the resource scheduling instruction on the physical machine according to the configuration parameter, and allocate the available memory to the virtual machine.
- 根据权利要求15所述的虚拟机内存资源的调度装置,其特征在于,所述配置参数包括:The apparatus for scheduling memory resources of a virtual machine according to claim 15, wherein the configuration parameters comprise:虚拟机的数目、标识、内存下限值、内存上限值、最小自由内存和最大自由内存。Number of virtual machines, identification, memory lower limit, memory upper limit, minimum free memory, and maximum free memory.
- 根据权利要求16所述的虚拟机内存资源的调度装置,其特征在于,包括:The apparatus for scheduling memory resources of a virtual machine according to claim 16, comprising:释放内存检测单元,用于按照预设检测周期对所述物理机上的虚拟机进行检测,当检测到所述物理机上的虚拟机释放内存后,运行释放内存分配单元;The memory detecting unit is configured to detect the virtual machine on the physical machine according to a preset detection period, and after detecting that the virtual machine on the physical machine releases the memory, run the release memory allocation unit;所述释放内存分配单元,用于根据所述物理机上的虚拟机实际占用内存和所述内存上限值,判断所述虚拟机的实际占用内存是否小于所述内存上限值,若是,将所述物理机上释放的内存分配给所述虚拟机。The release memory allocation unit is configured to determine, according to the actual occupied memory of the virtual machine on the physical machine and the upper limit of the memory, whether the actual occupied memory of the virtual machine is smaller than the upper limit of the memory, and if so, The memory released on the physical machine is allocated to the virtual machine.
- 根据权利要求16所述的虚拟机内存资源的调度装置,其特征在于,所述内存分配单元,包括:The apparatus for scheduling memory resources of a virtual machine according to claim 16, wherein the memory allocation unit comprises:针对所述配置参数中每一个虚拟机,分别运行第一计算子单元、第二计算子单元和 第一判断子单元,并且每分配一个虚拟机,计算一次所述物理机的可用内存,并将计算获得的所述可用内存代入所述第一判断子单元:Running, for each virtual machine in the configuration parameter, a first computing subunit, a second computing subunit, and Determining a subunit, and each time a virtual machine is allocated, calculating available memory of the physical machine once, and substituting the calculated available memory into the first determining subunit:所述第一计算子单元,用于根据所述配置参数以及剩余虚拟机实际占用内存,分别计算所述剩余虚拟机的第一内存分配阈值、第二内存分配阈值、第三内存分配阈值和第四内存分配阈值;The first calculating subunit is configured to calculate, according to the configuration parameter and the actual occupied memory of the remaining virtual machine, a first memory allocation threshold, a second memory allocation threshold, a third memory allocation threshold, and a first Four memory allocation thresholds;所述第二计算子单元,用于对所述剩余虚拟机的第一内存分配阈值、第二内存分配阈值、第三内存分配阈值和第四内存分配阈值分别进行求和;The second calculating subunit is configured to respectively sum the first memory allocation threshold, the second memory allocation threshold, the third memory allocation threshold, and the fourth memory allocation threshold of the remaining virtual machines;所述第一判断子单元,用于判断所述可用内存是否大于或者等于所述第一内存分配阈值之和;The first determining subunit is configured to determine whether the available memory is greater than or equal to a sum of the first memory allocation thresholds;若大于或者等于所述第一内存分配阈值之和,运行第一内存分配子单元;If the sum of the first memory allocation threshold is greater than or equal to, the first memory allocation subunit is operated;所述第一内存分配子单元,用于按照所述第一内存分配阈值为所述虚拟机分配内存;The first memory allocation subunit is configured to allocate memory according to the first memory allocation threshold;若小于所述第一内存分配阈值之和,运行第二判断子单元;If the sum of the first memory allocation threshold is less than, the second determining subunit is operated;所述第二判断子单元,用于判断所述可用内存是否大于或者等于所述第二内存分配阈值之和;The second determining subunit is configured to determine whether the available memory is greater than or equal to a sum of the second memory allocation thresholds;若大于或者等于所述第二内存分配阈值之和,运行第二内存分配子单元;If the sum of the second memory allocation threshold is greater than or equal to, the second memory allocation subunit is operated;所述第二内存分配子单元,用于按照所述第二内存分配阈值为所述虚拟机分配内存;The second memory allocation subunit is configured to allocate memory according to the second memory allocation threshold;若小于所述第二内存分配阈值之和,运行第三判断子单元;If the sum is less than the sum of the second memory allocation thresholds, running a third determining subunit;所述第三判断子单元,用于判断所述可用内存是否大于或者等于所述第三内存分配阈值之和;The third determining subunit is configured to determine whether the available memory is greater than or equal to a sum of the third memory allocation thresholds;若大于或者等于所述第三内存分配阈值之和,运行第三内存分配子单元;If greater than or equal to the sum of the third memory allocation thresholds, running a third memory allocation sub-unit;所述第三内存分配子单元,用于按照所述第三内存分配阈值为所述虚拟机分配内存;The third memory allocation subunit is configured to allocate memory according to the third memory allocation threshold;若小于所述第三内存分配阈值之和,运行第四判断子单元;If the sum is less than the sum of the third memory allocation thresholds, running the fourth determining subunit;所述第四判断子单元,用于判断所述可用内存是否大于或者等于所述第四内存分配阈值之和;The fourth determining subunit is configured to determine whether the available memory is greater than or equal to a sum of the fourth memory allocation thresholds;若大于或者等于所述第四内存分配阈值之和,运行第四内存分配子单元;If the sum of the fourth memory allocation threshold is greater than or equal to, the fourth memory allocation subunit is operated;所述第四内存分配子单元,用于按照所述第四内存分配阈值为所述虚拟机分配内存; The fourth memory allocation subunit is configured to allocate memory according to the fourth memory allocation threshold;其中,所述第一内存分配阈值等于所述虚拟机实际占用内存与所述最大自由内存之和;The first memory allocation threshold is equal to a sum of an actual occupied memory of the virtual machine and the maximum free memory;所述第二内存分配阈值等于所述虚拟机实际占用内存与所述最小自由内存之和;The second memory allocation threshold is equal to a sum of an actual occupied memory of the virtual machine and the minimum free memory;所述第三内存分配阈值等于所述内存下限值与所述最大自由内存之和;The third memory allocation threshold is equal to a sum of the memory lower limit value and the maximum free memory;所述第四内存分配阈值等于所述内存下限值与所述最小自由内存之和;The fourth memory allocation threshold is equal to a sum of the memory lower limit value and the minimum free memory;所述可用内存等于所述物理机实际内存减去所述物理机上虚拟机和操作系统占用内存。The available memory is equal to the physical memory of the physical machine minus the memory occupied by the virtual machine and the operating system on the physical machine.
- 一种电子设备,其特征在于,包括:An electronic device, comprising:存储器,以及处理器;Memory, and processor;所述存储器用于存储计算机可执行指令,所述处理器用于执行所述计算机可执行指令:The memory is for storing computer executable instructions for executing the computer executable instructions:根据物理机的资源调度指令中包含的配置参数,计算所述资源调度指令的目标内存调度区间;Calculating a target memory scheduling interval of the resource scheduling instruction according to a configuration parameter included in a resource scheduling instruction of the physical machine;判断所述物理机上的可用内存是否处于所述目标内存调度区间对应范围内,若是,根据所述配置参数在所述物理机上为所述资源调度指令分配虚拟机,并将所述可用内存分配给所述虚拟机。 Determining whether the available memory on the physical machine is within the corresponding range of the target memory scheduling interval, and if so, allocating a virtual machine to the resource scheduling instruction on the physical machine according to the configuration parameter, and allocating the available memory to The virtual machine.
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610925036.XA CN107977264B (en) | 2016-10-24 | 2016-10-24 | Scheduling method and device for memory resources of virtual machine |
CN201610925036.X | 2016-10-24 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2018077030A1 true WO2018077030A1 (en) | 2018-05-03 |
Family
ID=62004863
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2017/105629 WO2018077030A1 (en) | 2016-10-24 | 2017-10-11 | Method for scheduling memory resource of virtual machine and apparatus |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN107977264B (en) |
WO (1) | WO2018077030A1 (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115190023A (en) * | 2021-03-23 | 2022-10-14 | 中移(上海)信息通信科技有限公司 | Configuration management strategy processing method and device and communication equipment |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115221073A (en) * | 2021-04-21 | 2022-10-21 | 华为云计算技术有限公司 | Memory management method and device for physical server for running cloud service instance |
CN113407346B (en) * | 2021-06-28 | 2023-04-07 | Vidaa(荷兰)国际控股有限公司 | Browser memory adjusting method and display device |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103455378A (en) * | 2013-09-05 | 2013-12-18 | 华为技术有限公司 | Resource distribution method of virtual clusters, device and system |
CN103873516A (en) * | 2012-12-14 | 2014-06-18 | 中兴通讯股份有限公司 | HA method and system for improving usage rate of physical servers in cloud computing resource pool |
US20150293790A1 (en) * | 2014-04-09 | 2015-10-15 | Electronics And Telecommunications Research Institute | Method and system for driving virtual machine |
Family Cites Families (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8650564B2 (en) * | 2010-10-19 | 2014-02-11 | Vmware, Inc. | Method and system for synchronizing fault-tolerant virtual machines and adjusting CPU resource limit based on execution latency |
WO2014101010A1 (en) * | 2012-12-26 | 2014-07-03 | 华为技术有限公司 | Resource management method of virtual machine system, virtual machine system, and apparatus |
CN103473139B (en) * | 2013-09-26 | 2016-06-01 | 四川中电启明星信息技术有限公司 | Cluster virtual machine resource allocation scheduling method |
US9720728B2 (en) * | 2013-12-06 | 2017-08-01 | Huawei Technologies Co., Ltd. | Migrating a VM when the available migration duration times of a source and destination node are greater than the VM's migration duration time |
CN104836819A (en) * | 2014-02-10 | 2015-08-12 | 阿里巴巴集团控股有限公司 | Dynamic load balancing method and system, and monitoring and dispatching device |
CN103970618B (en) * | 2014-05-21 | 2017-02-22 | 辽宁中科信科技有限公司 | Technical method for applying no-backup disaster recovery based on cloud computing platform |
CN105094980A (en) * | 2014-05-23 | 2015-11-25 | 北京云巢动脉科技有限公司 | System for dynamically adjusting memories of virtual machines |
CN104991822A (en) * | 2015-06-30 | 2015-10-21 | 浪潮(北京)电子信息产业有限公司 | Memory management method and apparatus |
CN105204948B (en) * | 2015-10-29 | 2019-07-09 | 云宏信息科技股份有限公司 | Virtual machine physical memory configuration method and device |
CN105279028B (en) * | 2015-11-24 | 2018-09-07 | 浪潮(北京)电子信息产业有限公司 | A kind of memory source distribution method and device |
-
2016
- 2016-10-24 CN CN201610925036.XA patent/CN107977264B/en active Active
-
2017
- 2017-10-11 WO PCT/CN2017/105629 patent/WO2018077030A1/en active Application Filing
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103873516A (en) * | 2012-12-14 | 2014-06-18 | 中兴通讯股份有限公司 | HA method and system for improving usage rate of physical servers in cloud computing resource pool |
CN103455378A (en) * | 2013-09-05 | 2013-12-18 | 华为技术有限公司 | Resource distribution method of virtual clusters, device and system |
US20150293790A1 (en) * | 2014-04-09 | 2015-10-15 | Electronics And Telecommunications Research Institute | Method and system for driving virtual machine |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115190023A (en) * | 2021-03-23 | 2022-10-14 | 中移(上海)信息通信科技有限公司 | Configuration management strategy processing method and device and communication equipment |
CN115190023B (en) * | 2021-03-23 | 2023-09-19 | 中移(上海)信息通信科技有限公司 | Configuration management policy processing method and device and communication equipment |
Also Published As
Publication number | Publication date |
---|---|
CN107977264B (en) | 2022-06-10 |
CN107977264A (en) | 2018-05-01 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP6126312B2 (en) | Virtual machine monitor configured to support latency sensitive virtual machines | |
US10565104B2 (en) | System and method to manage and share managed runtime memory for JAVA virtual machine | |
US10061652B2 (en) | Fault recovery management in a cloud computing environment | |
US9405572B2 (en) | Optimized resource allocation and management in a virtualized computing environment | |
EP3313023B1 (en) | Life cycle management method and apparatus | |
US9189619B2 (en) | Runtime based application security and regulatory compliance in cloud environment | |
US9135079B2 (en) | Dynamically assigning a portion of physical computing resource to logical partitions based on characteristics of executing logical partitions | |
US9218042B2 (en) | Cooperatively managing enforcement of energy related policies between virtual machine and application runtime | |
US20130019015A1 (en) | Application Resource Manager over a Cloud | |
US20110010721A1 (en) | Managing Virtualized Accelerators Using Admission Control, Load Balancing and Scheduling | |
US20140373010A1 (en) | Intelligent resource management for virtual machines | |
US20100205303A1 (en) | Virtual machine software license management | |
US20120210331A1 (en) | Processor resource capacity management in an information handling system | |
US9201823B2 (en) | Pessimistic interrupt affinity for devices | |
KR102640232B1 (en) | Method and apparatus for allocating resources in virtual environment | |
US9003094B2 (en) | Optimistic interrupt affinity for devices | |
EP2772854B1 (en) | Regulation method and regulation device for i/o channels in virtualization platform | |
US9753851B2 (en) | Multi-section garbage collection system including real-time garbage collection scheduling | |
US20170093742A1 (en) | Managing a shared pool of configurable computing resources having an arrangement of a set of dynamically-assigned resources | |
WO2018077030A1 (en) | Method for scheduling memory resource of virtual machine and apparatus | |
US20150334039A1 (en) | Bursting cloud resources to affect state change performance | |
WO2015032201A1 (en) | Virtual machine placing method and device | |
US9766917B2 (en) | Limited virtual device polling based on virtual CPU pre-emption | |
CN105677481A (en) | Method and system for processing data and electronic equipment | |
US9575788B2 (en) | Hypervisor handling of processor hotplug requests |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 17864593 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 17864593 Country of ref document: EP Kind code of ref document: A1 |