Virtual machine memory adjustment method and device, computer equipment, storage medium and computer program product

By acquiring the hardware execution behavior parameters of the virtual machine, predicting the degree of performance degradation, and adjusting the ratio of local memory and remote CXL memory of the virtual machine, the problem of virtual machine performance instability caused by reliance on human experience in the existing technology is solved, and the operating efficiency and stability of the virtual machine are improved.

CN122019060APending Publication Date: 2026-05-12CHINA MOBILE (SUZHOU) SOFTWARE TECH CO LTD +1
View PDF 6 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
CHINA MOBILE (SUZHOU) SOFTWARE TECH CO LTD
Filing Date
2026-04-13
Publication Date
2026-05-12

AI Technical Summary

Technical Problem

Existing technologies rely too heavily on manual experience when adjusting the local memory and CXL memory of virtual machines, which cannot adapt to diverse user task loads, resulting in unstable virtual machine performance. Furthermore, the CXL memory ratio specified based on historical data may affect initial running efficiency.

Method used

By acquiring relevant metrics of virtual machine hardware execution behavior, the degree of performance degradation can be predicted, the worst-performing and best-performing virtual machines can be identified, data exchange between local memory and remote CXL memory can be performed, and the memory ratio can be adjusted to increase the local memory ratio of the poor-performing virtual machine and decrease the remote CXL memory ratio.

Benefits of technology

It enables dynamic adjustment of the ratio of local memory to remote CXL memory based on virtual machine performance, improving the stability and efficiency of virtual machine performance and adapting to diverse user task loads.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122019060A_ABST
    Figure CN122019060A_ABST
Patent Text Reader

Abstract

The invention provides a virtual machine memory adjustment method and device, computer equipment, a storage medium and a computer program product. The method comprises the following steps: acquiring first data related to a first virtual machine; predicting second data based on the first data, wherein the second data represents the performance reduction degree of the first virtual machine; determining a second virtual machine and a third virtual machine from a plurality of virtual machines according to the second data; the second virtual machine comprises M virtual machines with the maximum performance reduction degree, and the third virtual machine comprises N virtual machines with the minimum performance reduction degree; and performing exchange storage on first memory data corresponding to a first page of the second virtual machine in the remote CXL memory and second memory data corresponding to a second page of the third virtual machine in the local memory, so as to improve the proportion of local memory data in target memory data corresponding to the second virtual machine, and / or improve the proportion of the local memory data in the target memory data corresponding to the third virtual machine. And reducing the proportion of the CXL memory data in the target memory data. According to the invention, the performance of the virtual machine can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to computer technology, and more particularly to a virtual machine memory adjustment method, apparatus, computer equipment, storage medium, and computer program product. Background Technology

[0002] To address the explosive growth of data, data centers have introduced heterogeneous computing architectures to improve processing efficiency. They employ Compute Express Link (CXL) technology, characterized by low latency, high bandwidth, and cross-device compatibility, to build remote CXL memory pools. This pools integrate the local memory resources of the data center host machines, expanding the memory capacity of virtual machines (VMs) hosted on the host while providing performance support for various computing tasks. VMs can then execute different deployed workloads using a hybrid mode of local memory and remotely constructed CXL memory. Therefore, the ratio of local memory to remote CXL memory within a VM is crucial for VM performance. Excessive local memory leads to resource waste, while insufficient local memory degrades VM performance. Thus, flexibly adjusting the local memory ratio is of great significance for VM performance in heterogeneous scenarios. Summary of the Invention

[0003] This invention provides a method, apparatus, computer device, storage medium, and computer program product for adjusting virtual machine memory, which can improve virtual machine performance.

[0004] The technical solution of this invention is implemented as follows: This invention provides a method for adjusting virtual machine memory, the method comprising: Acquire first data related to the first virtual machine, wherein the first virtual machine is any one of multiple virtual machines hosted by the host, and the first data includes one or more indicator parameters related to hardware execution behavior; Based on the first data, predict the second data of the first virtual machine, where the second data represents the degree of performance degradation of the first virtual machine; Based on the second data of each first virtual machine, a second virtual machine and a third virtual machine are determined from the plurality of virtual machines; wherein, the second virtual machine includes the M virtual machines with the greatest performance degradation, and the third virtual machine includes the N virtual machines with the smallest performance degradation, where M is an integer greater than or equal to 1 and N is an integer greater than or equal to 1; The first memory data corresponding to the first page in the remote Open Rapid Interconnect (CXL) memory of the second virtual machine is swapped with the second memory data corresponding to the second page in the local memory of the third virtual machine. This is to increase the proportion of local memory data in the target memory data corresponding to the second virtual machine, and / or decrease the proportion of CXL memory data in the target memory data. The first page is a portion of the pages corresponding to the remote CXL memory, and the second page is a portion of the pages corresponding to the local memory.

[0005] In the above scheme, the exchange and storage of the first memory data corresponding to the first page in the remote Open Rapid Interconnect (CXL) memory of the second virtual machine and the second memory data corresponding to the second page in the local memory of the third virtual machine includes: determining first information related to the first page and determining second information related to the second page; obtaining the first memory data from the remote CXL memory based on the first information and writing the first memory data into the local memory, and obtaining the second memory data from the local memory based on the second information and writing the second memory data into the remote CXL memory.

[0006] In the above scheme, the first address range corresponding to the first page; the second information includes: the second address range corresponding to the second page; the step of obtaining the first memory data from the remote CXL memory based on the first information and writing the first memory data into the local memory, and obtaining the second memory data from the local memory based on the second information and writing the second memory data into the remote CXL memory includes: establishing a mapping relationship between the first information and the second information; obtaining the first memory data from the remote CXL memory based on the first information, writing the first memory data into the local memory corresponding to the second address range according to the mapping relationship, and obtaining the second memory data from the local memory based on the second information, writing the second memory data into the remote CXL memory corresponding to the first address range according to the mapping relationship; replacing the second address range corresponding to the local memory in the third virtual machine with the first address range, and replacing the first address range corresponding to the remote CXL memory in the second virtual machine with the second address range.

[0007] In the above scheme, obtaining the first memory data from the remote CXL memory based on the first information, writing the first memory data into the local memory corresponding to the second address range according to the mapping relationship, and obtaining the second memory data from the local memory based on the second information and writing the second memory data into the remote CXL memory corresponding to the first address range according to the mapping relationship includes: obtaining the second memory data from the local memory based on the second information and caching the second memory data; obtaining the first memory data from the remote CXL memory based on the first information, writing the first memory data into the local memory corresponding to the second address range according to the mapping relationship to overwrite the second memory data of the third virtual machine in the local memory; and writing the second memory data into the remote CXL memory corresponding to the first address range according to the mapping relationship to overwrite the first memory data in the remote CXL memory corresponding to the second virtual machine.

[0008] In the above scheme, predicting the second data of the first virtual machine based on the first data includes: processing the first data using a first model to obtain the second data corresponding to the first virtual machine; wherein the first model is obtained by training in advance using training data.

[0009] In the above scheme, the method further includes: obtaining training data, the training data including first training data and second training data associated with the first training data, the first training data representing the working performance of the virtual machine, and the second training data including one or more indicator parameters related to hardware execution behavior; wherein different virtual machines deploy the same image and configure the same hardware resources; training a first model to be trained based on the first training data and the second training data to adjust the model parameters of the first model until a first model that has been trained is obtained.

[0010] In the above scheme, obtaining training data includes: using a fourth virtual machine to execute one or more first tasks multiple times to obtain the completion time of the fourth virtual machine executing the first task each time, wherein the fourth virtual machine is any one of multiple virtual machines; determining the performance description parameters of the fourth virtual machine based on the first completion time, the second completion time, and the number of first tasks; wherein the first completion time represents the duration of the fourth virtual machine currently completing the first task, and the second completion time represents the duration of the fourth virtual machine last completing the first task; and using the performance description parameters that indicate performance degradation as the first training data corresponding to the fourth virtual machine.

[0011] This invention provides a computer device, the computer device comprising: Memory is used to store executable instructions or computer programs. The processor, when executing computer-executable instructions or computer programs stored in the memory, implements the virtual machine memory adjustment method provided in this embodiment of the invention.

