Memory calling method and device of virtual machine, storage medium and electronic equipment

By dividing the physical host memory into multiple levels and flexibly calling them, the problem of insufficient virtual machine memory utilization is solved, efficient configuration and utilization of memory resources are achieved, the stable operation of more virtual machines is supported, and the resource utilization efficiency of the virtualization platform is improved.

CN120704800APending Publication Date: 2025-09-26JINAN INSPUR DATA TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510795626.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-13
Publication Date
2025-09-26

AI Technical Summary

Technical Problem

In the prior art, the memory of the virtual machine is not fully utilized, resulting in a waste of physical host memory resources and an inability to effectively utilize them.

Method used

The physical host's memory is divided into multiple memory tiers. Memory limits for different tiers are set based on the business and memory characteristics of the virtual machine. Memory resources at each tier are flexibly allocated, including the first memory tier, swap partitions, distributed shared memory pools, and phase-change memory expansion. This prioritizes the memory needs of core processes and dynamically adjusts memory usage when needed.

Benefits of technology

It improves the utilization of physical memory, reduces idle memory, can support the stable operation of more virtual machines under limited hardware resources, and improves the resource utilization efficiency of the virtualization platform.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120704800A_ABST
    Figure CN120704800A_ABST
Patent Text Reader

Abstract

The invention discloses a memory calling method and device of a virtual machine, a storage medium and electronic equipment, relates to the technical field of virtualization and is applied to a physical host, a memory capable of being called by the physical host is divided into a plurality of memory hierarchies, and one of the memory hierarchies comprises at least one type of memory. The plurality of memory levels comprise a first memory level corresponding to a physical memory of the physical host; the method comprises the following steps: reserving memories for the virtual machine at different memory levels in a plurality of memory levels based on memory upper limits of the different memory levels in the plurality of memory levels set for the virtual machine; under the condition that the virtual machine runs, a physical memory reserved for the virtual machine by the first memory level is called for the virtual machine; and calling memories reserved for the virtual machine by other memory hierarchies for the virtual machine based on calling conditions of the other memory hierarchies except the first memory hierarchies in the plurality of memory hierarchies. The problem that the memory is not fully used in a memory calling method in the related technology is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of virtualization technology, and in particular to a memory calling method and device for a virtual machine, a storage medium, and an electronic device. Background Art

[0002] With the rapid development of cloud computing and virtualization technologies, virtual machines (VMs) have become a key tool for resource management and allocation. As the core management hub for VMs, the virtualization platform rigorously checks the host's remaining memory when a VM is started. This ensures that the VM has sufficient memory available to run, thereby ensuring stable operation.

[0003] In the related art, a physical host allocates a fixed amount of memory to a virtual machine. However, some virtual machines may have a low actual memory usage rate, which may not reach their allocated memory size. Despite this, in order to maintain the normal operation of the virtual machine, the remaining large amount of memory, even if it is idle, must be reserved and cannot be used by other virtual machines. This shows that the memory call method in the related art suffers from the problem of insufficient memory utilization. Summary of the Invention

[0004] The present application provides a memory calling method and device for a virtual machine, a storage medium, and an electronic device, so as to at least solve the problem of insufficient memory usage existing in the memory calling method in the related art.

[0005] The present application provides a memory calling method for a virtual machine, which is applied to a physical host, wherein the memory callable by the physical host is divided into multiple memory levels, one memory level of the multiple memory levels includes at least one type of memory, and the multiple memory levels include a first memory level corresponding to the physical memory of the physical host; the method comprises: based on the memory upper limits of different memory levels in the multiple memory levels set for the virtual machine, reserving memory for the virtual machine in different memory levels in the multiple memory levels; when the virtual machine is running, calling the physical memory reserved for the virtual machine by the first memory level for the virtual machine; based on the calling conditions of other memory levels in the multiple memory levels except the first memory level, calling the memory reserved for the virtual machine by the other memory levels for the virtual machine.

[0006] The present application also provides a memory calling device for a virtual machine, which is applied to a physical host, wherein the memory that can be called by the physical host is divided into multiple memory levels, one memory level of the multiple memory levels includes at least one type of memory, and the multiple memory levels include a first memory level corresponding to the physical memory of the physical host; the device includes: a reservation unit, which is used to reserve memory for the virtual machine at different memory levels in the multiple memory levels based on the memory upper limits of different memory levels in the multiple memory levels set for the virtual machine; a first calling unit, which is used to call the physical memory reserved for the virtual machine by the first memory level for the virtual machine when the virtual machine is running; and a second calling unit, which is used to call the memory reserved for the virtual machine by the other memory levels in the multiple memory levels except the first memory level based on the calling conditions of the other memory levels in the multiple memory levels.

[0007] The present application also provides an electronic device, comprising: a memory for storing a computer program; and a processor for implementing the steps of any of the above-mentioned virtual machine memory calling methods when executing the computer program.

[0008] The present application also provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned memory calling methods of the virtual machine are implemented.

[0009] The present application also provides a computer program product, including a computer program, which implements the steps of any of the above-mentioned virtual machine memory calling methods when executed by a processor.

[0010] Through this application, due to the adoption of memory hierarchical division and dynamic intelligent calling strategy, the callable memory resources on the physical host can be efficiently configured according to the specific needs of different types of memory and the specific requirements of the virtual machine, and flexible scheduling and optimal utilization of memory resources can be achieved. During the operation of the virtual machine, only part of the physical memory is used and memory of other memory levels is flexibly called, which can improve the utilization efficiency of physical memory. Therefore, it can solve the technical problem of insufficient memory utilization in the memory calling method in the related technology and achieve the technical effect of improving memory utilization. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] In order to more clearly illustrate the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0012] Figure 1This is a schematic diagram of an application scenario of a memory calling method of a virtual machine according to an embodiment of the present application;

[0013] Figure 2 This is a flow chart of an optional memory calling method of a virtual machine according to an embodiment of the present application;

[0014] Figure 3 This is a flow chart of virtual machine deployment in an optional virtual machine memory calling method according to an embodiment of the present application;

[0015] Figure 4 This is a structural block diagram of an optional memory calling device of a virtual machine according to an embodiment of the present application. DETAILED DESCRIPTION

[0016] The following will be combined with the accompanying drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0017] It should be noted that, in the description of this application, the terms "comprises," "includes," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. The terms "first," "second," etc., in this application are used to distinguish similar objects, and are not used to describe a particular order or sequence.

