Memory balloon driving method, device, equipment and storage medium

By periodically reading the physical machine memory utilization rate and executing corresponding memory management strategies, the memory overflow problem caused by excessive physical machine memory usage by virtual machines was solved, thus optimizing physical machine memory and ensuring stable cluster operation.

CN116048727BActive Publication Date: 2026-05-12ANCHAO CLOUD SOFTWARE CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
ANCHAO CLOUD SOFTWARE CO LTD
Filing Date
2023-01-06
Publication Date
2026-05-12

AI Technical Summary

Technical Problem

Virtual machines consume too much physical machine memory during operation, leading to memory overflow and affecting the normal service provided by the virtual machine. Existing technologies are insufficient to effectively control the physical machine's memory utilization.

Method used

By periodically reading the memory utilization of physical machine nodes, memory management strategies are determined based on different ranges, and memory management operations such as memory reclamation, frequency management, power on/off management, and hot migration management are executed to optimize the memory utilization of physical machines.

Benefits of technology

Effectively adjust physical machine memory utilization to avoid memory overflow, ensure the normal operation of the cluster, and guarantee the stability of important virtual machines and services.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116048727B_ABST
    Figure CN116048727B_ABST
Patent Text Reader

Abstract

The application relates to a memory balloon driving method, device, equipment and storage medium, and particularly relates to the technical field of cloud computing. The method comprises the following steps: periodically reading the current node memory utilization of a physical machine; determining a memory management strategy corresponding to an interval range to which the node memory utilization belongs according to the interval range; and performing a management operation on a virtual machine on the physical machine according to the memory management strategy, so as to adjust and optimize the node memory utilization of the physical machine; wherein the management operation comprises at least one of the following: a memory management operation, a frequency management operation, a power-on and power-off management operation and a hot migration management operation. Based on the above technical scheme, the node memory utilization of the physical machine can be adjusted and optimized to a reasonable value, and the normal operation of a cluster is guaranteed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of cloud computing technology, specifically to a memory balloon driving method, apparatus, device, and storage medium. Background Technology

[0002] During the operation of a virtual machine, the virtual machine needs to occupy the physical machine's memory.

[0003] Generally, virtual machines consume a large amount of memory from the physical host. When cluster memory usage surges, if the physical machine runs out of memory, an Out Of Memory (OOM) error will occur, triggering the OOM_killer to randomly kill an unspecified number of virtual machines in the cluster, affecting the normal service provided by the virtual machines.

[0004] Therefore, there is an urgent need to provide a technical solution for effectively controlling the memory utilization of physical machines. Summary of the Invention

[0005] This application provides a memory balloon driver method, apparatus, device, and storage medium. The technical solution is as follows.

[0006] On the one hand, a memory balloon driving method is provided, the method comprising:

[0007] Periodically read the current node memory utilization of the physical machine;

[0008] Based on the range of the node's memory utilization, determine the memory management strategy corresponding to the range.

[0009] According to the memory management strategy, management operations are performed on the virtual machines on the physical machine to adjust and optimize the node memory utilization of the physical machine;

[0010] The management operations include at least one of the following: memory management operations, frequency management operations, power on / off management operations, and hot migration management operations.

[0011] In another aspect, a memory balloon driving device is provided, the device comprising:

[0012] The memory utilization reading module is used to periodically read the current node memory utilization of the physical machine.

[0013] The memory management strategy determination module is used to determine the memory management strategy corresponding to the interval range to which the node memory utilization rate belongs.

[0014] The memory management policy execution module is used to perform management operations on the virtual machines on the physical machine according to the memory management policy, so as to adjust and optimize the node memory utilization of the physical machine;

[0015] The management operations include at least one of the following: memory management operations, frequency management operations, power on / off management operations, and hot migration management operations.

[0016] In another aspect, a computer device is provided, the computer device including a processor and a memory, the memory storing at least one instruction, at least one program, code set or instruction set, the at least one instruction, at least one program, code set or instruction set being loaded and executed by the processor to implement the above-described memory balloon driving method.

[0017] In another aspect, a computer-readable storage medium is provided, wherein at least one instruction, at least one program, code set, or instruction set is stored therein, wherein the at least one instruction, at least one program, code set, or instruction set is loaded and executed by a processor to implement the memory balloon driving method described above.

[0018] Furthermore, a computer program product or computer program is provided, comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the aforementioned memory balloon driving method.

[0019] The technical solution provided in this application may include the following beneficial effects:

[0020] By periodically reading the node memory utilization of physical machines and determining the appropriate memory management strategy based on the range of that node's memory utilization, management operations are performed on the virtual machines on the physical machines according to the memory management strategy. This process adjusts and optimizes the node memory utilization of the physical machines to a reasonable value and ensures the normal operation of the cluster. Attached Figure Description