[0012] This invention provides a computer-readable storage medium storing a computer program or computer-executable instructions, which, when executed by a processor, implements the virtual machine memory adjustment method provided in this invention.

[0013] This invention provides a computer program product, including a computer program or computer executable instructions. When the computer program or computer executable instructions are executed by a processor, they implement the virtual machine memory adjustment method provided in this invention.

[0014] This invention provides a method, apparatus, computer device, storage medium, and computer program product for adjusting virtual machine memory. Firstly, based on various indicator parameters in first data related to the virtual machine, the performance degradation degree of the virtual machine is predicted and evaluated, so that the corresponding virtual machine performance is reflected through various hardware behavior parameters. Secondly, based on the predicted performance degradation degree of each virtual machine, virtual machines with poor performance and those with good performance are identified, and the ratio of local memory to remote CXL memory in the virtual machine under mixed memory mode is indirectly obtained based on the performance degradation degree of the virtual machines. Thirdly, memory swapping is performed using local memory data from the better-performing virtual machines to exchange remote CXL memory data from the poor-performing virtual machines, thereby increasing the proportion of local memory data and decreasing the proportion of remote CXL memory data in the poor-performing virtual machines. This allows for flexible adjustment of the local memory and remote CXL memory ratio of the poor-performing virtual machines based on their performance, significantly improving virtual machine performance. Attached Figure Description

[0015] Figure 1 This is a flowchart illustrating the virtual machine memory adjustment method according to an embodiment of the present invention. Figure 1 ; Figure 2 This is a schematic diagram of the virtual memory access process according to an embodiment of the present invention; Figure 3 This is a flowchart illustrating the virtual machine memory adjustment method according to an embodiment of the present invention. Figure 2 ; Figure 4 This is a flowchart illustrating the virtual machine memory adjustment method according to an embodiment of the present invention. Figure 3 ; Figure 5 This is a flowchart illustrating an example of a virtual machine memory adjustment method according to an embodiment of the present invention; Figure 6This is a schematic diagram of a virtual machine memory adjustment system structure provided in an embodiment of the present invention; Figure 7 This is a schematic diagram of the composition structure of the virtual machine memory adjustment device provided in an embodiment of the present invention; Figure 8 This is a schematic diagram of the hardware composition structure of a computer device provided in an embodiment of the present invention. Detailed Implementation

[0016] To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings. The described embodiments should not be regarded as limitations on this application. All other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0017] In the following description, references are made to “some embodiments,” which describe a subset of all possible embodiments. However, it is understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.

[0018] In the following description, the terms "first, second, third" are used merely to distinguish similar objects and do not represent a specific ordering of objects. It is understood that "first, second, third" may be interchanged in a specific order or sequence where permitted, so that the embodiments of the invention described herein can be implemented in an order other than that illustrated or described herein.

[0019] In this embodiment of the invention, the terms "module" or "unit" refer to a computer program or part of a computer program that has a predetermined function and works with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.

[0020] Unless otherwise defined, all technical and scientific terms used in the embodiments of this invention have the same meaning as commonly understood by one of ordinary skill in the art. The terminology used in the embodiments of this invention is for descriptive purposes only and is not intended to limit the scope of this application.

[0021] In the embodiments of this invention, the collection and processing of related data should be strictly in accordance with the requirements of relevant laws and regulations, obtaining the informed consent or separate consent of the personal information subject, and carrying out subsequent data use and processing within the scope of laws and regulations and the authorization of the personal information subject.

[0022] Before providing a detailed description of the embodiments of the present invention, a brief description of the existing related technologies will be given first.

[0023] Currently, the common method for adjusting the local memory and CXL memory of virtual machines is to predict the memory requirements of newly created virtual machines based on the historical usage data of the virtual machines. The historical usage data used for prediction mainly includes the specifications of the central processing unit (CPU), the memory usage data of each virtual machine, and the proportion of local memory and CXL memory in the total memory of each virtual machine. The memory performance and running performance information of the newly created virtual machines are monitored using the virtual machine monitor, and the local memory and CXL memory of the virtual machine are adjusted through a variety of preset trigger conditions.

[0024] The preset triggering conditions can include: excessively high virtual machine performance and high local memory usage; excessively high virtual machine performance and high CXL memory usage; excessively low virtual machine performance and low local memory usage; and excessively low virtual machine performance and low CXL memory usage. Under different triggering conditions, different adjustment schemes for the virtual machine's local memory and CXL memory are triggered to ensure that the virtual machine runs within a reasonable performance range.

[0025] However, predicting the specifications of newly created virtual machines based on their historical usage records relies too heavily on human experience and is not suitable for diverse user workloads. Furthermore, if the CXL memory directly specified based on historical data constitutes too high a percentage of the total memory, it may affect the initial operating efficiency of the virtual machine, thereby indirectly impacting the user experience.

[0026] Furthermore, since most virtual machines currently employ semi-virtualization, their performance can only be visually assessed through hardware performance metrics. Therefore, a monitor-based approach cannot provide a complete picture of the virtual machine's operation, thus limiting its effectiveness. Additionally, the monitor-based method of dynamically adjusting the virtual machine's local and CXL memory via hot-swapping results in coarse-grained memory adjustments, which can lead to significant performance fluctuations and reduced stability.

[0027] Based on this, this invention proposes a method for adjusting virtual machine memory. Figure 1 This is a flowchart illustrating the virtual machine memory adjustment method according to an embodiment of the present invention. Figure 1 ;like Figure 1 As shown, the method includes: Step 101: Obtain first data related to the first virtual machine, where the first virtual machine is any one of the multiple virtual machines hosted by the host, and the first data includes one or more indicator parameters related to hardware execution behavior; Step 102: Predict second data for the first virtual machine based on the first data, where the second data represents the degree of performance degradation of the first virtual machine; Step 103: Based on the second data of each first virtual machine, determine the second virtual machine and the third virtual machine from the plurality of virtual machines; wherein, the second virtual machine includes the M virtual machines with the greatest performance degradation, and the third virtual machine includes the N virtual machines with the smallest performance degradation, where M is an integer greater than or equal to 1 and N is an integer greater than or equal to 1; Step 104: Exchange the first memory data corresponding to the first page in the remote Open Rapid Interconnect (CXL) memory of the second virtual machine with the second memory data corresponding to the second page in the local memory of the third virtual machine, so as to increase the proportion of local memory data in the target memory data corresponding to the second virtual machine and / or decrease the proportion of CXL memory data in the target memory data; wherein, the first page is a part of the page corresponding to the remote CXL memory, and the second page is a part of the page corresponding to the local memory.

[0028] In this embodiment, the first data corresponding to the first virtual machine is obtained, and one or more indicator parameters related to hardware execution behavior are determined to be included in the first data.

[0029] The first virtual machine refers to any one of the multiple virtual machines hosted on the same host (i.e., physical machine). A virtual machine is also called a virtual computer (VM). It is a computer system with complete hardware functions simulated by software, running in a completely isolated environment. Multiple independent operating system environments can be created on a single physical machine, and one or more workloads can be executed by using the processor (such as CPU core) allocated to it by the physical machine.

[0030] The first data is used to represent the operating performance of the first virtual machine, including one or more metrics related to hardware execution behavior, such as the average number of CPU cycles required per instruction executed by a CPU core (CPI, Cycles Per Instruction), the number of L3 cache misses per thousand instructions of workload (MPKI, Misses Per KiloInstructions), and the L2 / L3 cache miss latency. These parameters can be obtained directly through the underlying performance counters deployed on the virtual machine.

[0031] In this embodiment, the performance degradation of the first virtual machine is predicted and evaluated based on the various index parameters in the obtained first data, and the second data corresponding to the first virtual machine is obtained.

[0032] The second data is a parameter used to represent the future performance degradation of the first virtual machine. That is, the value of the second data reflects the corresponding performance degradation of the first virtual machine during the future operation of the load.

[0033] It's important to note that virtual machines (VMs) handle workloads of varying priorities. From software control to hardware computation, the entire computing stack must always prioritize high-priority workloads. For example, real-time workloads can use local memory, while offline workloads can use a mix of local and remote CXL memory. Throughout the use of either local or remote CXL memory, high-priority workloads must be given priority. Different workloads or processes within a VM will continuously allocate and release physical memory during operation. However, because VM memory operates on a hybrid model of local and remote CXL memory, it cannot perceive the source of physical memory. Therefore, the proportion of local memory within VM memory will dynamically adjust, impacting VM performance.