[0018] In order to enable those skilled in the art to better understand the present application, the present application is further described in detail below with reference to the accompanying drawings and specific implementation methods.

[0019] According to one aspect of the embodiment of the present application, a memory calling method of a virtual machine is provided. Optionally, in this embodiment, the memory calling method of the virtual machine can be applied to, but not limited to, Figure 1 The hardware environment shown includes a terminal device 102 and a server 104. The server 104 can be connected to the terminal device 102 via a network and can be used to provide services (e.g., application services, etc.) for the terminal device 102 or a client installed on the terminal device 102. A database can be set on the server 104 or independently of the server 104 to provide data storage services for the server 104.

[0020] The aforementioned network may include, but is not limited to, at least one of the following: a wired network and a wireless network. The aforementioned wired network may include, but is not limited to, at least one of the following: a wide area network, a metropolitan area network, or a local area network. The aforementioned wireless network may include, but is not limited to, at least one of the following: wireless fidelity (Wi-Fi) and Bluetooth. Terminal device 102 may be, but is not limited to, a personal computer (PC), a mobile phone, a tablet computer, etc. Server 104 may be, but is not limited to, a cloud server, a server cluster, or other server types.

[0021] The memory calling method of the virtual machine according to the embodiment of the present application can be executed by the server 104, or by the terminal device 102, or by both the server 104 and the terminal device 102. The memory calling method of the virtual machine according to the embodiment of the present application can also be executed by a client installed on the terminal device 102.

[0022] Taking the memory calling method of the virtual machine in this embodiment executed by the terminal device 102 as an example, here, the terminal device 102 can be a physical host, and the memory calling method of the virtual machine in this embodiment is applied to the physical host. The memory that can be called by the physical host is divided into multiple memory levels, and one memory level of the multiple memory levels contains at least one type of memory, and the multiple memory levels include a first memory level corresponding to the physical memory of the physical host. Here, the physical host can be enterprise-level servers, cluster servers, office computers, embedded devices, and other physical devices that can serve as the underlying hardware support in a virtualized environment. Physical memory refers to the physical memory module directly and closely connected to the host hardware and is the core and foundation of the memory architecture. Physical memory is typically composed of dynamic random access memory (DRAM), which has extremely fast read and write speeds and can respond to processor memory access requests with nanosecond response times. This makes physical memory suitable for hosting the core code of the virtual machine operating system, frequently called system function libraries, and data of critical processes running at high speeds. For example, during the initial startup of a virtual machine, the operating system kernel needs to quickly load and initialize various hardware drivers and establish a basic system operating environment. During this time, physical memory can complete data read and write operations with extremely high efficiency, ensuring that the virtual machine can start quickly and stably. During the operation of the virtual machine, application components with extremely demanding memory read and write performance, such as the transaction processing module of the database management system and the real-time rendering engine, also rely on physical memory to ensure their efficient operation, thereby maintaining the smoothness and responsiveness of the entire virtual machine system.

[0023] Figure 2FIG. 1 is a flow chart of an optional memory calling method of a virtual machine according to an embodiment of the present application, such as Figure 2 As shown, the process of the method may include the following steps:

[0024] Step S202, reserving memory for the virtual machine at different memory tiers in the multiple memory tiers based on memory upper limits of different memory tiers in the multiple memory tiers set for the virtual machine;

[0025] Step S204: when the virtual machine is running, calling the physical memory reserved for the virtual machine at the first memory layer for the virtual machine;

[0026] Step S206 : Based on the calling conditions of the other memory tiers except the first memory tier among the multiple memory tiers, calling the memory reserved for the virtual machine in the other memory tiers for the virtual machine.

[0027] The memory calling method of the virtual machine in this embodiment can be applied to the field of virtualization technology and to the scenario of deploying virtual machines on physical hosts. A virtual machine is a computing environment that simulates complete hardware system functions through software. It can run multiple independent operating system instances on the same physical host. Each instance is regarded as an independent machine. With the rapid development of cloud computing and virtualization technology, virtual machines have become a key tool for resource management and allocation. The core management center of the virtual machine is the virtualization platform. The virtualization platform undertakes a series of key tasks from virtual machine creation to startup. When the operation of starting the virtual machine is executed, the virtualization platform will rigorously detect the remaining memory of the physical host to ensure that the virtual machine has sufficient memory available during operation, thereby ensuring the stable operation of the virtual machine.

[0028] The deployment of virtual machines depends on the physical host, and virtual machines rely on the physical host's memory resources, particularly physical memory, during operation. In the related art, virtual machines' utilization of the physical host's memory resources is severely inadequate. For example, taking a common physical host configuration as an example, assume a physical host has 200GB of physical memory. According to conventional resource allocation strategies, if each virtual machine is allocated 20GB of physical memory, theoretically, this physical host can simultaneously run a maximum of 10 virtual machines. However, actual monitoring has found that in actual operation, the actual memory usage of these virtual machines is often low, perhaps only 5GB or 10GB. Despite this, to maintain the normal operation of virtual machines, the remaining large amount of physical memory, even if it is idle, must be reserved and cannot be used by other virtual machines. This is like a large warehouse divided into several fixed-sized areas. Even if most of the space in each area is idle, it cannot be borrowed by other areas, resulting in underutilization of the entire warehouse space. This situation wastes the physical host's memory resources, fails to effectively release hardware performance, and significantly reduces the resource utilization efficiency of the virtualization platform.

[0029] In order to at least partially solve the above technical problems, in this embodiment, the memory that can be called by the physical host is divided into multiple memory levels, and one memory level of the multiple memory levels contains at least one type of memory. When the virtual machine is running, the memory of each memory level is flexibly called according to the operating conditions. By constructing memory structures at different levels, the memory requirements of the virtual machine are more reasonably matched with the physical memory of the host, thereby ensuring that the potential of the physical memory of the host can be maximized, improving the overall utilization efficiency of memory resources, and thus achieving the goal of supporting the stable operation of more virtual machines with limited hardware resources.

[0030] In this embodiment, the virtual machine is set with memory limits for different memory levels in multiple memory levels. Here, the memory limits for different memory levels can be set based on the business characteristics of the virtual machine and the characteristics of different memory levels. For memory levels whose memory characteristics meet the business requirements of the virtual machine, a higher memory limit can be set accordingly. In addition, similar to related technologies, it is necessary to reserve memory for the virtual machine at different memory levels in the multiple memory levels based on the memory limits of different memory levels in the multiple memory levels set for the virtual machine. The reserved memory will never be called by other virtual machines during the operation of the virtual machine.