[0021] To more clearly illustrate the technical solutions in the specific embodiments of this application or the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0022] Figure 1This is a flowchart illustrating a memory balloon driving method according to an exemplary embodiment.

[0023] Figure 2 This is a schematic diagram of a memory reclamation log according to an exemplary embodiment.

[0024] Figure 3 This is a schematic diagram illustrating details of memory reclamation according to an exemplary embodiment.

[0025] Figure 4 This is a flowchart illustrating a memory reclamation process according to an exemplary embodiment.

[0026] Figure 5 This is a flowchart illustrating a memory reclamation process according to an exemplary embodiment.

[0027] Figure 6 This is a flowchart illustrating a memory reclamation process according to an exemplary embodiment.

[0028] Figure 7 This is a schematic diagram illustrating a memory reclamation configuration according to an exemplary embodiment.

[0029] Figure 8 This is a structural block diagram of a memory balloon driving device according to an exemplary embodiment.

[0030] Figure 9 This is a schematic diagram of a computer device provided according to an exemplary embodiment. Detailed Implementation

[0031] The technical solutions of this application will now be clearly and completely described with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0032] It should be understood that the term "instruction" mentioned in the embodiments of this application can be a direct instruction, an indirect instruction, or an indication of a relationship. For example, A instructing B can mean that A directly instructs B, such as B being able to obtain information through A; it can also mean that A indirectly instructs B, such as A instructing C, so B can obtain information through C; or it can mean that there is a relationship between A and B.

[0033] In the description of the embodiments of this application, the term "correspondence" may indicate that there is a direct or indirect correspondence between two things, or that there is an association between two things, or that there is a relationship of instruction and being instructed, configuration and being configured, etc.

[0034] In the embodiments of this application, "predefined" can be achieved by pre-storing corresponding codes, tables or other means that can be used to indicate relevant information in the device (e.g., including terminal devices and network devices). This application does not limit the specific implementation method.

[0035] During virtual machine operation, from the guest's perspective, memory utilization sometimes appears high and sometimes low. However, from the host's perspective, once the virtual machine's memory pages are mapped to physical memory, they consume host memory. Without memory reclamation, the physical memory occupied by the virtual machine will only increase, not decrease. For example, when a Windows system starts, it sets all memory to 0, thus requiring all memory to be allocated on the physical host instead of on-demand allocation. Without reclamation, the virtual machine will consume a large amount of physical host memory, significantly reducing the physical host's resource utilization.

[0036] If cluster memory usage surges, an OutOfMemoryError (OOM) will occur after the physical machine's memory is exhausted. This will trigger the OOM_killer to randomly kill an unspecified number of virtual machines in the cluster. Meanwhile, other virtual machines that are not killed are likely to enter a paused state due to a Central Processing Unit (CPU) error. If a container-level virtual machine is killed, it will cause the platform to crash. If a virtual machine containing important data is killed, it will cause service interruption.

[0037] To avoid the above-mentioned defects, in this embodiment, the node memory utilization of the physical machine is read periodically, and different memory management strategies are used in different scenarios based on the read node utilization: In scenarios where the node memory utilization in the cluster is high (e.g., 70%-90%), virtual machine memory is reclaimed proportionally, mapping is canceled on the physical machine, more physical memory is released, the node memory utilization of the physical machine is reduced, and the resource utilization of the physical machine is greatly improved, allowing more virtual machines to be started; In scenarios where the node memory utilization in the cluster is very high (e.g., above 90%), various methods (hot migration, frequency reduction, shutdown) are used to reduce the node memory utilization and protect the normal operation of the cluster; When the cluster node memory utilization surges and causes memory overflow and process killing, the normal operation of important virtual machines / services / containers is ensured, and unprotected virtual machines / services / containers are shut down; In scenarios where the node memory utilization in the cluster is low (e.g., below 60%), virtual machines are subjected to memory expansion and frequency restoration operations.

[0038] The technical solution provided in this application will be further described below with reference to the following embodiments.

[0039] Figure 1 This is a flowchart illustrating a memory balloon driving method according to an exemplary embodiment. The method can be executed by a computer device, such as... Figure 1 As shown, the memory balloon driver method may include the following steps:

[0040] Step 110: Periodically read the current node memory utilization of the physical machine.

[0041] In this embodiment, the current node utilization of the physical machine is read periodically at a fixed interval. Node memory utilization refers to the proportion of memory occupied by the physical machine within its total memory. The fixed interval can be on the order of minutes, for example, reading the current node memory utilization of the physical machine every two minutes.