[0034] Example, Figure 2 This is a schematic diagram of the virtual memory access process according to an embodiment of the present invention; as shown below. Figure 2 As shown, the virtual machine process performs memory addressing through physical addresses, prioritizing the addressing of the corresponding storage unit in the virtual machine's local memory. If feedback is received from the local memory, it indicates that the local memory addressing is successful, and data can be read or written in the local memory. If no feedback is received from the local memory, it indicates that the local memory addressing has failed, and the process will be transferred to the remote CXL memory for addressing. After receiving feedback from the remote CXL, it is marked that the remote CXL memory addressing is successful, and data can be read or written in the remote CXL memory.

[0035] It's understandable that if the proportion of remote CXL memory in a virtual machine is too high, it will lead to a decline in virtual machine performance. This performance degradation can be manifested to some extent by local memory addressing failures. In other words, the degree of performance degradation of a virtual machine is related to the proportion of its local memory and remote CXL memory. The local memory proportion refers to the percentage of the virtual machine's total memory (i.e., the sum of local memory and remote CXL memory) that is used within its local memory. The remote CXL memory proportion refers to the percentage of the virtual machine's total memory (i.e., the sum of local memory and remote CXL memory) that is used within its remote CXL memory. Therefore, the performance degradation of the first virtual machine reflects the proportion of its local memory and remote CXL memory.

[0036] Specifically, when the performance of the first virtual machine degrades significantly, it indicates that the local memory ratio of the first virtual machine is much smaller than the remote CXL memory ratio; when the performance of the first virtual machine degrades slightly, it indicates that the local memory ratio of the first virtual machine is slightly smaller than the remote CXL memory ratio; when the performance of the first virtual machine shows an upward trend, it indicates that the local memory ratio of the first virtual machine is greater than the remote CXL memory ratio.

[0037] In this embodiment, based on the second data corresponding to each first virtual machine, a second virtual machine whose memory is to be adjusted is determined from a plurality of first virtual machines, and a third virtual machine for adjusting the memory of the second virtual machine is determined.

[0038] The second virtual machine is the first virtual machine whose performance degradation is determined to be the greatest based on the second data; that is, the second virtual machine is the virtual machine that needs memory adjustment. Specifically, the second virtual machine includes M virtual machines whose performance degradation exceeds a first threshold, where M is a preset positive integer greater than or equal to 1, and the first threshold is a pre-set threshold for determining the second virtual machine. This embodiment of the invention does not impose specific restrictions on the setting of the first threshold; for example, the first threshold can be set to 5%, meaning that when the performance degradation of the current first virtual machine exceeds 5% based on the second data, the first virtual machine is determined to be the second virtual machine that needs memory adjustment. Alternatively, the second virtual machine specifically includes the virtual machines corresponding to the first M positions of the second data in descending order of their values; that is, by sorting the second data corresponding to all the first virtual machines according to their performance degradation, the virtual machines corresponding to the first M positions of the second data are determined as the second virtual machines.

[0039] The third virtual machine is the first virtual machine whose performance is better or has the least performance degradation, determined by the second data. In other words, the third virtual machine is the one that requires memory data swapping with the second virtual machine. Specifically, the third virtual machine includes the virtual machines corresponding to the last N positions of the second data in descending order of their values. That is, by sorting the second data corresponding to all the first virtual machines according to their performance degradation, the virtual machines corresponding to the last N positions of the second data are determined as the third virtual machines, where N is a preset positive integer greater than or equal to 1. Alternatively, the third virtual machine may specifically include N virtual machines whose performance degradation is below a third threshold. The third threshold is a pre-set threshold used to determine the third virtual machine; this embodiment of the invention does not impose specific restrictions on the setting of the third threshold.

[0040] In this embodiment, after determining the second and third virtual machines involved in memory adjustment, the local memory data in the third virtual machine is used to adjust the remote CXL memory data in the second virtual machine, so as to increase the proportion of local memory data in the target memory data corresponding to the second virtual machine, and / or decrease the proportion of CXL memory data in the target memory data.

[0041] Specifically, by determining the first memory data corresponding to the first page of the second virtual machine in the remote CXL memory, and determining the second memory data corresponding to the second page of the third virtual machine in the local memory, the first memory data to be swapped corresponding to the second virtual machine is swapped with the second memory data to be swapped corresponding to the third virtual machine.

[0042] The first page is a portion of the pages in the remote CXL memory of the second virtual machine that are used for swapping. The first memory data corresponding to the first page is the memory data in the remote CXL memory of the second virtual machine that is determined to be adjusted, i.e., the memory data that is determined to be swapped. Specifically, the first memory data can be data resources used to run workloads deployed in the virtual machine.

[0043] The second page is the portion of the page in the local memory of the third virtual machine that is used for swapping. The second memory data corresponding to the second page is the memory data in the local memory of the third virtual machine that is determined to be used to adjust the first memory data of the second virtual machine, that is, the memory data that is determined to be used to swap with the memory data in the second virtual machine. Specifically, the second memory data may be data resources used to run workloads deployed in the virtual machine.

[0044] It is understandable that for the second virtual machine, whose performance has degraded too much from the first virtual machine, since the local memory ratio of the second virtual machine is much smaller than the remote CXL memory ratio, it is necessary to swap some memory data from the local memory of the third virtual machine, which has better performance or less performance degradation, to the remote CXL memory of the second virtual machine. This is to increase the proportion of local memory data in the first target memory data corresponding to the second virtual machine, and / or decrease the proportion of remote CXL memory data in the first target memory data, thereby improving the performance of the second virtual machine.

[0045] In this embodiment of the invention, firstly, the performance degradation of a virtual machine is predicted and evaluated based on various indicator parameters in the first data related to the virtual machine, so as to reflect the corresponding virtual machine performance through various hardware behavior parameters of the virtual machine; secondly, based on the predicted performance degradation of each virtual machine, virtual machines with poor performance and virtual machines with good performance are determined, and the ratio of local memory to remote CXL memory of the virtual machine in the memory hybrid mode is indirectly obtained based on the performance degradation of the virtual machine; thirdly, memory swapping is performed on the remote CXL memory data of the poorly performing virtual machine using the local memory data in the better performing virtual machine, so as to increase the proportion of local memory data and decrease the proportion of remote CXL memory data of the poorly performing virtual machine, thereby realizing flexible adjustment of the ratio of local memory and remote CXL memory of the poorly performing virtual machine according to the performance of each virtual machine, which greatly improves the performance of the virtual machine.

[0046] In some optional implementations, the step of exchanging and storing the first memory data corresponding to the first page in the remote Open Rapid Interconnect (CXL) memory of the second virtual machine with the second memory data corresponding to the second page in the local memory of the third virtual machine includes: determining first information related to the first page and determining second information related to the second page; obtaining the first memory data from the remote CXL memory based on the first information and writing the first memory data into the local memory, and obtaining the second memory data from the local memory based on the second information and writing the second memory data into the remote CXL memory.

[0047] In this embodiment, after determining the second and third virtual machines involved in memory adjustment, the first memory data for swapping in the remote CXL memory of the second virtual machine is determined by acquiring first information related to the first page, and the second memory data for swapping in the local memory of the third virtual machine is determined by acquiring second information related to the second page.

[0048] It should be noted that the embodiments of the present invention do not impose specific limitations on the method of obtaining the first information and the second information. For example, the second information related to the second page can be obtained by a local device for managing local memory, and the first information and the second information can be obtained by sending a request message carrying the second information to a network device for managing remote CXL memory, so as to receive the first information related to the first page fed back by the network device according to the memory adjustment requirements of the second virtual machine.

[0049] In this embodiment, after determining the first memory data and memory data to be exchanged, the first memory data in the remote CXL memory corresponding to the second virtual machine is written into the local memory corresponding to the third virtual machine, and the second memory data in the local memory corresponding to the third virtual machine is written into the remote CXL memory corresponding to the second virtual machine, so as to realize the exchange of the first memory data and the second memory data, thereby increasing the proportion of local memory in the second virtual machine and / or decreasing the proportion of remote CXL memory in the second virtual machine, thereby improving the operating performance of the second virtual machine.