[0031] When the virtual machine is running, the physical memory reserved for the virtual machine at the first memory level is called for the virtual machine to carry the core code of the virtual machine operating system, frequently called system function libraries, and key process data that is running at high speed. It should be noted that since the high performance characteristics of physical memory are crucial to maintaining the stable operation of the virtual machine operating system and key processes, prioritizing this part of the memory demand can effectively avoid system failures caused by insufficient memory performance. When setting the memory upper limits of different memory levels in the multiple memory levels of the virtual machine, in order to ensure its operational stability, it is first necessary to determine the basic memory requirements of the virtual machine and use this to set the memory upper limit of the first memory level. For example, assuming that after system evaluation and testing, it is determined that the basic memory required to ensure the stable operation of the virtual machine is 5G, then a memory upper limit of 5G for the first memory level can be set for the virtual machine. When the virtual machine starts or the business load changes, resources are obtained from the physical memory first to ensure the fast operation of the core process.

[0032] In addition, during the operation of the virtual machine, based on the calling conditions of other memory levels except the first memory level in multiple memory levels, the memory reserved for the virtual machine in other memory levels can be called for the virtual machine. Flexible calling of memory at other levels can reduce the virtual machine's dependence on physical memory. For example, a virtual machine with a specification of 20G needs to occupy 20G of physical memory in related technologies. However, in this embodiment, if the basic memory required for the stable operation of the virtual machine is 5G, it only needs to occupy 5G of physical memory, and can flexibly call other types of memory to meet the business needs of the virtual machine, thereby reducing the idleness of physical memory and improving the utilization rate of physical memory, so that the physical host can allow more virtual machines to be opened under certain physical memory conditions, thereby maximizing the efficiency of physical memory use.

[0033] It should be noted that the calling conditions of the above-mentioned other memory levels can be pre-set calling conditions, and the corresponding memory can be automatically called according to the preset logic when the preset conditions are met. For example, when the physical memory usage is full or close to full, other memories can be called to alleviate the pressure of physical memory usage, or when processing a specific business, the memory suitable for processing the business can be called to process the corresponding business; the user can also give instructions to call other levels of memory during use, and call the memory and process the business according to the instructions. This is not limited in this embodiment.

[0034] Through the embodiments provided in the present application, a memory calling method of a virtual machine is applied to a physical host, and the memory callable by the physical host is divided into multiple memory levels, one memory level of the multiple memory levels contains at least one type of memory, and the multiple memory levels include a first memory level corresponding to the physical memory of the physical host; the method includes: based on the memory upper limits of different memory levels in the multiple memory levels set for the virtual machine, reserving memory for the virtual machine in different memory levels in the multiple memory levels; when the virtual machine is running, calling the physical memory reserved for the virtual machine in the first memory level for the virtual machine; based on the calling conditions of other memory levels in the multiple memory levels except the first memory level, calling the memory reserved for the virtual machine in other memory levels for the virtual machine, thereby solving the technical problem of insufficient memory utilization existing in the memory calling method in the related art and improving memory utilization.

[0035] In an exemplary embodiment, based on the calling conditions of other memory levels except the first memory level in multiple memory levels, the memory reserved for the virtual machine by other memory levels is called for the virtual machine, including: when the usage of the physical memory reserved for the virtual machine by the first memory level is greater than or equal to a specified usage threshold, based on the calling priority of the other memory levels, the data pages with an access frequency lower than the specified frequency threshold in the physical memory reserved for the virtual machine by the first memory level are moved to the memory reserved for the virtual machine by at least one memory level in the other memory levels.

[0036] In order to relieve the pressure when the physical memory reserved for the virtual machine is under great pressure, the data pages that are temporarily inactive and less frequently accessed in the physical memory reserved for the virtual machine can be moved to the memory reserved for the virtual machine in other memory layers based on the calling priority of other memory layers. In this embodiment, the pressure of the physical memory reserved for the virtual machine is determined based on the specified usage threshold. Here, the specified usage threshold can be set based on experience, and the specified usage threshold is not greater than the memory upper limit of the first memory layer set for the virtual machine. For example, the specified usage threshold can be 90% of the memory upper limit of the first memory layer set for the virtual machine, or the memory upper limit of the first memory layer set for the virtual machine minus 0.5G or 1G. This embodiment does not limit this.

[0037] In addition, the calling priorities of other memory levels can be set together when setting the memory upper limits of different memory levels in multiple memory levels for the virtual machine, and recorded in the configuration file of the virtual machine. The physical host can obtain the calling priority by reading the configuration file when running the virtual machine.

[0038] Optionally, the specified frequency threshold can be a preset fixed access frequency, or an access frequency that is automatically adjusted according to the operation status of the virtual machine. In the case where the specified frequency threshold is an access frequency that is automatically adjusted according to the operation status of the virtual machine, for example, the specified frequency threshold can be the median or average of the access frequencies of all data pages in the physical memory reserved for the virtual machine, or 80% of the above median or average, etc., to ensure that when the physical memory pressure of the data page environment needs to be moved, there are always data pages that meet the conditions and can be moved.

[0039] Through this embodiment, inactive data pages in the physical memory reserved for the virtual machine are moved to the memory reserved for the virtual machine in other memory levels based on the calling priority. This can free up space in the physical memory when the physical memory pressure is high, and continue to provide services for running critical processes and active data, effectively avoiding system crashes or abnormal termination of applications due to physical memory exhaustion.

[0040] In an exemplary embodiment, the multiple memory levels also include a second memory level corresponding to a swap partition; based on the calling conditions of other memory levels in the multiple memory levels except the first memory level, the memory reserved for the virtual machine by other memory levels is called for the virtual machine, including: when the usage of the physical memory reserved for the virtual machine by the first memory level is greater than or equal to a specified usage threshold, the data pages with an access frequency lower than the specified frequency threshold in the physical memory reserved for the virtual machine by the first memory level are moved to the swap partition reserved for the virtual machine by the second memory level.

[0041] Correspondingly, the above method also includes: when the sum of the usage of the swap partition reserved for the virtual machine at the second memory level and the usage of the physical memory reserved for the virtual machine at the first memory level is less than a specified usage threshold, moving the data pages in the swap memory reserved for the virtual machine at the second memory level to the physical memory reserved for the virtual machine at the first memory level.