[0042] Step 120: Determine the memory management strategy corresponding to the interval range to which the node memory utilization belongs.

[0043] In this embodiment, memory management strategies corresponding to node memory utilization rates in different intervals are pre-defined, and the content of the memory management strategies corresponding to node memory utilization rates in different intervals is not exactly the same. After reading the current node memory utilization rate of the physical machine, the memory management strategy matching the node memory utilization rate is determined through the interval range to which the node memory utilization rate belongs.

[0044] For example, the first interval corresponds to the first memory management strategy, the second interval corresponds to the second memory management strategy, the third interval corresponds to the third memory management strategy, the fourth interval corresponds to the fourth memory management strategy, and the fifth interval corresponds to the fifth memory management strategy, and the content of each of the above memory management strategies is not completely the same.

[0045] Step 130: Perform management operations on the virtual machines on the physical machine according to the memory management policy to adjust and optimize the node memory utilization of the physical machine.

[0046] The management operations include at least one of the following: memory management operations, frequency management operations, power on / off management operations, and hot migration management operations.

[0047] Among them, memory management operations refer to the operations of releasing or reclaiming memory for virtual machines; frequency management operations refer to the operations of reducing or restoring the main frequency for virtual machines; power on / off management operations refer to the operations of powering on or powering off virtual machines; and hot migration management operations refer to the operations of hot migration for virtual machines.

[0048] In this embodiment, after determining a memory management strategy that matches the current node memory utilization, management operations are performed on the virtual machines on the physical machine. These management operations can affect the memory usage of the virtual machines on the physical machine, thereby adjusting and optimizing the node memory utilization of the physical machine to a reasonable state through the execution of management operations.

[0049] For example, when the current node memory utilization of the physical machine is high, perform management operations on the virtual machines on the physical machine to reduce the node memory utilization; when the current node memory utilization of the physical machine is low, perform management operations on the virtual machines on the physical machine to improve the node memory utilization.

[0050] In one possible implementation, the execution status of memory management strategies is recorded and displayed through memory reclamation logs in the platform logs. For example, referring to the reference... Figure 2 The platform logs include memory reclamation logs, which record memory management operations. In the memory reclamation log, the occurrence time is the start time that triggers the memory management operation, and the metric is the range of node memory utilization on the physical machine at the time of triggering memory reclamation, combined with reference... Figure 3 Clicking on the occurrence time in the memory reclamation log will display the memory reclamation details.

[0051] In summary, the memory balloon driving method provided in this embodiment periodically reads the node memory utilization of the physical machine, determines the memory management strategy matching the node memory utilization based on the range of the node memory utilization, and performs management operations on the virtual machines on the physical machine according to the memory management strategy. In this way, the node memory utilization of the physical machine is adjusted and optimized to a reasonable value through the execution of management operations, and the normal operation of the cluster is ensured.

[0052] In the illustrative embodiment, the virtual machine is equipped with a memory reclamation switch and a memory protection switch.

[0053] • Memory reclamation switch

[0054] Specifically, memory management operations include memory reclamation. Virtual machines have a corresponding memory reclamation switch, which indicates whether the virtual machine supports performing memory reclamation on it.

[0055] For example, if a virtual machine's memory reclamation switch is turned on, then that virtual machine is considered a reclaimable memory virtual machine. When the memory management policy instructs that memory reclamation be performed, memory reclamation will be performed on reclaimable memory virtual machines, including this virtual machine.

[0056] Memory protection switch

[0057] Specifically, each virtual machine has a memory protection switch, which indicates whether the virtual machine is protected. In the event of a memory overflow, the virtual machine with the memory protection switch on is guaranteed to run normally, while the virtual machine with the memory protection switch off is shut down.

[0058] For example, if a virtual machine's memory protection switch is turned on, then that virtual machine is a memory-protected virtual machine. In the event of a memory overflow, memory protection will be applied to all memory-protected virtual machines, including this one, to ensure normal operation. These memory-protected virtual machines can be container-level virtual machines or virtual machines containing critical data.

[0059] For example, after enabling protection for the virtual machine via the memory protection switch, the virtual machine will be executed with `echo -999 > / proc / $pid / oom_score_adj`. When the cluster memory overflows and the OOM process is killed, the virtual machine process with protection enabled will not be killed.

[0060] Understandably, in addition to protecting virtual machines, containers and services can also be protected. For example, for containers, add the following to the container startup parameters: --oom-score-adj-999; for services to be protected (set during deployment, default), add OOMScoreAdjust=-999 to the services file to protect containers and services from being killed.