[0050] Figure 3 This is a flowchart illustrating the virtual machine memory adjustment method according to an embodiment of the present invention. Figure 2 ;like Figure 3 As shown, the step of obtaining the first memory data from the remote CXL memory based on the first information and writing the first memory data into local memory, and obtaining the second memory data from local memory based on the second information and writing the second memory data into the remote CXL memory, includes: Step 201: Establish a mapping relationship between the first information and the second information.

[0051] In this embodiment, after determining the first information related to the first page and the second information related to the second page, a mapping relationship between the first information and the second information is established for subsequent memory data exchange.

[0052] The first information includes at least a first address range corresponding to the first page, and the second information includes at least a second address range corresponding to the second page. It can be understood that the established mapping relationship between the first and second information includes at least a first mapping relationship between the first and second address ranges.

[0053] The first address range is used to represent the range of physical addresses corresponding to the first page data being exchanged, and the first address range corresponds to the first page; the second address range is used to represent the range of physical addresses corresponding to the second page data, and the second address range corresponds to the second page.

[0054] Furthermore, the first information may also include the number of first pages corresponding to the first page. The number of first pages represents the number of pages in the remote CXL memory of the swapped second virtual machine, and is determined based on a preset second threshold and the total number of pages in the remote CXL memory of the second virtual machine. It can be understood that after determining the first page corresponding to the number of first pages based on the second threshold, the first address range corresponding to the first page can be determined based on the selected first page and the physical address range corresponding to the remote CXL memory of the second virtual machine.

[0055] It should be noted that, in this embodiment of the invention, since the second virtual machine with degraded performance needs to exchange memory data with one or more third virtual machines with higher performance, in order to prevent large performance fluctuations of the third virtual machine participating in memory adjustment, a second threshold is preset to limit the local memory data added in the second virtual machine to not exceed the memory data corresponding to the page below the second threshold, and / or to limit the local memory data reduced in the third virtual machine to not exceed the memory data corresponding to the page below the second threshold. In this embodiment of the application, no specific limitation is made on the second threshold. For example, the second threshold can be preset to 10%.

[0056] For example, when the second threshold is 10%, 10% of the total number of pages corresponding to the remote CXL memory of the second virtual machine is selected as the first page to be swapped. After determining the first page corresponding to the number of first pages according to the second threshold, the first address range corresponding to the first page is determined according to the selected 10% of pages and the physical address range corresponding to the remote CXL memory of the second virtual machine. This limits the second virtual machine to swap a maximum of 10% of the remote CXL memory data each time, so as to ensure that the second virtual machine reduces the remote CXL memory by a maximum of 10% each time, which also ensures that the second virtual machine increases the local memory by a maximum of 10% each time.

[0057] The first information may also include the first memory data quantity corresponding to the first memory data. The first memory data quantity is used to represent the number of bytes of the first memory data corresponding to the first page that is swapped. The first memory data quantity is determined based on the determined number of first pages and the first address range.

[0058] The second information may also include the number of second pages corresponding to the second page. The number of first pages is used to represent the number of pages in the local memory of the swapped third virtual machine, and is determined based on a preset second threshold and the total number of pages in the local memory of the third virtual machine. It can be understood that after determining the second page corresponding to the number of second pages based on the second threshold, the second address range corresponding to the second page can be determined based on the selected second page and the physical address range corresponding to the local memory of the third virtual machine.

[0059] For example, when the second threshold is 10%, 10% of the total number of pages corresponding to the local memory of the third virtual machine is selected as the second page to participate in the swap. After determining the second page corresponding to the number of second pages based on the second threshold, the second address range corresponding to the second page is determined based on the selected 10% of pages and the physical address range corresponding to the local memory of the third virtual machine. This limits the third virtual machine to swap a maximum of 10% of its local memory data each time, so as to ensure that the third virtual machine reduces its local memory by a maximum of 10% each time.

[0060] It should be noted that during the process of the third virtual machine determining the second page and the second memory data based on the second threshold, if the number of pages available for the current third virtual machine to participate in this exchange is insufficient to meet the 10% requirement due to previous memory adjustments, then the number of second pages corresponding to the current third virtual machine will only be the number of pages available for participation in this exchange. The remaining pages among the 10% of pages participating in the exchange will be determined by the next third virtual machine in order of performance degradation rate, thereby achieving memory data exchange with the second virtual machine through multiple third virtual machines.

[0061] The second information may also include the amount of second memory data corresponding to the second memory data. The amount of second memory data is used to represent the number of bytes of second memory data corresponding to the second page that is swapped. The amount of second memory data is determined based on the number of second pages and the second address range.

[0062] It is understandable that, when the first information includes the first amount of memory data and the second information includes the second amount of memory data, the established mapping relationship between the first information and the second information may also include a second mapping relationship between the first amount of memory data and the second amount of memory data.

[0063] Step 202: Obtain the first memory data from the remote CXL memory based on the first information, write the first memory data into the local memory corresponding to the second address range according to the mapping relationship, and obtain the second memory data from the local memory based on the second information, and write the second memory data into the remote CXL memory corresponding to the first address range according to the mapping relationship.

[0064] In this embodiment, after the mapping relationship between the first information and the second information is constructed, the first memory data and the second memory data participating in memory adjustment are determined according to the first address range in the first information and the second address range in the second information, and the exchange of the first memory data and the second memory data is realized based on the mapping relationship.

[0065] Specifically, based on the mapping relationship, the first memory data of the second virtual machine is written into the local memory corresponding to the second address range of the third virtual machine to reduce the remote CXL memory of the second virtual machine, and the second memory data of the third virtual machine is written into the remote CXL memory corresponding to the first address range of the second virtual machine to increase the local memory of the second virtual machine.

[0066] Step 203: Replace the second address range corresponding to the local memory in the third virtual machine with the first address range, and replace the first address range corresponding to the remote CXL memory in the second virtual machine with the second address range.

[0067] In this embodiment, after the memory data exchange is completed, in order to ensure that the memory data involved in the exchange is consistent with the corresponding physical address range, according to the first mapping relationship between the first address range and the second address range, the physical address of the original local memory of the third virtual machine is remapped to the memory page of the second virtual machine by replacing the second address range corresponding to the local memory in the third virtual machine with the first address range, and the physical address of the original remote CXL memory of the second virtual machine is remapped to the memory page of the third virtual machine by replacing the first address range corresponding to the remote CXL memory in the second virtual machine with the second address range. Thus, by updating the memory pages of each virtual machine involved in the memory adjustment, access to local memory is converted to access to remote CXL memory, and access to remote CXL memory is converted to access to local memory.

[0068] Figure 4 This is a flowchart illustrating the virtual machine memory adjustment method according to an embodiment of the present invention. Figure 3 ;like Figure 4 As shown, step 202 includes: Step 2021: Obtain the second memory data from local memory based on the second information, and cache the second memory data.

[0069] In this embodiment, by accessing the second address range corresponding to the second page, the second memory data participating in memory data exchange is determined from the local memory corresponding to the third virtual machine, and the determined second memory data is cached and backed up for subsequent exchange.

[0070] Step 2022: Based on the first information, obtain the first memory data from the remote CXL memory, and according to the mapping relationship, write the first memory data into the local memory corresponding to the second address range to overwrite the second memory data of the third virtual machine in the local memory.

[0071] In this embodiment, by accessing the first address range corresponding to the first page, the first memory data to be swapped is determined from the remote CXL memory of the second virtual machine. Based on the second address range, the determined first memory data is written into the local memory of the third virtual machine. The first memory data is used to overwrite the second memory data corresponding to the second address range, so as to realize the migration of the first memory data in the remote CXL memory of the second virtual machine to the local memory of the third virtual machine.

[0072] Step 2023: According to the mapping relationship, write the second memory data into the remote CXL memory corresponding to the first address range to overwrite the first memory data in the remote CXL memory corresponding to the second virtual machine.

[0073] In this embodiment, after the migration of the first memory data is completed, the previously cached second memory data is written to the remote CXL memory of the second virtual machine based on the first address range. The second memory data is used to overwrite the first memory data corresponding to the first address range, so as to realize the migration of the second memory data in the local memory of the third virtual machine to the remote CXL memory of the second virtual machine, thereby realizing the exchange of the first memory data and the second memory data.