[0042] A swap partition is a specific area carved out on a physical host's storage device (such as a hard drive or solid-state drive). It is virtualized for memory use and serves as an emergency reserve layer in the memory architecture. Its read and write speeds are much slower than those of physical memory, with access latency typically in milliseconds. However, in emergency situations where physical memory resources are scarce, it can buy valuable time for virtual machines and maintain basic system operations. When the available space in the physical memory reserved for virtual machines gradually decreases, and the amount of physical memory reserved for virtual machines at the first memory level is greater than or equal to a specified usage threshold, a memory swap mechanism can be initiated to swap temporarily inactive and less frequently accessed data pages (i.e., data pages with an access frequency below a specified frequency threshold) in the physical memory reserved for the virtual machine into the swap partition, freeing up physical memory space to continue serving critical processes and active data. This can effectively avoid system crashes or abnormal application terminations caused by exhaustion of the physical memory reserved for the virtual machine.

[0043] In addition, when the pressure on physical memory usage is less, that is, when the sum of the usage of the swap partition reserved for the virtual machine at the second memory level and the usage of the physical memory reserved for the virtual machine at the first memory level is less than the specified usage threshold, the data pages transferred to the Swap partition can be moved back to the physical memory reserved for the virtual machine, and the physical memory can continue to efficiently execute the remaining tasks.

[0044] For example, when a virtual machine runs multiple large applications simultaneously, causing a sudden surge in memory demand, the physical memory reserved for the virtual machine is in short supply. The Swap partition can quickly intervene and temporarily transfer some non-critical data or inactive data pages to it to ensure that the core business functions of the virtual machine are not interrupted. After the memory usage is alleviated, the data can be reloaded from the Swap partition back to the physical memory.

[0045] Through this embodiment, the Swap partition acts as a buffer when physical memory is tight, and replaces the storage of infrequently used data, thereby ensuring that the virtual machine can remain stable in a scenario where memory resources are tight, thereby improving the stability of the virtual machine operation.

[0046] In an exemplary embodiment, the multiple memory tiers also include a third memory tier corresponding to the distributed shared memory pool; based on the calling conditions of other memory tiers except the first memory tier in the multiple memory tiers, the memory reserved for the virtual machine by other memory tiers is called for the virtual machine, including: when the virtual machine processes a specified data processing task, the distributed shared memory reserved for the virtual machine by the third memory tier is called for the virtual machine, wherein the specified data processing task is a specified data processing task that calls the distributed shared memory, and the memory requirement of the specified data processing task is greater than or equal to the memory upper limit of the first memory tier set for the virtual machine.

[0047] The distributed shared memory pool is an innovative memory hierarchy that transcends the limitations of traditional single-machine memory. Leveraging high-speed network communication technology, it integrates partial memory resources from multiple physical hosts into a logically unified, large-scale memory space accessible to virtual machines. Using specialized software algorithms and distributed protocols, the distributed shared memory pool enables transparent sharing and efficient management of memory data. Virtual machines can access the large amount of memory resources they need from the distributed shared memory pool just as they access local memory, enabling efficient data storage and parallel computing. Furthermore, the distributed shared memory pool offers excellent scalability. As business volume and the number of virtual machines increase, the shared memory pool's capacity can be expanded by adding more physical host nodes to meet growing memory demands. The distributed shared memory pool also ensures memory data reliability through data redundancy and fault tolerance. Even if some nodes fail, virtual machines can continue to operate normally without being impacted.

[0048] In this embodiment, when a virtual machine runs a specified data processing task, such as a large-scale data processing task (such as MapReduce (map-reduce) calculation in big data analysis, parallel processing of gene sequencing data, etc.), its memory requirement is greater than or equal to the memory upper limit of the first memory level set for the virtual machine. At this time, the distributed shared memory reserved for the virtual machine can be called for the virtual machine to process the above-mentioned specified data processing task with larger memory requirements, thereby reducing the pressure on the physical memory reserved for the virtual machine.

[0049] Optionally, since the specified data processing task usually requires a large amount of memory, when the virtual machine calls the distributed shared memory to process the specified data processing task, the memory reserved for the virtual machine in the distributed shared memory can be temporarily expanded to ensure that the specified data processing task can obtain sufficient memory resources so that the specified data processing task can be executed smoothly.

[0050] Through this embodiment, by calling the distributed shared memory pool to handle tasks with large memory requirements, the amount of physical memory required by the virtual machines with such task requirements can be reduced, thereby increasing the number of virtual machines that can be deployed on a physical host and improving the utilization of physical memory. In addition, the distributed shared memory pool can also ensure data integrity and virtual machine business continuity through data redundancy and fault tolerance mechanisms even if some nodes fail, thereby improving the stability of the virtual machines.

[0051] In an exemplary embodiment, the multiple memory levels also include a fourth memory level corresponding to an extended memory based on a phase change memory; based on the calling conditions of other memory levels in the multiple memory levels except the first memory level, the memory reserved for the virtual machine in other memory levels is called for the virtual machine, including: when the target data generated by the virtual machine is data to be persistently stored, the extended memory based on the phase change memory reserved for the virtual machine in the fourth memory level is called for the virtual machine to store the target data in the extended memory based on the phase change memory.

[0052] Phase-change memory (PCM)-based extended memory is a type of non-volatile memory that integrates novel storage technologies. It utilizes the phase-change properties of materials to store and retrieve data, exploiting the difference in conductivity between the crystalline and amorphous states. Compared to physical memory, PCM-based extended memory offers read and write speeds approaching those of physical memory, while also being non-volatile. This means that data stored in PCM-based extended memory is not lost in the event of a power outage. These characteristics make PCM-based extended memory suitable for storing data that requires high data durability and security while also requiring high read and write performance. For example, in virtual machines used for financial transactions, every transaction record is crucial. Not only do they require fast read and write operations to meet the real-time demands of high-frequency trading, but they must also ensure that data is protected from loss or corruption under any circumstances. PCM-based extended memory can be used to store this critical transaction data, ensuring data security while responding quickly to data read and write requests during transaction processing.

[0053] In addition, for some business scenarios that require frequent data backup and recovery, such as regular backup of enterprise-level databases, the non-volatility of phase-change memory can also make the backup process more efficient and reliable, reducing the time and cost required for data recovery.

[0054] Optionally, in this embodiment, the type of data to be persistently stored can be set in advance for the virtual machine. When the virtual machine recognizes the data to be persistently stored, it automatically calls the extended memory based on phase change memory reserved for the virtual machine to store the target data; or the user can actively indicate that the current target data is the data to be persistently stored during the use of the virtual machine, and then the virtual machine calls the extended memory based on phase change memory reserved for the virtual machine to store the target data. This is not limited to this in this embodiment.