[0061] In one possible implementation, the use of the memory protection switch is regulated as follows: At the point in time when virtual machines are created from images, isos, or snapshots, the user can choose whether to enable the memory protection switch to activate protection; once the combined memory of virtual machines with memory protection enabled in the current cluster reaches 30% of the total cluster memory, protection is no longer allowed; if a virtual machine has already participated in memory reclamation, a message will be displayed stating "Memory has been reclaimed; virtual machine protection will be enabled again after release"; new virtual machines cloned from virtual machines with protection enabled will have no protection by default.

[0062] In summary, the memory balloon driver method provided in this embodiment can control the memory reclamation and memory protection of virtual machines by adding a memory reclamation switch and a memory protection switch, thereby ensuring the normal operation of important virtual machines.

[0063] In the illustrative embodiment, memory management strategies can employ a variety of different management operations for virtual machines to ensure the normal operation of the cluster.

[0064] • The memory management strategy includes a first memory management strategy corresponding to the first interval range, where the first interval range is the range below the first proportional threshold.

[0065] Specifically, according to the first memory management policy, the system queries whether there are any first-type virtual machines on the physical machine that have had their memory reclaimed, and whether there are any second-type virtual machines on the physical machine that have had their clock speed reduced. If there are first-type virtual machines on the physical machine, the system queries the time elapsed since the last memory release. If the time elapsed is greater than the time elapsed threshold, the system performs memory release on the first-type virtual machines. If there are second-type virtual machines on the physical machine, the system restores the clock speed on the second-type virtual machines.

[0066] In other words, if the node's memory utilization is lower than the first threshold (e.g., 60%), the system checks if the node has any virtual machines whose memory has been reclaimed. If not, it skips the process. If it has, it checks the last memory release time of the node. If the time interval is less than the time threshold (e.g., 1 hour), it skips the process. If the time interval is greater than the time threshold, it performs virtual machine memory release. The system also checks if the node has any virtual machines whose clock speed has been reduced. If not, it skips the process. If it has, it restores the clock speed.

[0067] • The memory management strategy includes a second memory management strategy corresponding to the second interval range, which is the range that is higher than the first proportional threshold and lower than the second proportional threshold.

[0068] Specifically, according to the second memory management strategy, check if there are any second-type virtual machines on the physical machine that have been downclocked; if there are second-type virtual machines on the physical machine, restore the main frequency of the second-type virtual machines.

[0069] That is, if the node memory utilization rate is between the first proportional threshold (e.g., 60%) and the second proportional threshold (e.g., 70%), check if there are any virtual machines on the node that have been downclocked. If not, skip the process; if so, restore the main frequency.

[0070] • The memory management strategy includes a third memory management strategy corresponding to the third interval range, which is the range that is higher than the second proportional threshold and lower than the third proportional threshold.

[0071] Specifically, according to the third memory management strategy, the system checks whether there are any third-type virtual machines on the physical machine with the memory reclamation switch turned on and which have not yet been reclaimed, and whether there are any second-type virtual machines on the physical machine that have been downclocked. If there are third-type virtual machines on the physical machine, the system performs one level of memory reclamation on the third-type virtual machines according to the reclamation ratio configured by the second ratio threshold. If there are second-type virtual machines on the physical machine, the system restores the main frequency of the second-type virtual machines.

[0072] In other words, if the node's memory utilization is between the second threshold (e.g., 70%) and the third threshold (e.g., 80%), check if there are any virtual machines on the node with memory reclamation enabled but not yet reclaimed. If so, reclaim memory at the 70% configured reclamation rate. Check if there are any virtual machines on the node that have been downclocked. If not, skip this step; if so, restore the clock speed.

[0073] For example, in conjunction with the reference Figure 4 If the node memory utilization is detected to be greater than 70%, memory reclamation is triggered. The node checks for virtual machines with reclaimable memory and enables memory reclamation for these virtual machines, reclaiming 30% of the free memory (configurable).

[0074] • The memory management strategy includes a fourth memory management strategy corresponding to the fourth interval range, which is the range that is higher than the third proportional threshold and lower than the fourth proportional threshold.

[0075] Specifically, according to the fourth memory management strategy, check whether there are any fourth-type virtual machines on the physical machine whose memory reclamation switch is on and which have not yet been reclaimed or have been reclaimed in the first stage according to the proportion configured in the second proportion threshold; if there are fourth-type virtual machines on the physical machine, perform second-stage memory reclamation on the fourth-type virtual machines according to the reclamation proportion configured in the third proportion threshold.

[0076] That is, if the node memory utilization rate is between the third ratio threshold (e.g., 80%) and the fourth ratio threshold (e.g., 90%), check if there are any virtual machines on the node that have enabled memory reclamation and have not been reclaimed or have only performed the first level of reclamation. If so, then perform the second level of reclamation according to the 80% configured reclamation ratio.