[0074] In other words, the above-mentioned process of exchanging the first memory data and the second memory data is as follows: first, the second memory data of the third virtual machine in the local memory is cached and backed up; then, the first memory data to be exchanged is obtained from the remote CXL memory of the second virtual machine through the network and copied back to the storage unit of the third virtual machine in the local memory; finally, the backed-up second memory data is rewritten to the storage unit of the remote CXL memory of the second virtual machine.

[0075] In addition to the above-described exchange process, memory data exchange can also be implemented in the reverse manner. Specifically, based on the first information, first memory data is obtained from the remote CXL memory and cached; based on the second information, second memory data is obtained from the local memory, and according to the mapping relationship, the second memory data is written into the remote CXL memory corresponding to the first address range to overwrite the first memory data in the remote CXL memory corresponding to the second virtual machine; according to the mapping relationship, the first memory data is written into the local memory corresponding to the second address range to overwrite the second memory data in the local memory corresponding to the third virtual machine.

[0076] In other words, the above-mentioned process of exchanging the first memory data and the second memory data is as follows: first, the first memory data exchanged in the remote CXL memory of the second virtual machine is cached and backed up; then, the second memory data is obtained from the local memory of the third virtual machine and copied back to the storage unit of the remote CXL memory of the second virtual machine; finally, the backed-up first memory data is rewritten to the storage unit of the local memory of the third virtual machine.

[0077] In some optional implementations, predicting the second data of the first virtual machine based on the first data includes: processing the first data using a first model to obtain the second data corresponding to the first virtual machine; wherein the first model is obtained by training in advance using training data.

[0078] In this embodiment, a first model pre-trained based on training data is used to predict the future performance degradation of the first virtual machine based on the first data of the first virtual machine, thereby obtaining the second data corresponding to the first virtual machine.

[0079] Specifically, by inputting the various index parameters in the first data corresponding to the first virtual machine into the pre-trained first model, the first model predicts the degree of performance degradation of the first virtual machine and outputs the corresponding second data.

[0080] The first model is a virtual machine performance prediction model, specifically used to predict the performance degradation rate of virtual machines. This embodiment of the invention does not impose specific limitations on the first model; it only needs to be able to predict virtual machine performance. For example, the first model can employ a lightweight random forest classifier.

[0081] In some optional implementations, the method further includes: obtaining training data, the training data including first training data and second training data associated with the first training data, the first training data representing the working performance of the virtual machine, and the second training data including one or more metric parameters related to hardware execution behavior; wherein different virtual machines deploy the same image and configure the same hardware resources; training a first model to be trained based on the first training data and the second training data to adjust the model parameters of the first model until a first model that has been trained is obtained.

[0082] In this embodiment, the training process of the first model is as follows: acquiring first training data and second training data associated with the first training data; training the first model to be trained using the first training data and the second training data; adjusting the model parameters of the first model according to the training results of each iteration during the model training process until the training termination condition is met, thereby obtaining the first model after training.

[0083] The first training data is used to represent the performance of the workloads (or tasks) deployed on the virtual machine, and may specifically include the average performance degradation rate used to describe the performance of the virtual machine.

[0084] The second training data is associated with the first training data, meaning it is determined through the first training data. The determined second training data is used to construct the training dataset. Similar to the first data, the second training data specifically includes one or more metrics related to hardware execution behavior, such as CPU core-related parameters: CPI, MPKI, and L2 / L3 missing latency. These metrics can be directly obtained through the underlying performance counters deployed on the virtual machine.

[0085] For example, if the first model uses a lightweight random forest classifier, a weak decision tree needs to be built for each hardware metric in the second training data during the model training process. For example, weak decision trees can be built based on metrics such as CPI, MPKI, and L2 / L3 missing latency. A random forest is then built using multiple weak decision trees corresponding to multiple hardware metric features to jointly predict the performance degradation of the virtual machine.

[0086] It should be noted that during the acquisition of training data, the specifications of each virtual machine participating in model training can be different, but it must be ensured that the deployed image environment and the configured hardware resources are the same. In order to avoid the influence of other unrelated processes on the training results, each virtual machine exclusively uses the CPU cores during model training, and the number of CPU cores exclusively used by each virtual machine remains the same.

[0087] It should be noted that the embodiments of the present invention do not impose specific restrictions on the parameter tuning process of the first model. For example, a loss function can be constructed based on the model training results output in each round, and the parameters of the first model can be adjusted based on the loss function, so as to complete the training of the first model when the maximum number of iterations or the preset threshold is reached.

[0088] In some optional implementations, obtaining training data includes: using a fourth virtual machine to execute one or more first tasks multiple times to obtain the completion time of the fourth virtual machine for each execution of the first task, wherein the fourth virtual machine is any one of a plurality of virtual machines; determining performance description parameters of the fourth virtual machine based on a first completion time, a second completion time, and the number of first tasks; wherein the first completion time represents the duration for the fourth virtual machine to currently complete the first task, and the second completion time represents the duration for the fourth virtual machine to previously complete the first task; and using the performance description parameters indicating performance degradation as the first training data corresponding to the fourth virtual machine.

[0089] In this embodiment, by obtaining the completion time of each fourth virtual machine executing the first task each time, and based on the first completion time of completing the first task this time, the second completion time of completing the first task last time, and the number of first tasks deployed on the fourth virtual machine, the performance description parameters of the fourth virtual machine are determined, and the performance description parameters with degraded performance are selected from the performance description parameters corresponding to all fourth virtual machines as the first training data.

[0090] The fourth virtual machine is any one of the multiple virtual machines hosted on the same host. In other words, the fourth virtual machine is the virtual machine that participates in training the first model. All fourth virtual machines have the same image environment, the same configured hardware resources, and the same number of dedicated CPU cores.

[0091] The first task is any one of the multiple tasks deployed on each fourth virtual machine, i.e., any workload deployed on each fourth virtual machine. In this embodiment of the invention, during model training, in order to ensure the accuracy of the first model's evaluation results of the virtual machine performance, one or more applications that require a large amount of memory are designated as virtual machine tasks or workloads. Examples include: browser caching of various information on web pages, frequent database access, graphical processing of large games, and running deep learning or machine learning models. One or more of the above-mentioned tasks can be deployed on each fourth virtual machine participating in training.

[0092] The first completion time represents the duration of the fourth virtual machine completing the first task this time; the second completion time represents the duration of the previous completion of the same first task. Based on the duration of the fourth virtual machine in processing the same task this time and last time, the percentage decrease or increase in the operating performance of the fourth virtual machine can be calculated, and then the performance description parameters corresponding to the fourth virtual machine can be determined based on the number of first tasks deployed by the fourth virtual machine.

[0093] For example, the process of obtaining the corresponding performance description parameters for each fourth virtual machine can be designed as follows: (1) in, Indicates the first i Performance description parameters corresponding to the fourth virtual machine; j Indicates the first j The first task, that is, the first task j , N For the first i Work tasks deployed on a fourth virtual machine ( j =[1, N The total number of ]); Indicates the first i The fourth virtual machine has completed its first task. j The duration, i.e., the first completion time; Indicates the first i The fourth virtual machine completed its first task last time. j The duration, i.e., the second completion time; Indicates the first i The fourth virtual machine has completed its first task. j The duration compared to the last time the first work task was completed j The percentage decrease or increase in duration is used to reflect the duration of the first [unclear]. i The fourth virtual machine processing task j Performance.

[0094] By examining the first i The fourth virtual machine processing N Sum the reduction or increase rates of each first task, and then calculate based on the number of first tasks. N Calculate the first i The average performance of the fourth virtual machine (i.e., multiplied by) ), to obtain the first i Performance description parameters corresponding to the fourth virtual machine If the value of the performance description parameter is positive, it indicates that the first... i The performance of the fourth virtual machine shows an improving trend; if the value of the performance description parameter is negative, it indicates that the performance of the fourth virtual machine is increasing. iThe performance of the fourth virtual machine shows a downward trend, so the performance description parameters corresponding to the fourth virtual machine with the downward trend are used as the first training data.