[0055] Through this embodiment, by calling the extended memory based on phase change memory with non-volatility and high read and write performance to store the data to be persistently stored, it is possible to improve memory usage efficiency while ensuring data security.

[0056] In an exemplary embodiment, before reserving memory for the virtual machine at different memory tiers among the multiple memory tiers based on the memory upper limits of different memory tiers among the multiple memory tiers set for the virtual machine, the above method also includes: determining the total memory upper limit set for the virtual machine and the memory allocation ratio of different memory tiers among the multiple memory tiers based on the configuration information of the virtual machine; determining the memory upper limits of different memory tiers among the multiple memory tiers set for the virtual machine based on the total memory upper limit set for the virtual machine and the memory allocation ratio of different memory tiers among the multiple memory tiers, wherein the amount of memory reserved for the virtual machine at one memory tier among the multiple memory tiers is less than or equal to the memory upper limit of the corresponding memory tier set for the virtual machine.

[0057] In this embodiment, the configuration information of the virtual machine indicates the total memory upper limit of the virtual machine and the memory allocation ratio of different memory levels in multiple memory levels. Among them, the total memory upper limit of the virtual machine, that is, the specification of the virtual machine, is the resource limit defined for the virtual machine in the virtualization environment. The specification of the virtual machine directly determines the amount of resources that the virtual machine can access and use; the memory allocation ratio of different memory levels in multiple memory levels is determined based on the business characteristics of the actual operation of the virtual machine.

[0058] The multi-tiered memory architecture allows for customized memory allocation based on specific business characteristics. For example, for online transactions with high real-time requirements, the physical memory allocation ratio can be increased; for backup services with high data storage requirements, the phase-change memory-based extended memory allocation ratio can be increased. This flexible configuration enables virtual machines to adapt to complex and changing business scenarios, achieving optimal resource allocation and improving business performance in scenarios ranging from high-performance computing and data storage to everyday office applications.

[0059] For example, taking a 20GB virtual machine as an example, the total memory limit of the virtual machine is 20GB. To ensure its stable operation, the basic memory requirements must be clearly defined and the memory limit of the first memory tier is set based on these basic memory requirements. Assuming that the basic memory required to ensure stable operation of the virtual machine is 5GB based on the virtual machine configuration information, the memory limit of the first memory tier can be determined to be 5GB, and the memory allocation ratio is 25% (5G ÷ 20G × 100%).

[0060] Then, the usage ratio of other memory tiers can be further reasonably divided according to the specific business type carried by the virtual machine. In this embodiment, the other memory tiers include the second memory tier, the third memory tier, and the fourth memory tier in the aforementioned embodiment as an example. If the virtual machine mainly runs a business with extremely high data security requirements but relatively low requirements for data read and write real-time performance, such as enterprise-level data backup and archiving services, in this case, the allocation ratio of the fourth memory tier corresponding to the phase-change memory-based extended memory can be appropriately increased. For example, the allocation ratio of the fourth memory tier can be 50%, with a memory limit of 10GB, for storing important data backup files; for the second memory tier corresponding to the swap partition, considering its relatively slow read and write speeds and the low real-time requirements of this business, its allocation ratio can be 15%, with a memory limit of 3GB, as an emergency reserve space when memory resources are tight; for the third memory tier corresponding to the distributed shared memory pool, if the virtual machine's business does not involve large-scale data parallel processing tasks and has a low demand for cross-host memory resources, the allocation ratio of the third memory tier can be lower, 10%, with a memory limit of 2GB, and only used to obtain additional memory resources when necessary.

[0061] Optionally, in addition to the above-mentioned first memory tier, second memory tier, third memory tier and fourth memory tier, other memory tiers such as the fifth memory tier and the sixth memory tier can also be set, which can correspond to other different memory types such as cache memory, persistent memory, etc., and their allocation ratios can be determined and called according to the above method to meet the business needs of various virtual machines.

[0062] The number of virtual hosts running on a physical host can be at least two, and the corresponding configuration information for different virtual machines can be the same, that is, the configuration information of a single virtual machine can be adapted to all virtual machines running on the physical host. Optionally, in order to improve the flexibility of virtual machine operation, different virtual machines can correspond to different configuration information. In this case, the user can configure each virtual machine separately, for example, configuring the total memory limit and the allocation ratio of memory in different memory tiers. In order to improve the convenience of virtual machine configuration, multiple configuration information can be set, each configuration information corresponds to at least one business type, and the configuration information of each virtual machine corresponds to the business running on it. When configuring a virtual machine, the user can select the business type to be run by the configured virtual machine through the configuration interface, or set the business type to be run by the configured virtual machine through configuration instructions, etc. For the physical host or configuration device, it can determine the business type to be run by the currently configured virtual machine, and based on the correspondence between the business type and the configuration information, determine the configuration information of the currently configured virtual machine from multiple configuration information.

[0063] Through this embodiment, the allocation ratio of multiple memory levels is flexibly allocated according to the business characteristics of the virtual machine, so that the virtual machine only needs a small amount of physical memory to meet the business needs. For example, assuming there is a physical host with 200G physical memory, through the above reasonable memory level planning and allocation method, theoretically 40 virtual machines with a specification of 20G can be opened. This refined memory management strategy can greatly improve the utilization efficiency of host memory resources compared to the extensive memory allocation method in the related art. The resource utilization rate is greatly improved compared to the traditional method, which can reduce hardware cost investment. In the related art, due to the inability to accurately allocate memory according to the specific needs of the virtual machine business, some virtual machines often have excess memory resources and some virtual machines have insufficient memory, resulting in serious waste of overall memory resources. However, through the multi-level memory architecture and refined virtual machine memory level division strategy in this embodiment, each virtual machine can obtain the most suitable memory resource configuration according to its own business characteristics, thereby achieving stable operation of more virtual machines under limited host memory conditions, thereby significantly improving the operating efficiency and business carrying capacity of the entire system. In addition, this flexible memory management method also enables the mixed deployment of different types of businesses in the same host environment, meeting diverse business needs and improving the flexibility of virtual machine deployment; in addition, each memory layer can work together, and each memory layer complements each other, which can jointly provide solid guarantees for the stable operation and performance improvement of virtual machines.