[0077] For example, in conjunction with the reference Figure 5 If the node memory utilization is detected to be greater than 80%, memory reclamation is triggered. The node checks for virtual machines with reclaimable memory and enables memory reclamation for these virtual machines, reclaiming 60% of the free memory (configurable).

[0078] • The memory management strategy includes a fifth memory management strategy corresponding to the fifth interval range, which is the range above the fourth proportional threshold.

[0079] Specifically, according to the fifth memory management strategy, check if there are any fourth-type virtual machines on the physical machine with the memory reclamation switch on, which have not yet been reclaimed or have been reclaimed at the first level according to the reclamation ratio configured in the second ratio threshold; if there are fourth-type virtual machines on the physical machine, perform second-level memory reclamation on the fourth-type virtual machines according to the reclamation ratio configured in the third ratio threshold; if the node memory utilization is still within the fifth range after the second-level memory reclamation, perform hot migration, frequency reduction, and shutdown on the virtual machines on the physical machine in sequence until the node memory utilization is lower than the fourth ratio threshold.

[0080] That is, if the node memory utilization rate is greater than the fourth ratio threshold (e.g., 90%), check if there are any virtual machines on the node that have enabled memory reclamation and have not been reclaimed or have only performed the first level of reclamation. If so, perform the second level of reclamation according to the reclamation ratio configured at the third ratio threshold (e.g., 80%), and further use multiple means to reduce the node memory utilization rate of the physical machine. The main forced means are: automatic system scheduling of hot migration, frequency reduction, and shutdown (the means are executed in sequence).

[0081] In one possible implementation, the process of reducing the node memory utilization of the physical machine using multiple methods includes:

[0082] (1) Calculate the total memory usage y of virtual machines that exceed the memory amount x and support hot migration. x is equal to the memory usage corresponding to the part of the node memory utilization that exceeds the fourth proportional threshold.

[0083] (2) When x is less than y, perform hot migration on virtual machines that support hot migration in order of memory usage, and at the same time reduce the frequency of virtual machines running on the physical machine until the node memory utilization rate is lower than the fourth ratio threshold.

[0084] The number of virtual machines that need to be hot-migrated can be calculated based on the value of x.

[0085] (3) When x is greater than y, perform hot migration on all virtual machines that support hot migration and reduce the frequency of virtual machines running on the physical machine. After the frequency reduction is completed, if the node memory utilization is still within the fifth range, shut down some virtual machines running on the physical machine until the node memory utilization is lower than the fourth ratio threshold.

[0086] The number of virtual machines that need to be shut down can be calculated based on the values ​​of x and y.

[0087] For example, in conjunction with reference Figure 6If node memory utilization exceeds 90%, memory reclamation is triggered. Virtual machines on the node with reclaimable memory are checked, and memory reclamation is enabled for these machines, reclaiming 60% of their free memory (configurable). If node memory utilization remains above 90% after reclamation, the required memory reduction is calculated, and virtual machines with appropriate memory are selected for migration. Simultaneously, the frequency of other virtual machines on the node is reduced. If node memory utilization remains above 90% after frequency reduction, the required memory reduction is calculated again, and virtual machines with appropriate memory are shut down.

[0088] It is understood that the recovery ratios corresponding to the above-mentioned threshold ratios are configurable. For example, referring to the reference... Figure 7 If the second threshold is 70%, the third threshold is 80%, and the fourth threshold is 90%, when it exceeds 70%, 30% of the idle resources are reclaimed. The configurable range is 1~79%, but it cannot exceed the percentage of memory reclaimed when it exceeds 80%. When it exceeds 80%, 60% of the idle resources are reclaimed. The configurable range is 0~80%.

[0089] In one possible implementation, the memory management strategy is defined as follows: memory convergence can be set during virtual machine hot migration to accelerate the migration; pause / suspend / restart / hard reboot operations do not affect the reclamation and frequency reduction of existing virtual machines; after the migration, another node determines whether memory bloat is caused by its node memory utilization; after the virtual machine is shut down, memory reclamation and frequency reduction will automatically become invalid; after booting up, if the node still exceeds the corresponding threshold, memory will be reclaimed and frequency reduced again; if a virtual machine is undergoing hot migration and shutdown, the node will not perform the next node memory utilization check before the process ends.

[0090] In summary, the memory balloon driver method provided in this embodiment can employ various different management operations for virtual machines, enabling the cluster to run smoothly under the memory utilization metrics of each node.

[0091] It should be noted that the above method embodiments can be implemented individually or in combination, and this application does not limit them in this regard.

[0092] Figure 8 This is a structural block diagram illustrating a memory balloon driving device according to an exemplary embodiment. The device includes:

[0093] The memory utilization reading module 801 is used to periodically read the current node memory utilization of the physical machine;

[0094] The memory management strategy determination module 802 is used to determine the memory management strategy corresponding to the interval range to which the node memory utilization rate belongs.

[0095] The memory management policy execution module 803 is used to perform management operations on the virtual machines on the physical machine according to the memory management policy, so as to adjust and optimize the node memory utilization of the physical machine;

[0096] The management operations include at least one of the following: memory management operations, frequency management operations, power on / off management operations, and hot migration management operations.

[0097] In one possible implementation, the memory management operation includes memory reclamation, and the virtual machine has a corresponding memory reclamation switch, which is used to indicate whether the virtual machine supports performing memory reclamation on it.

[0098] In one possible implementation, the memory management strategy includes a first memory management strategy corresponding to a first interval range, wherein the first interval range is a range below a first proportional threshold.

[0099] The memory management policy execution module 803 is used for:

[0100] According to the first memory management policy, query whether there are any first-type virtual machines on the physical machine whose memory has been reclaimed, and query whether there are any second-type virtual machines on the physical machine whose frequency has been reduced;

[0101] If the physical machine has the first type of virtual machine, query the distance between the last memory release time and the current time. If the distance is greater than the duration threshold, perform memory release on the first type of virtual machine.

[0102] If the physical machine has the second type of virtual machine, perform a frequency recovery operation on the second type of virtual machine.

[0103] In one possible implementation, the memory management strategy includes a second memory management strategy corresponding to a second interval range, wherein the second interval range is a range that is higher than a first proportional threshold and lower than a second proportional threshold.

[0104] The memory management policy execution module 803 is used for:

[0105] According to the second memory management strategy, query whether there are any second-type virtual machines that have been downclocked on the physical machine;

[0106] If the physical machine has the second type of virtual machine, perform a frequency recovery operation on the second type of virtual machine.

[0107] In one possible implementation, the memory management strategy includes a third memory management strategy corresponding to a third interval range, wherein the third interval range is a range that is higher than a second proportional threshold and lower than a third proportional threshold.

[0108] The memory management policy execution module 803 is used for:

[0109] According to the third memory management strategy, query whether there are any third-type virtual machines on the physical machine whose memory reclamation switch is on and which have not yet been reclaimed, and query whether there are any second-type virtual machines on the physical machine whose frequency has been reduced;

[0110] If the physical machine has the third type of virtual machine, perform a level of memory reclamation on the third type of virtual machine according to the reclamation ratio configured by the second ratio threshold;

[0111] If the physical machine has the second type of virtual machine, perform a frequency recovery operation on the second type of virtual machine.

[0112] In one possible implementation, the memory management strategy includes a fourth memory management strategy corresponding to a fourth interval range, wherein the fourth interval range is a range that is higher than a third proportional threshold and lower than a fourth proportional threshold.

[0113] The memory management policy execution module 803 is used for:

[0114] According to the fourth memory management strategy, query whether there are any fourth type virtual machines on the physical machine whose memory reclamation switch is turned on, have not yet been reclaimed, or have been reclaimed at the first level according to the reclamation ratio configured by the second ratio threshold;

[0115] If the physical machine has the fourth type of virtual machine, the fourth type of virtual machine is subjected to second-level memory reclamation according to the reclamation ratio configured by the third ratio threshold.

[0116] In one possible implementation, the memory management strategy includes a fifth memory management strategy corresponding to a fifth interval range, wherein the fifth interval range is a range higher than the fourth proportional threshold.

[0117] The memory management policy execution module 803 is used for:

[0118] According to the fifth memory management strategy, query whether there are any fourth type virtual machines on the physical machine whose memory reclamation switch is on and which have not yet been reclaimed or have been reclaimed at the first level according to the reclamation ratio configured in the second ratio threshold.

[0119] If the physical machine has the fourth type of virtual machine, the fourth type of virtual machine is subjected to second-level memory reclamation according to the reclamation ratio configured by the third ratio threshold.

[0120] After the second level of memory reclamation, if the node memory utilization rate is still within the fifth range, the virtual machines on the physical machine will be hot-migrated, downclocked, and shut down in sequence until the node memory utilization rate is lower than the fourth ratio threshold.

[0121] In one possible implementation, the memory management policy execution module 803 is configured to:

[0122] Calculate the total memory usage y of virtual machines that exceed the memory amount x and support hot migration, where x is equal to the memory usage corresponding to the portion of the node memory utilization that exceeds the fourth proportional threshold;