[0095] In addition, during the acquisition of the first training data, the performance description parameters can be calculated multiple times in succession, and the results of multiple calculations at consecutive time intervals can be weighted and averaged to ensure that the prediction results of the first model trained based on the training data are objective and accurate, and to reduce the impact of short-term changes in virtual machine performance on the misjudgment of the overall performance trend.

[0096] In this embodiment, after determining the first training data, the second training data associated with the fourth virtual machine corresponding to the first training data is obtained. That is, the second training data includes one or more index parameters related to hardware execution behavior. Then, a training dataset is constructed based on the second training data corresponding to the fourth virtual machine whose performance is declining, so as to train the initial first model in the future.

[0097] For example, during the process of constructing the training dataset based on the second training data, the performance counters of the Intel platform can be used to collect various indicator parameters of the fourth virtual machine at different times. For example, the second training data can be collected multiple times during the daytime when the network bandwidth is high and at night when the network bandwidth is low, so as to ensure that the training dataset is more complete and more diverse.

[0098] It should be noted that, in this embodiment of the invention, in order to ensure the generalization ability of the first model and reduce the impact of sudden changes in virtual machine performance on the prediction results, for the training dataset composed of the second training data, a portion of the dataset will be randomly selected for modeling, and the remaining dataset will be used to verify the error.

[0099] For example, when the first model uses a lightweight random forest classifier, the training dataset for training the decision trees is constructed using the second training data corresponding to each fifth virtual machine. Two-thirds of the training dataset is used for modeling, and the remaining one-third is used for error validation. Specifically, for the multiple decision trees constructed by the random forest, each decision tree corresponds to a set of training data. Each set of training data consists of two-thirds randomly selected from the training dataset as an automatic sample set. This sample set may contain the same samples selected multiple times. The remaining one-third of the out-of-bag data is used to evaluate the decision trees, thereby calculating the prediction error rate of the first model. The parameters of the first model are then tuned based on the prediction error rate. Through repeated iterations, the training of the random forest is completed, thus ensuring the prediction accuracy and generalization ability of the random forest.

[0100] As an example, Figure 5 This is a flowchart illustrating an example of a virtual machine memory adjustment method according to an embodiment of the present invention; as shown below. Figure 5As shown, when the first model uses a random forest model, the specific process for adjusting virtual machine memory is as follows: Step 301: Pre-train the random forest model.

[0101] Specifically, the process involves acquiring first training data and second training data associated with the first training data. The first training data describes the average performance degradation rate of the virtual machine, while the second training data includes CPI, MPKI, and L2 / L3 missing latency. The first model to be trained is trained using the first and second training data. During the model training process, the model parameters of the first model are adjusted based on the training results of each iteration until the training termination condition is met, thereby obtaining the trained random forest model.

[0102] Step 302: Predict the performance of the first virtual machine using a random forest model.

[0103] Specifically, the first data is obtained through the CPU cores allocated to each virtual machine. The first data includes CPI, MPKI and L2 / L3 missing latency. The parameters of each indicator in the first data corresponding to the first virtual machine are input into a pre-trained random forest model. The random forest model predicts the degree of performance degradation of each first virtual machine and outputs the corresponding second data.

[0104] Step 303: Sort the performance of each first virtual machine.

[0105] Specifically, after predicting the performance degradation rate of each first virtual machine, the performance degradation rates of each virtual machine are sorted in descending order.

[0106] Step 304a: Identify the second virtual machine with the greatest performance degradation.

[0107] Specifically, the virtual machines are sorted by performance degradation from back to front, and the third virtual machine with better performance is selected as the virtual machine for swapping memory data.

[0108] Step 304b: Determine the third virtual machine with better performance.

[0109] Specifically, the virtual machine is sorted by performance degradation from front to back, and the second virtual machine with the greatest performance degradation is selected as the virtual machine to have its memory data swapped.

[0110] Step 305a: Obtain the first memory data from the remote CXL memory of the second virtual machine.

[0111] Specifically, by obtaining the first information related to the first page, the first memory data for swapping in the remote CXL memory of the second virtual machine is determined. The first information includes the first address range corresponding to 10% of the CXL pages, the number of first pages, and the amount of first memory data.

[0112] Step 305b: Obtain the second memory data from the local memory of the third virtual machine.

[0113] Specifically, by obtaining the second information related to the second page, the second memory data used for swapping in the local memory of the third virtual machine is determined. The second information includes the second address range corresponding to some local pages, the number of second pages, and the amount of second memory data.

[0114] Step 306: Determine whether the current second memory data of the third virtual machine meets the number of pages required for swapping.

[0115] Specifically, determine whether the local pages in the local memory corresponding to the current third virtual machine that are involved in the swapping meet the 10% local page requirement. If the 10% local page requirement is not met, proceed to step 307; if the 10% local page requirement is met, proceed to step 308.

[0116] Step 307: If the second memory data of the current third virtual machine does not meet the number of pages for swapping, perform partial memory data swapping.

[0117] Specifically, if the second memory data of the current third virtual machine does not meet the number of pages for swapping, the second memory data corresponding to a portion of the local memory pages of the current third virtual machine is written into the remote CXL memory corresponding to the second virtual machine. Then, by re-executing steps 304b, 305b, and 306, the remaining second memory data that meets the 10% local page requirement is obtained by re-determining a third virtual machine with better performance.

[0118] Step 308: If the second memory data of the current third virtual machine meets the number of pages required for swapping, perform a full memory data swap.

[0119] Specifically, if the second memory data of the third virtual machine meets the number of pages for swapping, the second memory data of the third virtual machine in local memory is cached and backed up, the first memory data of the second virtual machine in remote CXL memory is copied back to the third virtual machine in local memory, and the backed-up second memory data is rewritten to the second virtual machine in remote CXL memory. This increases the proportion of local memory data in the target memory data corresponding to the second virtual machine and reduces the proportion of CXL memory data in the target memory data.

[0120] Furthermore, by replacing the second address range corresponding to the local memory in the third virtual machine with the first address range, the physical address of the original local memory of the third virtual machine is remapped to the memory page of the second virtual machine. And by replacing the first address range corresponding to the remote CXL memory in the second virtual machine with the second address range, the physical address of the original remote CXL memory of the second virtual machine is remapped to the memory page of the third virtual machine. This converts access to local memory into access to remote CXL memory, and vice versa, thereby achieving memory adjustment for the poorly performing second virtual machine.

[0121] Based on the above embodiments, Figure 6 This is a schematic diagram of a virtual machine memory adjustment system structure provided in an embodiment of the present invention; as shown below. Figure 6 As shown, the system consists of a physical server 1 for managing the local memory of each virtual machine and a physical server 2 for managing the remote CXL memory of each virtual machine. The physical server 1 can be deployed on the local device where the host is located, and the physical server 2 can be deployed on the network device where the remote CXL device is located. The virtual machine memory is adjusted through the interaction between the physical server 1 and the physical server 2.

[0122] Physical server 1 includes a local storage module, multiple virtual machines, multiple CPU cores, a performance prediction module, a memory data exchange module, a control module, and a Controller Area Network Open (CANopen) over EtherCAT (Ethernet for Control Automation Technology) module based on Ethernet control automation technology. Physical server 2 includes a remote CXL storage module, a COE module, and a CXL drive.

[0123] The local storage module is used to store the local memory data of each virtual machine deployed on the host. When a virtual machine is processing a workload, it first accesses the local memory from the local storage module through the corresponding physical address.

[0124] Multiple virtual machines are virtual machines deployed on the host. The proportion of local memory and remote CXL memory varies for each virtual machine. Figure 6 As shown, virtual machine 1 (vm1) has the lowest local memory usage, followed by virtual machine 2 (vm2), and virtual machine 3 (vm3) has the highest local memory usage.

[0125] Multiple CPU cores are distributed across different virtual machines deployed on the host machine. CPU cores 1 through 4 are distributed on virtual machine 1, CPU cores 5 and 6 are distributed on virtual machine 2, and CPU cores 7 and 8 are distributed on virtual machine 3.

[0126] The performance prediction module is configured with a pre-trained first model based on random forest, which is used to predict and evaluate the performance of each virtual machine based on the first data of each CPU core allocated on each virtual machine (specifically including CPI, MPKI, L2 / L3 missing latency), to obtain the performance degradation rate of each virtual machine. Based on the performance degradation rate of each virtual machine, one or more virtual machines with the largest performance degradation and one or more virtual machines with better performance are determined, that is, the virtual machines that participate in memory data exchange are determined.