[0064] In an exemplary embodiment, after calling the physical memory of the first memory level for the virtual machine, the method further includes: when the sum of the memory upper limits of multiple memory levels set for the virtual machine is less than the total memory upper limit set for the virtual machine, detecting the usage of memory reserved for the virtual machine by a memory level in the multiple memory levels; when, among the multiple memory levels, there is a fully occupied level in which the usage of memory reserved for the virtual machine is equal to the memory upper limit set for the virtual machine, allocating temporary memory to the virtual machine at the fully occupied level, wherein the amount of temporary memory is less than or equal to the total memory upper limit set for the virtual machine minus the sum; after allocating temporary memory to the virtual machine at the fully occupied level, when the total amount of memory of the full occupied level used by the virtual machine is less than the memory upper limit set for the full occupancy level, moving the data of the virtual machine in the memory of the full occupied level to the memory reserved for the virtual machine at the full occupied level, and reclaiming it as temporary memory.

[0065] In order to flexibly respond to sudden memory demands and improve the stability of virtual machine operation, the sum of the memory upper limits of multiple memory tiers set for the virtual machine can be less than the total memory upper limit of the virtual machine. For example, for a virtual machine with a specification of 20G, the memory upper limits of its first to fourth memory tiers are 5G, 6G, 3G and 2G respectively. The sum of the memory upper limits of all memory tiers is 16G, which is less than the total memory upper limit of 20G of the virtual machine. The remaining 4G of memory can be used as flexible memory, which can be flexibly adjusted and allocated to each memory tier according to the actual business operation situation to cope with sudden memory demands in the business process.

[0066] In this embodiment, the usage of memory reserved for virtual machines by memory layers in multiple memory layers can be detected in real time, and when it is detected that the memory reserved for virtual machines by a memory layer has reached its memory upper limit, the memory layer is treated as a fully occupied layer, and a temporary memory upper limit is allocated to the fully occupied layer from the above-mentioned unallocated flexible memory, temporarily increasing the memory upper limit of the fully occupied layer. After the memory upper limit of the fully occupied layer is increased, temporary memory can be allocated to the virtual machine to ensure stable operation of the business. It should be noted that the amount of memory allocated of the temporary memory is not greater than the amount of memory of the above-mentioned unallocated flexible memory, that is, the amount of memory of the temporary memory is less than or equal to the total memory upper limit set for the virtual machine minus the sum.

[0067] Furthermore, after allocating temporary memory to a virtual machine at the full occupancy level, if the usage of the memory reserved for the virtual machine at the full occupancy level decreases, and the total amount of full occupancy level memory used by the virtual machine is less than the memory limit set for the full occupancy level for the virtual machine, the virtual machine's data in the full occupancy level memory will be moved to the memory reserved for the virtual machine at the full occupancy level and reclaimed as temporary memory. It should be noted that the memory reserved for the virtual machine at the full occupancy level mentioned above, up to the memory initially reserved for the virtual machine at the full occupancy level, does not include any temporary memory allocated subsequently.

[0068] Through this embodiment, by dynamically allocating temporary memory, the pressure can be temporarily relieved when the virtual machine memory usage is high, ensuring the stability and security of the system. In addition, by timely recycling temporary memory, idleness and waste of resources can be avoided, ensuring that limited resources can be fully utilized.

[0069] The following describes the memory call method for a virtual machine in an embodiment of the present application with reference to an optional example. In this optional example, the multiple memory tiers of the physical host include a first memory tier corresponding to physical memory, a second memory tier corresponding to a swap partition, a third memory tier corresponding to a distributed shared memory pool, and a fourth memory tier corresponding to extended memory based on phase-change memory.

[0070] Figure 3 This is a flow chart of virtual machine deployment in the memory calling method of the virtual machine in this optional example, such as Figure 3 As shown, the virtual machine deployment process may include the following steps:

[0071] Step S302, virtual machine memory settings: Based on the virtual machine configuration file, determine the total memory limit of the virtual machine, the call priority of each memory tier and the allocation ratio of each memory tier, and determine the memory limit of the first memory tier, the memory limit of the second memory tier, the memory limit of the third memory tier and the memory limit of the fourth memory tier.

[0072] Step S304, physical host reserves memory: the physical host reserves corresponding memory amounts for the virtual machine in physical memory, swap partition, distributed shared memory pool, and phase change memory-based extended memory according to the memory upper limit of each memory layer.

[0073] After the deployment process is complete, the virtual machine can run on the physical host. While the virtual machine is running, a dynamic memory scheduling mechanism intelligently and efficiently manages resources based on the call priority and allocation ratio of each memory layer. The system monitors memory usage in real time. When the virtual machine starts or the business load changes, it prioritizes resources from high-priority physical memory to ensure the rapid operation of core processes. If the physical memory reserved for the virtual machine approaches the threshold, the swap partition is automatically activated based on a preset percentage to replenish the reserved physical memory, reducing the virtual machine's reserved physical memory usage. For large-scale data processing, the distributed shared memory pool can be proportionally intervened. For critical data that requires persistent storage, extended memory based on phase-change memory is allocated on demand. Throughout this process, the system continuously evaluates the memory usage efficiency of each layer and dynamically adjusts resource allocation to ensure that virtual machines can accurately schedule and efficiently utilize memory resources in different business scenarios.

[0074] This optional example allows for multiple memory tier combinations to be configured at the physical host level, with support for expansion. This multi-tier memory approach can be used by virtual machines for single or multiple purposes at runtime. At the virtual machine level, the allocation ratio of each memory tier can be configured based on actual business needs, enabling flexible adaptation and efficient resource utilization. During virtual machine operation, the memory corresponding to each memory tier can be dynamically scheduled based on the call priority, allocation ratio, and actual business processing of each memory tier. Multi-tier memory can fully utilize different types of memory resources and achieve performance optimization through a reasonable division of labor. Physical memory ensures fast read and write speeds for high-frequency data; swap partitions provide rapid response to surges in demand; and distributed shared memory pools overcome the limitations of single machines to meet large-scale computing needs. For example, in big data analysis scenarios, virtual machines can leverage distributed shared memory pools to access massive amounts of memory resources for parallel computing. Combined with the high-speed processing of physical memory, this significantly reduces data processing time. Phase-change memory-based extended memory provides security for data requiring persistent storage. This multi-tier memory architecture significantly improves performance compared to traditional single-tier memory architectures.

[0075] It should be noted that for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that this application is not limited by the order of the actions described, because according to this application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by this application.

[0076] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus the necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (for example, a read-only memory (ROM) / random access memory (RAM), a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0077] According to another aspect of the embodiments of the present application, a memory calling device for a virtual machine is also provided, which can be used to implement the memory calling method of the virtual machine provided in the above embodiments. The details that have been explained will not be repeated here. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementation by hardware, or a combination of software and hardware, is also possible and contemplated.