[0123] When x is less than y, hot migration is performed on virtual machines that support hot migration in order of memory usage, while the frequency of virtual machines running on the physical machine is reduced until the memory utilization of the node is lower than the fourth ratio threshold.

[0124] If x is greater than y, perform hot migration on all virtual machines that support hot migration, and reduce the frequency of virtual machines running on the physical machine; after the frequency reduction is completed, if the node memory utilization is still within the fifth range, shut down some virtual machines running on the physical machine until the node memory utilization is lower than the fourth ratio threshold.

[0125] In one possible implementation, the virtual machine has a corresponding memory protection switch, which is used to indicate whether the virtual machine is protected;

[0126] The device further includes: a virtual machine protection module; the virtual machine protection module is used for:

[0127] In the event of a memory overflow, ensure the normal operation of virtual machines with the memory protection switch in the on state, and shut down virtual machines with the memory protection switch in the off state.

[0128] It should be noted that the memory balloon driver device provided in the above embodiments is only an example of the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the device and method embodiments provided in the above embodiments belong to the same concept, and their specific implementation process can be found in the method embodiments, which will not be repeated here.

[0129] Please see Figure 9This is a schematic diagram of a computer device provided according to an exemplary embodiment of the present application. The computer device includes a memory and a processor. The memory is used to store a computer program. When the computer program is executed by the processor, it implements the memory balloon driving method described above.

[0130] The processor can be a central processing unit (CPU). It can also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or combinations thereof.

[0131] Memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs, non-transitory computer-executable programs, and modules, such as the program instructions / modules corresponding to the methods in the embodiments of this application. The processor executes various functional applications and data processing by running the non-transitory software programs, instructions, and modules stored in the memory, thereby implementing the methods in the above-described embodiments.

[0132] The memory may include a program storage area and a data storage area. The program storage area may store the operating system and applications required for at least one function; the data storage area may store data created by the processor, etc. Furthermore, the memory may include high-speed random access memory and non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, the memory may optionally include memory remotely located relative to the processor, which can be connected to the processor via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0133] In one exemplary embodiment, a computer-readable storage medium is also provided for storing at least one computer program, which is loaded and executed by a processor to implement all or part of the steps in the above-described method. For example, the computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a compact disc read-only memory (CD-ROM), magnetic tape, floppy disk, or optical data storage device, etc.

[0134] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this application are indicated by the following claims.

[0135] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.

Claims

1. A memory balloon driving method, characterized in that, The method includes: Periodically read the current node memory utilization of the physical machine; Based on the range of the node's memory utilization, determine the memory management strategy corresponding to the range. According to the memory management strategy, management operations are performed on the virtual machines on the physical machine to adjust and optimize the node memory utilization of the physical machine; The management operations include at least one of the following: memory management operations, frequency management operations, power on / off management operations, and hot migration management operations; The memory management strategy includes a first memory management strategy corresponding to a first interval range, where the first interval range is a range below a first proportional threshold; the step of performing management operations on the virtual machine on the physical machine according to the memory management strategy includes: According to the first memory management policy, query whether there are any first-type virtual machines on the physical machine whose memory has been reclaimed, and query whether there are any second-type virtual machines on the physical machine whose frequency has been reduced; If the physical machine has the first type of virtual machine, query the distance between the last memory release time and the current time. If the distance is greater than the duration threshold, perform memory release on the first type of virtual machine. If the physical machine has the second type of virtual machine, perform a frequency recovery operation on the second type of virtual machine.

2. The method according to claim 1, characterized in that, The memory management operation includes memory reclamation. The virtual machine has a corresponding memory reclamation switch, which is used to indicate whether the virtual machine supports performing memory reclamation on it.

3. The method according to claim 1, characterized in that, The memory management strategy includes a second memory management strategy corresponding to the second interval range, wherein the second interval range is the range that is higher than the first proportional threshold and lower than the second proportional threshold. The step of performing management operations on the virtual machines on the physical machine according to the memory management policy includes: According to the second memory management strategy, query whether there are any second-type virtual machines that have been downclocked on the physical machine; If the physical machine has the second type of virtual machine, perform a frequency recovery operation on the second type of virtual machine.

4. The method according to claim 2, characterized in that, The memory management strategy includes a third memory management strategy corresponding to the third interval range, wherein the third interval range is the range that is higher than the second proportional threshold and lower than the third proportional threshold. The step of performing management operations on the virtual machines on the physical machine according to the memory management policy includes: According to the third memory management strategy, query whether there are any third-type virtual machines on the physical machine whose memory reclamation switch is on and which have not yet been reclaimed, and query whether there are any second-type virtual machines on the physical machine whose frequency has been reduced; If the physical machine has the third type of virtual machine, perform a level of memory reclamation on the third type of virtual machine according to the reclamation ratio configured by the second ratio threshold; If the physical machine has the second type of virtual machine, perform a frequency recovery operation on the second type of virtual machine.