[0127] The control module is used to obtain relevant information about the local memory participating in memory data exchange, such as the number of pages, address range, and amount of memory data corresponding to the local memory data; it is also used to obtain relevant information about the remote CXL memory participating in memory data exchange from the remote CXL device, such as the number of pages, address range, and amount of memory data corresponding to the remote CXL memory data.

[0128] The memory data exchange module is used to record relevant information about the local memory and remote CXL memory involved in memory data exchange obtained from the control module, such as the number of pages, address range, and amount of memory data corresponding to the memory data; it is also used to cache the local memory data involved in the exchange, and / or, cache the remote CXL memory data involved in the exchange through the COE module; it is also used to write the remote CXL memory data involved in memory data exchange received through the COE module into the local memory, and to migrate the local memory data involved in memory data exchange to the remote CXL memory through the COE module, thereby realizing memory data exchange and storage.

[0129] The CXL storage module is used to store the remote CXL memory data corresponding to each virtual machine deployed on the host. When a virtual machine fails to access the remote CXL memory through the CXL storage module after failing to access the local storage module during the processing of its workload, it accesses the remote CXL memory through the corresponding physical address.

[0130] The CXL driver is deployed in a remote CXL memory device to migrate remote CXL memory data participating in memory data exchange to local memory via the COE module; it is also used to write local memory data participating in memory data exchange received through the COE module into the remote CXL memory, thereby realizing memory data exchange and storage.

[0131] Specifically, after determining the performance degradation rates of virtual machines 1, 2, and 3 using the performance prediction module, the worst-performing virtual machine 1 and the best-performing virtual machine 3 are selected based on their respective performance degradation rates. The control module determines the first memory data involved in memory data exchange in the remote CXL memory corresponding to virtual machine 1, and the second memory data involved in memory data exchange in the local memory corresponding to virtual machine 3. The memory data exchange module caches and backs up the second memory data of virtual machine 3 in its local memory through the COE module. Then, the first memory data of virtual machine 1 in the remote CXL memory is written to the local storage module corresponding to virtual machine 3 through the CXL driver module and the COE module in sequence. Finally, the backed-up second memory data is written to the CXL storage module corresponding to virtual machine 1 through the COE module and the CXL driver module in sequence. This increases the proportion of local memory in virtual machine 1 and reduces the proportion of remote CXL memory in virtual machine 1, thereby improving the performance of virtual machine 1.

[0132] Based on the above embodiments, this invention also provides a virtual machine memory adjustment device. Figure 7 This is a schematic diagram of the composition structure of the virtual machine memory adjustment device provided in an embodiment of the present invention; as shown below. Figure 7 As shown, the device includes: an acquisition unit 41, a prediction unit 42, and an exchange unit 43; wherein, The acquisition unit 41 is used to acquire first data related to the first virtual machine, wherein the first virtual machine is any one of a plurality of virtual machines carried by the host, and the first data includes one or more indicator parameters related to hardware execution behavior. The prediction unit 42 is used to predict second data of the first virtual machine based on the first data, wherein the second data represents the degree of performance degradation of the first virtual machine. The switching unit 43 is configured to determine a second virtual machine and a third virtual machine from the plurality of virtual machines based on the second data of each first virtual machine; wherein the second virtual machine includes the M virtual machines with the greatest performance degradation, and the third virtual machine includes the N virtual machines with the smallest performance degradation, where M is an integer greater than or equal to 1 and N is an integer greater than or equal to 1; it is also configured to exchange and store the first memory data corresponding to the first page of the second virtual machine in the remote Open Rapid Interconnect (CXL) memory with the second memory data corresponding to the second page of the third virtual machine in the local memory, so as to increase the proportion of local memory data in the target memory data corresponding to the second virtual machine, and / or decrease the proportion of CXL memory data in the target memory data; wherein the first page is a part of the page corresponding to the remote CXL memory, and the second page is a part of the page corresponding to the local memory.

[0133] In an optional embodiment of the present invention, the device further includes a control unit 44, configured to determine first information related to a first page and second information related to a second page; The switching unit 43 is configured to obtain the first memory data from the remote CXL memory based on the first information and write the first memory data into the local memory, and to obtain the second memory data from the local memory based on the second information and write the second memory data into the remote CXL memory.

[0134] In an optional embodiment of the present invention, the first information includes: a first address range corresponding to the first page; the second information includes: a second address range corresponding to the second page; the switching unit 43 is used to establish a mapping relationship between the first information and the second information; obtain the first memory data from the remote CXL memory based on the first information, write the first memory data into the local memory corresponding to the second address range according to the mapping relationship, and obtain the second memory data from the local memory based on the second information, write the second memory data into the remote CXL memory corresponding to the first address range according to the mapping relationship; replace the second address range corresponding to the local memory in the third virtual machine with the first address range, and replace the first address range corresponding to the remote CXL memory in the second virtual machine with the second address range.

[0135] In an optional embodiment of the present invention, the switching unit 43 is configured to obtain the second memory data from local memory based on the second information and cache the second memory data; obtain the first memory data from the remote CXL memory based on the first information; write the first memory data into the local memory corresponding to the second address range according to the mapping relationship, so as to overwrite the second memory data of the third virtual machine in the local memory; and write the second memory data into the remote CXL memory corresponding to the first address range according to the mapping relationship, so as to overwrite the first memory data in the remote CXL memory corresponding to the second virtual machine.

[0136] In an optional embodiment of the present invention, the prediction unit 42 is used to process the first data using a first model to obtain second data corresponding to the first virtual machine; wherein the first model is obtained by training in advance using training data.

[0137] In an optional embodiment of the present invention, the apparatus further includes a model training unit 45 for obtaining training data, the training data including first training data and second training data associated with the first training data, the first training data representing the working performance of the virtual machine, and the second training data including one or more index parameters related to hardware execution behavior; wherein different virtual machines deploy the same image and configure the same hardware resources; the first model to be trained is trained based on the first training data and the second training data to adjust the model parameters of the first model until the first model is obtained after training.

[0138] In an optional embodiment of the present invention, the model training unit 45 is configured to use a fourth virtual machine to execute one or more first tasks multiple times to obtain the completion time of the fourth virtual machine for each execution of the first task, wherein the fourth virtual machine is any one of a plurality of virtual machines; determine the performance description parameters of the fourth virtual machine based on the first completion time, the second completion time, and the number of first tasks; wherein the first completion time represents the duration of the fourth virtual machine currently completing the first task, and the second completion time represents the duration of the fourth virtual machine last completing the first task; and use the performance description parameters indicating performance degradation as the first training data corresponding to the fourth virtual machine.

[0139] In this invention, the prediction unit 42, switching unit 43, control unit 44, and model training unit 45 in the device can be implemented by a CPU, digital signal processor (DSP), microcontroller unit (MCU), or field-programmable gate array (FPGA) in practical applications; the acquisition unit 41 in the device can be implemented by a communication module (including: basic communication kit, operating system, communication module, standardized interface and protocol, etc.) and transceiver antenna in practical applications.

[0140] It should be noted that the virtual machine memory adjustment device described above is only illustrated by the division of the above-mentioned program modules. In actual applications, the above processing can be assigned to different program modules as needed, that is, the internal structure of the device can be divided into different program modules to complete all or part of the processing described above. In addition, the virtual machine memory adjustment device and the virtual machine memory adjustment method 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.

[0141] This invention also provides a computer device. Figure 8This is a schematic diagram of the hardware composition structure of a computer device provided in an embodiment of the present invention, such as... Figure 8 As shown, the computer device includes a memory 52, a processor 51, and a computer program stored in the memory 52 and executable on the processor 51.

[0142] Optionally, the computer device also includes at least one communication component 54. The various components in the computer device can be coupled together via a bus system 53. It is understood that the bus system 53 is used to implement communication between these components. In addition to a data bus, the bus system 53 also includes a power bus, a control bus, and a status signal bus. However, for clarity, in... Figure 8 The general labeled all buses as Bus System 53.