[0078] Figure 4 This is a structural block diagram of an optional memory calling device of a virtual machine according to an embodiment of the present application, such as Figure 4 As shown in , the memory calling device of the virtual machine includes:

[0079] The reserving unit 402 is configured to reserve memory for the virtual machine at different memory tiers among the multiple memory tiers based on memory upper limits of different memory tiers among the multiple memory tiers set for the virtual machine.

[0080] The first calling unit 404 is configured to call, for the virtual machine, the physical memory reserved for the virtual machine at the first memory level when the virtual machine is running.

[0081] The second calling unit 406 is configured to call, for the virtual machine, memory reserved for the virtual machine in other memory tiers based on calling conditions of other memory tiers except the first memory tier among the multiple memory tiers.

[0082] It should be noted that the reservation unit 402 in this embodiment can be used to execute the above step S202, the first calling unit 404 in this embodiment can be used to execute the above step S204, and the second calling unit 406 in this embodiment can be used to execute the above step S206.

[0083] Through the embodiments provided in the present application, a memory calling method of a virtual machine is applied to a physical host, and the memory callable by the physical host is divided into multiple memory levels, one memory level of the multiple memory levels contains at least one type of memory, and the multiple memory levels include a first memory level corresponding to the physical memory of the physical host; the method includes: based on the memory upper limits of different memory levels in the multiple memory levels set for the virtual machine, reserving memory for the virtual machine in different memory levels in the multiple memory levels; when the virtual machine is running, calling the physical memory reserved for the virtual machine in the first memory level for the virtual machine; based on the calling conditions of other memory levels in the multiple memory levels except the first memory level, calling the memory reserved for the virtual machine in other memory levels for the virtual machine, thereby solving the technical problem of insufficient memory utilization existing in the memory calling method in the related art and improving memory utilization.

[0084] In an exemplary embodiment, the second calling unit includes: a first moving module, which is used to move data pages with an access frequency lower than a specified frequency threshold in the physical memory reserved for the virtual machine in the first memory layer to the memory reserved for the virtual machine in at least one memory layer in the other memory layers based on the calling priority of other memory layers when the usage of the physical memory reserved for the virtual machine in the first memory layer is greater than or equal to a specified usage threshold.

[0085] In an exemplary embodiment, the multiple memory levels also include a second memory level corresponding to the swap partition; the second calling unit also includes: a second moving module, which is used to move data pages in the physical memory reserved for the virtual machine at the first memory level, whose access frequency is lower than the specified frequency threshold, to the swap partition reserved for the virtual machine at the second memory level, when the usage of the physical memory reserved for the virtual machine at the first memory level is greater than or equal to the specified usage threshold; the above-mentioned device also includes: a first moving unit, which is used to move data pages in the swap memory reserved for the virtual machine at the second memory level to the physical memory reserved for the virtual machine at the first memory level, when the sum of the usage of the swap partition reserved for the virtual machine at the second memory level and the usage of the physical memory reserved for the virtual machine at the first memory level is less than the specified usage threshold.

[0086] In an exemplary embodiment, the multiple memory levels also include a third memory level corresponding to the distributed shared memory pool; the second calling unit also includes: a first calling module, which is used to call the distributed shared memory reserved for the virtual machine by the third memory level when the virtual machine processes a specified data processing task, wherein the specified data processing task is a specified data processing task that calls the distributed shared memory, and the memory requirement of the specified data processing task is greater than or equal to the memory upper limit of the first memory level set for the virtual machine.

[0087] In an exemplary embodiment, the multiple memory levels also include a fourth memory level corresponding to an extended memory based on a phase change memory; the second calling unit also includes: when the virtual machine generates target data as data to be persistently stored, the second calling module calls the fourth memory level for the virtual machine to store the target data in the extended memory based on the phase change memory.

[0088] In an exemplary embodiment, the above-mentioned device also includes: a first determination unit for determining, based on the configuration information of the virtual machine, the total memory upper limit set for the virtual machine and the memory allocation ratio of different memory levels in the multiple memory levels before reserving memory for the virtual machine at different memory levels in the multiple memory levels based on the memory upper limits of different memory levels in the multiple memory levels set for the virtual machine; a second determination unit for determining, based on the total memory upper limit set for the virtual machine and the memory allocation ratio of different memory levels in the multiple memory levels, the memory upper limits of different memory levels in the multiple memory levels set for the virtual machine, wherein the amount of memory reserved for the virtual machine by one memory level in the multiple memory levels is less than or equal to the memory upper limit of the corresponding memory level set for the virtual machine.

[0089] In an exemplary embodiment, the above-mentioned device also includes: a detection unit for detecting the usage of memory reserved for the virtual machine by a memory tier in multiple memory tiers after calling the physical memory of the first memory tier for the virtual machine, when the sum of the memory upper limits of multiple memory tiers set for the virtual machine is less than the total memory upper limit set for the virtual machine; an allocation unit for allocating temporary memory to the virtual machine at the full occupancy tier when there is a full occupancy tier in the multiple memory tiers where the usage of memory reserved for the virtual machine is equal to the memory upper limit set for the virtual machine, wherein the memory amount of the temporary memory is less than or equal to the total memory upper limit set for the virtual machine minus the sum; a second moving unit for moving the data of the virtual machine in the memory of the full occupancy tier to the memory reserved for the virtual machine at the full occupancy tier and reclaiming it as temporary memory after allocating temporary memory to the virtual machine at the full occupancy tier when the total amount of memory of the full occupancy tier used by the virtual machine is less than the memory upper limit set for the full occupancy tier.

[0090] For the description of the features in the embodiment corresponding to the memory calling device of the virtual machine, please refer to the relevant description of the embodiment corresponding to the memory calling method of the virtual machine, which will not be repeated here.

[0091] An embodiment of the present application further provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any of the above-mentioned virtual machine memory calling method embodiments.

[0092] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above-mentioned virtual machine memory calling method embodiments when running.

[0093] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, a ROM, a RAM, a mobile hard disk, a magnetic disk, or an optical disk.

[0094] An embodiment of the present application further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps of any of the above-mentioned virtual machine memory calling method embodiments are implemented.

[0095] An embodiment of the present application also provides another computer program product, including a non-volatile computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the steps in any of the above-mentioned virtual machine memory calling method embodiments.