5. The method according to claim 2, characterized in that, The memory management strategy includes a fourth memory management strategy corresponding to the fourth interval range, wherein the fourth interval range is the range that is higher than the third proportional threshold and lower than the fourth proportional threshold. The step of performing management operations on the virtual machines on the physical machine according to the memory management policy includes: According to the fourth memory management strategy, query whether there are any fourth type virtual machines on the physical machine whose memory reclamation switch is turned on, have not yet been reclaimed, or have been reclaimed at the first level according to the reclamation ratio configured by the second ratio threshold; If the physical machine has the fourth type of virtual machine, the fourth type of virtual machine is subjected to second-level memory reclamation according to the reclamation ratio configured by the third ratio threshold.

6. The method according to claim 2, characterized in that, The memory management strategy includes a fifth memory management strategy corresponding to the fifth interval range, wherein the fifth interval range is a range higher than the fourth proportional threshold. The step of performing management operations on the virtual machines on the physical machine according to the memory management policy includes: According to the fifth memory management strategy, query whether there are any fourth type virtual machines on the physical machine whose memory reclamation switch is on and which have not yet been reclaimed or have been reclaimed at the first level according to the reclamation ratio configured in the second ratio threshold. If the physical machine has the fourth type of virtual machine, the fourth type of virtual machine is subjected to second-level memory reclamation according to the reclamation ratio configured by the third ratio threshold. After the second level of memory reclamation, if the node memory utilization rate is still within the fifth range, the virtual machines on the physical machine will be hot-migrated, downclocked, and shut down in sequence until the node memory utilization rate is lower than the fourth ratio threshold.

7. The method according to claim 6, characterized in that, The process of sequentially performing hot migration, frequency reduction, and shutdown on the virtual machines on the physical machine until the node's memory utilization rate falls below the fourth proportional threshold includes: Calculate the total memory usage y of virtual machines that exceed the memory amount x and support hot migration, where x is equal to the memory usage corresponding to the portion of the node memory utilization that exceeds the fourth proportional threshold; When x is less than y, hot migration is performed on virtual machines that support hot migration in order of memory usage, while the frequency of virtual machines running on the physical machine is reduced until the memory utilization of the node is lower than the fourth ratio threshold. If x is greater than y, perform hot migration on all virtual machines that support hot migration, and reduce the frequency of virtual machines running on the physical machine; after the frequency reduction is completed, if the node memory utilization is still within the fifth range, shut down some virtual machines running on the physical machine until the node memory utilization is lower than the fourth ratio threshold.

8. The method according to claim 1, characterized in that, The virtual machine has a corresponding memory protection switch, which is used to indicate whether the virtual machine is protected. The method further includes: In the event of a memory overflow, ensure the normal operation of virtual machines with the memory protection switch in the on state, and shut down virtual machines with the memory protection switch in the off state.

9. A memory balloon driving device, characterized in that, The device includes: The memory utilization reading module is used to periodically read the current node memory utilization of the physical machine. The memory management strategy determination module is used to determine the memory management strategy corresponding to the interval range to which the node memory utilization rate belongs. The memory management policy execution module is used to perform management operations on the virtual machines on the physical machine according to the memory management policy, so as to adjust and optimize the node memory utilization of the physical machine; The management operations include at least one of the following: memory management operations, frequency management operations, power on / off management operations, and hot migration management operations; The memory management strategy includes a first memory management strategy corresponding to a first interval range, wherein the first interval range is a range lower than a first proportional threshold; the memory strategy execution module is used to: According to the first memory management policy, query whether there are any first-type virtual machines on the physical machine whose memory has been reclaimed, and query whether there are any second-type virtual machines on the physical machine whose frequency has been reduced; If the physical machine has the first type of virtual machine, query the distance between the last memory release time and the current time. If the distance is greater than the duration threshold, perform memory release on the first type of virtual machine. If the physical machine has the second type of virtual machine, perform a frequency recovery operation on the second type of virtual machine.

10. A computer device, characterized in that, The computer device includes a processor and a memory, the memory storing at least one instruction, at least one program, code set, or instruction set, the at least one instruction, at least one program, code set, or instruction set being loaded and executed by the processor to implement the memory balloon driving method as described in any one of claims 1 to 8.

11. A computer-readable storage medium, characterized in that, The storage medium stores at least one instruction, at least one program, code set, or instruction set, wherein the at least one instruction, at least one program, code set, or instruction set is loaded and executed by a processor to implement the memory balloon driving method as described in any one of claims 1 to 8.