[0143] It is understood that memory 52 can be volatile memory or non-volatile memory, or both. Non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), ferromagnetic random access memory (FRAM), flash memory, magnetic surface memory, optical disc, or compact disc read-only memory (CD-ROM); magnetic surface memory can be disk storage or magnetic tape storage. Volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as Static Random Access Memory (SRAM), Synchronous Static Random Access Memory (SSRAM), Dynamic Random Access Memory (DRAM), Synchronous Dynamic Random Access Memory (SDRAM), Double Data Rate Synchronous Dynamic Random Access Memory (DDRSDRAM), Enhanced Synchronous Dynamic Random Access Memory (ESDRAM), SyncLink Dynamic Random Access Memory (SLDRAM), and Direct Rambus Random Access Memory (DRRAM).The memory 52 described in this embodiment of the invention is intended to include, but is not limited to, these and any other suitable types of memory.

[0144] The methods disclosed in the above embodiments of the present invention can be applied to processor 51, or implemented by processor 51. Processor 51 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the integrated logic circuit of the hardware in processor 51 or by instructions in the form of software. The processor 51 may be a general-purpose processor, DSP, or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Processor 51 can implement or execute the methods, steps and logic block diagrams disclosed in the embodiments of the present invention. The general-purpose processor may be a microprocessor or any conventional processor, etc. The steps of the methods disclosed in the embodiments of the present invention can be directly manifested as being executed by a hardware decoding processor, or being executed by a combination of hardware and software modules in the decoding processor. The software modules may be located in a storage medium, which is located in memory 52. ​​Processor 51 reads the information in memory 52 and completes the steps of the aforementioned method in combination with its hardware.

[0145] In an exemplary embodiment, the computer device may be implemented by one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), FPGAs, general-purpose processors, controllers, MCUs, microprocessors, or other electronic components to perform the aforementioned methods.

[0146] This invention also provides a computer-readable storage medium having a computer program stored thereon.

[0147] Optionally, the computer-readable storage medium can be applied to the virtual machine memory adjustment device of the present invention embodiment; then when the program is executed by the processor, it implements the steps of the virtual machine memory adjustment method of the present invention applied to a terminal or a first network device.

[0148] This invention also provides a computer program product, including a computer program that can be executed by the processor 51 of a computer device to complete the steps of the virtual machine memory adjustment method described in this invention.

[0149] The methods disclosed in the several method embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments.

[0150] The features disclosed in the several product embodiments provided in this application can be arbitrarily combined without conflict to obtain new product embodiments.

[0151] The features disclosed in the several method or device embodiments provided in this application can be arbitrarily combined without conflict to obtain new method or device embodiments.

[0152] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods, such as: multiple units or components can be combined, or integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the various components shown or discussed can be through some interfaces, and the indirect coupling or communication connection between devices or units can be electrical, mechanical, or other forms.

[0153] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the units may be selected to achieve the purpose of this embodiment according to actual needs.

[0154] In addition, in the various embodiments of the present invention, each functional unit can be integrated into one processing unit, or each unit can be a separate unit, or two or more units can be integrated into one unit; the integrated unit can be implemented in hardware or in the form of hardware plus software functional units.

[0155] Those skilled in the art will understand that all or part of the steps of the above method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps of the above method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as mobile storage devices, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0156] Alternatively, if the integrated units of this invention are implemented as software functional modules and sold or used as independent products, they can also be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the embodiments of this invention, or the parts that contribute to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as mobile storage devices, ROM, RAM, magnetic disks, or optical disks.

[0157] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

Claims

1. A method for adjusting virtual machine memory, characterized in that, The method includes: Acquire first data related to the first virtual machine, wherein the first virtual machine is any one of multiple virtual machines hosted by the host, and the first data includes one or more indicator parameters related to hardware execution behavior; Based on the first data, predict the second data of the first virtual machine, where the second data represents the degree of performance degradation of the first virtual machine; Based on the second data of each first virtual machine, a second virtual machine and a third virtual machine are determined from the plurality of virtual machines; wherein, the second virtual machine includes the M virtual machines with the greatest performance degradation, and the third virtual machine includes the N virtual machines with the smallest performance degradation, where M is an integer greater than or equal to 1 and N is an integer greater than or equal to 1; The first memory data corresponding to the first page in the remote Open Rapid Interconnect (CXL) memory of the second virtual machine is swapped with the second memory data corresponding to the second page in the local memory of the third virtual machine. This is to increase the proportion of local memory data in the target memory data corresponding to the second virtual machine, and / or decrease the proportion of CXL memory data in the target memory data. The first page is a portion of the pages corresponding to the remote CXL memory, and the second page is a portion of the pages corresponding to the local memory.

2. The method according to claim 1, characterized in that, The step of exchanging and storing the first memory data corresponding to the first page in the remote Open Rapid Interconnect (CXL) memory of the second virtual machine with the second memory data corresponding to the second page in the local memory of the third virtual machine includes: Determine the first information related to the first page, and determine the second information related to the second page; Based on the first information, the first memory data is obtained from the remote CXL memory and written into the local memory, and based on the second information, the second memory data is obtained from the local memory and written into the remote CXL memory.

3. The method according to claim 2, characterized in that, The first information includes: a first address range corresponding to the first page; the second information includes: a second address range corresponding to the second page; the step of obtaining the first memory data from the remote CXL memory based on the first information and writing the first memory data into local memory, and obtaining the second memory data from local memory based on the second information and writing the second memory data into the remote CXL memory, includes: Establish a mapping relationship between the first information and the second information; Based on the first information, the first memory data is obtained from the remote CXL memory. According to the mapping relationship, the first memory data is written into the local memory corresponding to the second address range. Based on the second information, the second memory data is obtained from the local memory. According to the mapping relationship, the second memory data is written into the remote CXL memory corresponding to the first address range. Replace the second address range corresponding to the local memory in the third virtual machine with the first address range, and replace the first address range corresponding to the remote CXL memory in the second virtual machine with the second address range.

4. The method according to claim 3, characterized in that, The step of obtaining the first memory data from the remote CXL memory based on the first information, writing the first memory data into the local memory corresponding to the second address range according to the mapping relationship, and obtaining the second memory data from the local memory based on the second information, and writing the second memory data into the remote CXL memory corresponding to the first address range according to the mapping relationship, includes: Based on the second information, the second memory data is obtained from local memory and cached. Based on the first information, the first memory data is obtained from the remote CXL memory. According to the mapping relationship, the first memory data is written into the local memory corresponding to the second address range to overwrite the second memory data of the third virtual machine in the local memory. According to the mapping relationship, the second memory data is written into the remote CXL memory corresponding to the first address range to overwrite the first memory data in the remote CXL memory corresponding to the second virtual machine.

5. The method according to any one of claims 1 to 4, characterized in that, The prediction of the second data of the first virtual machine based on the first data includes: The first data is processed using the first model to obtain the second data corresponding to the first virtual machine; wherein the first model is obtained by training the training data in advance.

6. The method according to claim 5, characterized in that, The method further includes: Training data is obtained, which includes first training data and second training data associated with the first training data. The first training data represents the working performance of the virtual machine, and the second training data includes one or more indicator parameters related to hardware execution behavior. Different virtual machines are deployed with the same image and configured with the same hardware resources. The first model to be trained is trained based on the first training data and the second training data to adjust the model parameters of the first model until the first model is obtained after training.

7. The method according to claim 6, characterized in that, The obtained training data includes: The fourth virtual machine is used to execute one or more first tasks multiple times to obtain the completion time of each execution of the first task by the fourth virtual machine. The fourth virtual machine is any one of a plurality of virtual machines. The performance description parameters of the fourth virtual machine are determined based on the first completion time, the second completion time, and the number of the first work tasks; wherein, the first completion time represents the duration for the fourth virtual machine to currently complete the first work task, and the second completion time represents the duration for the fourth virtual machine to last complete the first work task; The performance description parameter, which indicates a performance degradation, is used as the first training data corresponding to the fourth virtual machine.

8. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the steps of the method according to any one of claims 1 to 7.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the program implements the steps of the method according to any one of claims 1 to 7.

10. A computer program product, comprising a computer program, characterized in that, The computer program, when executed by a processor, implements the method according to any one of claims 1 to 7.