[0096] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the components and steps of each example according to their functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0097] The above is a detailed introduction to the memory calling method and device, storage medium and electronic device of a virtual machine provided by this application. This article uses specific examples to illustrate the principles and implementation methods of this application. The description of the above embodiments is only used to help understand the method and core ideas of this application. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of this application, several improvements and modifications can be made to this application, and these improvements and modifications also fall within the scope of protection of the claims of this application.

Claims

1. A memory calling method for a virtual machine, characterized in that: Applied to a physical host, memory callable by the physical host is divided into a plurality of memory tiers, a memory tier of the plurality of memory tiers includes at least one type of memory, and the plurality of memory tiers includes a first memory tier corresponding to the physical memory of the physical host; The method comprises: reserving memory for the virtual machine at different memory tiers in the multiple memory tiers based on memory caps of different memory tiers in the multiple memory tiers set for the virtual machine; When the virtual machine is running, calling the physical memory reserved for the virtual machine by the first memory layer for the virtual machine; Based on the calling conditions of other memory tiers among the multiple memory tiers except the first memory tier, the memory reserved for the virtual machine by the other memory tiers is called for the virtual machine.

2. The method according to claim 1, characterized in that The calling, for the virtual machine, of the memory reserved for the virtual machine by the other memory tiers based on the calling conditions of the other memory tiers except the first memory tier in the multiple memory tiers includes: When the usage of the physical memory reserved for the virtual machine by the first memory tier is greater than or equal to a specified usage threshold, based on the calling priority of the other memory tiers, data pages with an access frequency lower than the specified frequency threshold in the physical memory reserved for the virtual machine by the first memory tier are moved to the memory reserved for the virtual machine by at least one memory tier in the other memory tiers.

3. The method according to claim 1, characterized in that The plurality of memory tiers further includes a second memory tier corresponding to the swap partition; The calling of the memory reserved for the virtual machine by the other memory tiers based on the calling conditions of the other memory tiers except the first memory tier in the multiple memory tiers includes: when the usage of the physical memory reserved for the virtual machine by the first memory tier is greater than or equal to the specified usage threshold, moving data pages with an access frequency lower than the specified frequency threshold in the physical memory reserved for the virtual machine by the first memory tier to the swap partition reserved for the virtual machine by the second memory tier; The method also includes: when the sum of the usage of the swap partition reserved for the virtual machine by the second memory level and the usage of the physical memory reserved for the virtual machine by the first memory level is less than the specified usage threshold, moving the data pages in the swap memory reserved for the virtual machine by the second memory level to the physical memory reserved for the virtual machine by the first memory level.

4. The method according to claim 1, wherein The multiple memory tiers further include a third memory tier corresponding to the distributed shared memory pool; The calling, for the virtual machine, of the memory reserved for the virtual machine by the other memory tiers based on the calling conditions of the other memory tiers except the first memory tier in the multiple memory tiers includes: When the virtual machine processes a specified data processing task, the distributed shared memory reserved for the virtual machine at the third memory level is called for the virtual machine, wherein the specified data processing task is a specified data processing task that calls the distributed shared memory, and the memory requirement of the specified data processing task is greater than or equal to the memory upper limit of the first memory level set for the virtual machine.

5. The method according to claim 1, wherein The plurality of memory levels further includes a fourth memory level corresponding to an extended memory based on a phase change memory; The calling, for the virtual machine, of the memory reserved for the virtual machine by the other memory tiers based on the calling conditions of the other memory tiers except the first memory tier in the multiple memory tiers includes: In a case where the target data generated by the virtual machine is data to be persistently stored, the phase change memory-based extended memory reserved for the virtual machine by the fourth memory layer is called for the virtual machine to store the target data in the phase change memory-based extended memory.

6. The method according to any one of claims 1 to 5, characterized in that Before reserving memory for the virtual machine at different memory tiers among the multiple memory tiers based on the memory caps of different memory tiers among the multiple memory tiers set for the virtual machine, the method further includes: Determining, based on the configuration information of the virtual machine, a total memory upper limit set for the virtual machine and memory allocation ratios of different memory levels in the multiple memory levels; Based on the total memory upper limit set for the virtual machine and the memory allocation ratio of different memory levels in the multiple memory levels, the memory upper limits of different memory levels in the multiple memory levels set for the virtual machine are determined, wherein the amount of memory reserved for the virtual machine by one memory level in the multiple memory levels is less than or equal to the memory upper limit of the corresponding memory level set for the virtual machine.

7. The method according to claim 6, characterized in that After calling the physical memory of the first memory level for the virtual machine, the method further includes: If a sum of the memory upper limits of the multiple memory tiers set for the virtual machine is less than the total memory upper limit set for the virtual machine, detecting a usage of memory reserved for the virtual machine by a memory tier in the multiple memory tiers; If, among the multiple memory tiers, there is a fully occupied tier where the amount of memory reserved for the virtual machine is equal to the memory upper limit set for the virtual machine, allocating temporary memory to the virtual machine at the fully occupied tier, wherein the amount of the temporary memory is less than or equal to the total memory upper limit set for the virtual machine minus the sum; After the full occupancy level allocates the temporary memory to the virtual machine, if the total amount of the memory of the full occupancy level used by the virtual machine is less than the memory upper limit of the full occupancy level set for the virtual machine, the data of the virtual machine in the memory of the full occupancy level is moved to the memory reserved for the virtual machine at the full occupancy level and reclaimed as the temporary memory.

8. A memory calling device for a virtual machine, characterized in that: Applied to a physical host, memory callable by the physical host is divided into a plurality of memory tiers, a memory tier of the plurality of memory tiers includes at least one type of memory, and the plurality of memory tiers includes a first memory tier corresponding to the physical memory of the physical host; The device comprises: a reserving unit configured to reserve memory for the virtual machine at different memory tiers among the multiple memory tiers based on memory caps of the different memory tiers among the multiple memory tiers set for the virtual machine; a first calling unit, configured to call, for the virtual machine, the physical memory reserved for the virtual machine by the first memory layer when the virtual machine is running; The second calling unit is configured to call, for the virtual machine, the memory reserved for the virtual machine by the other memory layers except the first memory layer in the multiple memory layers based on the calling conditions of the other memory layers.

9. An electronic device, characterized in that: include: memory for storing computer programs; A processor, configured to implement the steps of the memory calling method of a virtual machine according to any one of claims 1 to 7 when executing the computer program.

10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the steps of the memory calling method of a virtual machine according to any one of claims 1 to 7.

Citation Information

Cited By

  • Memory management method, device, system, apparatus and storage medium

    CN122387587A