Memory hotspot elimination method based on memory hierarchization and memory compression

Through memory classification and compression technology, real-time monitoring and optimization of host memory solves performance problems caused by memory hot spots in cloud computing servers, achieves fast and safe elimination of memory hot spots, avoids the risk of virtual machine migration, and improves memory utilization. efficiency and user business stability.

WO2024212604A1PCT designated stage expired Publication Date: 2024-10-17CHINA TELECOM CLOUD TECH CO LTD

Patent Information

Application Number
PCT/CN2023/142746
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-12-14
Filing Date
2023-12-28
Publication Date
2024-10-17

AI Technical Summary

Technical Problem

Memory hot spots in cloud computing servers due to large amounts of data processing lead to performance degradation. Existing technologies have problems with migration failure and long migration time when solved through virtual machine scheduling.

Method used

Using methods based on memory classification and memory compression, the memory hot spot elimination scheduling system monitors the host memory in real time, triggers the memory compression and decompression process, optimizes memory page distribution, avoids virtual machine migration, and achieves closed-loop elimination of memory hot spots on a single host. .

Benefits of technology

It can quickly and safely reduce host memory pressure, avoid virtual machine migration failures and long migration times, and improve memory utilization efficiency and user business stability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2023142746_17102024_PF_FP_ABST
    Figure CN2023142746_17102024_PF_FP_ABST
Patent Text Reader

Abstract

Disclosed is a memory hotspot elimination method based on memory hierarchization and memory compression, which belongs to the technical field of cloud computing servers. The method comprises the steps: S1, a memory hotspot elimination scheduling system monitors the memory situation of a host machine in real time; and S2, when memory usage of the host machine is greater than a host machine memory hotspot threshold value, triggering a memory compression process, and compressing an inactive memory page in the host machine. The memory hotspot elimination method can to a certain extent implement closed-loop memory hotspot elimination of a single host machine, and the security and stability of a user service during the memory hotspot elimination process are greatly improved. Also, In the memory hotspot elimination method, swapping and adjustment are likewise carried out on a means of memory allocation, so that the memory utilization efficiency of the host machine can be further improved.
Need to check novelty before this filing date? Find Prior Art

Description

A memory hotspot elimination method based on memory classification and memory compression Technical Field

[0001] The present invention relates to the technical field of cloud computing servers, and in particular to a method for eliminating memory hotspots based on memory grading and memory compression. Background Art

[0002] With the development of the digital age, people generate more and more data in their daily lives, and the data processing volume of current large-scale user businesses is also increasing. This poses a huge challenge to the memory resources of cloud computing servers. In response, cloud computing server operators have introduced the concept of memory overselling, that is, the total amount of memory sold exceeds the actual total amount that can be sold to meet the large-scale memory needs of user businesses.

[0003] Memory hierarchy is divided according to different memory types and uses. The following are common memory hierarchies: Main Memory: This usually refers to a computer's RAM (random access memory), which stores running programs and data and can be quickly read and written. Main memory is generally divided into two types: DRAM (dynamic random access memory) and SRAM (static random access memory). Cache Memory: A cache is a small-capacity memory located between the CPU and main memory, used to temporarily store recently used data and instructions. Cache is divided into multiple levels, including L1, L2, and L3. L1 cache is the fastest and has the smallest capacity, while L3 cache is the slowest and has the largest capacity. Cache can significantly improve computer performance by reducing the latency of reading data from main memory. Auxiliary Storage: Auxiliary storage usually refers to storage devices such as hard drives, solid-state drives (SSDs), optical disks, and floppy disks. They are typically used to store large amounts of data for a long time. Compared to main memory, secondary memory is slower to access but less expensive, making it suitable for storing large amounts of infrequently accessed data. Registers: Registers are small-capacity memories located within the CPU that store data and instructions. Registers can be accessed very quickly and are suitable for temporarily storing frequently used data.

[0004] The host memory usage process in a cloud computing server cluster is usually divided into two processes: memory allocation and memory occupation. Memory allocation occurs in the memory sales stage. After the user virtual machine specifications are determined, the server cluster assigns a specific host machine to allocate its memory to the business virtual machine; memory occupation occurs during the operation of the user business virtual machine. Each user business virtual machine can occupy and release its allocated memory resources at any time. When there is a short-term peak in user business demand or a tidal effect of user business, memory hotspots may appear on some host machines, affecting the performance of user business.

[0005] Virtual machine scheduling is to schedule newly created virtual machines to specific hosts or select specific virtual machines to schedule to specific hosts based on specific scheduling algorithms or policies. Virtual machine scheduling can flexibly allocate limited resources on the host to different virtual machines to ensure the service quality of the business within the virtual machine.

[0006] Memory hotspots occur when a computer program frequently accesses certain memory areas during execution, causing them to become hotspots of high memory usage. These hotspots may be critical data structures, variables, or caches. Frequent access and modification of these hotspots can lead to abnormally high memory usage and potentially cause performance issues.

[0007] Memory hotspots may be caused by poorly designed data structures, inefficient algorithms, or memory management issues within a program. By analyzing and optimizing memory hotspots, you can effectively improve program performance and memory efficiency. To address these issues, you can employ the following methods: Optimize data structures: Redesign program data structures to reduce frequent memory accesses and modifications. For example, you can use more efficient data structures such as hash tables, trees, or graphs instead of traditional data structures like arrays or linked lists. Optimize algorithms: Optimize program algorithms to reduce memory usage and access frequency. For example, you can use more efficient sorting, searching, or computational algorithms to improve program performance. Cache optimization: Use caches within your program to store frequently accessed data, reducing memory access frequency. At the same time, pay attention to the cache size and the rationality of the caching strategy to avoid cache overflows and cache invalidation. Optimize memory management: Allocate and release memory appropriately to avoid memory leaks and memory fragmentation. For example, you can use smart pointers, RAII, and other technologies to automatically manage memory allocation and deallocation. Use memory analysis tools: Use specialized memory analysis tools to detect and analyze memory hotspots in your program, thereby identifying optimization directions and entry points. For example, you can use tools such as Valgrind and Massif to monitor your program's memory usage.

[0008] Eliminating host memory hotspots involves reducing memory usage on hosts experiencing memory hotspots. Generally speaking, when some hosts in a cloud service cluster experience memory hotspots, administrators use virtual machine scheduling to migrate virtual machine workloads from the hotspot hosts to non-hotspot hosts, thereby reducing memory pressure on the hotspot hosts. However, virtual machine migration methods carry risks such as lengthy migration times and migration failures.

[0009] Memory compression is a technology that compresses memory pages to reduce the actual memory usage of page memory. When the compressed page memory in the host machine is accessed, the compressed memory is decompressed and made available to the process on the host machine. Currently, mainstream versions of Windows and Linux systems support memory compression technology. Memory compression is a data compression technology that is mainly used to compress data stored in computer memory. Its principle is to compress data into a smaller volume through a certain algorithm to save memory space and improve data transmission efficiency. Memory compression can be divided into lossless compression and lossy compression. Lossless compression means that no information is lost when compressing data and the original data can be completely restored. Lossless compression loses some data but has a higher compression ratio. It is suitable for some situations where data quality requirements are not particularly high. Memory compression technology has a wide range of applications. For example, it is widely used in database management systems, file compression, network communications and other fields. Memory compression can effectively reduce data storage space, increase data transmission speed, and reduce storage and transmission costs. At the same time, memory compression can also improve system performance, reduce the number of I / O operations, and shorten response time.

[0010] Summary of the Invention

[0011] Based on the current memory hierarchy of large-scale host clusters, this paper utilizes memory compression technology to design a method for eliminating host memory hotspots without requiring virtual machine scheduling. Through memory allocation and compression algorithms, this method achieves the rational allocation and recycling of host memory, reducing host memory pressure while also avoiding potential migration failures and time-consuming migrations that can occur during virtual machine migration. This method eliminates memory hotspots within a closed loop within a single host machine, ensuring the security and performance of user services.

[0012] In order to achieve the above effects, the present invention provides the following technical solution: a method for eliminating memory hot spots based on memory classification and memory compression, comprising the steps of:

[0013] S1. The memory hotspot elimination scheduling system monitors the host machine memory status in real time.

[0014] S2. When the host machine's memory usage exceeds the host machine's memory hotspot threshold, the memory compression process is triggered to compress the inactive memory pages in the host machine.

[0015] S3. When the compressed memory in the host machine is accessed by a process or there is a compressed page on the host machine and the host machine memory usage is less than the host machine memory hotspot threshold, the memory decompression process is triggered to decompress the compressed memory of the host machine.

[0016] S4. Set a memory swap timing interval to trigger the memory swap process at a fixed time, such as triggering a memory swap every 1 second, to swap different levels of memory on the host machine.

[0017] Furthermore, the following steps are included: according to the operation steps in S1-4, the three parts of the memory compression process, the memory exchange process and the memory decompression process are triggered by a unified memory hotspot elimination scheduling system.

[0018] Further, the following steps are included: According to the operation steps in S2, the memory compression process includes

[0019] S201. Memory compression obtains access status of memory pages through an internal interface of the operating system, sorts the memory pages according to the number of times they have been recently accessed, and sets a fixed threshold.

[0020] S202: Mark a memory page whose recent access count is greater than a fixed threshold as an active memory page, for example, mark a memory page whose recent access count is greater than 3 as an active memory page.

[0021] S203: When the memory of the host machine reaches a certain hotspot threshold, compression is started from the memory page with the lowest number of recent accesses in the host machine memory according to the sorted memory page order.

[0022] S204: When the host machine memory usage is lower than the host machine memory hotspot threshold, the memory marked as active memory page does not perform memory compression operation.

[0023] Furthermore, the following steps are included: according to the operation steps in S3, the memory decompression process is divided into passive decompression and active decompression.

[0024] Furthermore, the following steps are included: according to the operation steps in S3, the passive decompression means that when a process on the host machine accesses a compressed memory page, the accessed memory page is decompressed.

[0025] Furthermore, the following steps are included: according to the operation steps in S3, when the host machine memory usage is greater than the total host machine memory, the memory decompression program triggers the operating system to force memory recovery or memory swap to the SWAP partition to ensure that the host machine memory can support the decompression operation of the accessed memory page.

[0026] Furthermore, the following steps are included: according to the operation steps in S3, the host machine memory usage is less than the total host machine memory and greater than the host machine memory hotspot threshold. At this time, the memory decompression program triggers the memory compression program to eliminate the memory hotspot of the current host machine.

[0027] Further, the following steps are included: according to the operation steps in S3, the host machine memory usage is less than the host machine memory hotspot threshold, and no additional operation is required.

[0028] Furthermore, the following steps are included: according to the operation steps in S3, the active decompression means that when there are compressed memory pages in the host memory, if the host memory occupancy is lower than the host memory hotspot threshold, then while ensuring that the host memory occupancy is less than the host memory hotspot threshold, the compressed memory pages are decompressed in descending order according to the number of recent accesses, until all compressed memories are decompressed or the memory hotspot threshold is reached.

[0029] Further, according to the operation steps in S4, the memory exchange process includes:

[0030] S401. Memory exchange uses the host memory information to classify the host's available memory pool according to access latency. For example, DRAM with the lowest access latency is classified as the first-level memory, PMem with the second-lowest access latency is classified as the second-level memory, and so on.

[0031] S402: Obtain the host machine memory pool classification information, and provide a host machine memory page (including compressed memory) allocation scheme on different levels of memory in a manner that prioritizes loading memory with lower access latency from most recent access times to least recent access times.

[0032] S403: Compare the allocation of the host machine's current memory pages on different levels of memory, and perform memory swapping on memory pages that need to be adjusted, so that memory pages with a higher number of recent accesses are stored on memory with a lower access latency.

[0033] The present invention provides a method for eliminating memory hotspots based on memory grading and memory compression, which has the following beneficial effects:

[0034] (1) The memory hotspot elimination method proposed in the present invention can achieve closed-loop memory hotspot elimination of a single host machine within a certain range, avoiding the virtual machine migration failure that may occur in traditional virtual machine scheduling and ensuring the security of user services.

[0035] (2) The memory hotspot elimination method proposed in the present invention only involves the process call of the host machine, and can achieve a certain degree of host machine memory hotspot elimination within milliseconds. Compared with the traditional virtual machine scheduling method that requires memory hotspot elimination in seconds or minutes, it greatly reduces the delay of memory hotspot elimination and ensures the stability of user services.

[0036] (3) The memory hotspot elimination method proposed in the present invention optimizes the memory page distribution through memory grading, which can better improve the memory utilization efficiency of the host machine. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] FIG1 is a schematic diagram of the architecture of a method for eliminating memory hotspots based on memory grading and memory compression according to the present invention;

[0038] FIG2 is a flow chart of a method for eliminating memory hotspots based on memory classification and memory compression according to the present invention. DETAILED DESCRIPTION

[0039] In order to make the objectives, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below with reference to specific embodiments.

[0040] Example 1, please refer to Figure 1-2: A method for eliminating memory hotspots based on memory classification and memory compression, including the following steps:

[0041] Step 1: Memory compression obtains the access status of memory pages through the internal interface of the operating system, sorts the memory pages according to the number of times they have been recently accessed, and sets a fixed threshold. Memory pages with a recent access count greater than the fixed threshold are marked as active memory pages. For example, memory pages with a recent access count greater than 3 are marked as active memory pages. When the host machine's memory reaches a certain hotspot threshold, compression starts from the memory page with the lowest recent access count in the host machine's memory according to the sorted memory page order, until the host machine's memory occupancy is lower than the host machine's memory hotspot threshold. The memory marked as active memory page does not perform memory compression operations.

[0042] Step 2: Memory Swapping: Using host memory information, the host's available memory pool is classified according to access latency. For example, DRAM, with the lowest access latency, is classified as first-level memory, and PMem, with the next lowest access latency, is classified as second-level memory. This hierarchy is then used to determine the host memory pool. A plan is then developed to allocate host memory pages (including compressed memory) across different memory levels, prioritizing the most recently accessed memory. The allocation of the host's current memory pages across different memory levels is compared, and memory pages that require adjustment are swapped. This allows pages with higher recent access counts to be stored in memory with lower access latency. PMem (persistent memory) can be considered second-level memory. It is a non-volatile memory that retains stored data even after the computer is shut down. Compared to traditional RAM (random access memory), PMem has higher storage density and faster access speeds. The emergence of PMem allows computers to access and manipulate large amounts of data more quickly while reducing the risk of data loss. It is widely used in application scenarios that require high performance and persistence, such as high-performance computing, data centers, and databases. Although PMem has many advantages, its manufacturing cost is relatively high and it cannot currently completely replace traditional RAM. Therefore, PMem is often used as a second-level memory, working alongside traditional RAM to provide higher system performance and larger storage capacity.

[0043] Step 3: The memory hotspot elimination scheduling system monitors the host machine's memory status in real time. When the host machine's memory usage is greater than the host machine's memory hotspot threshold, memory compression is triggered to compress the inactive memory pages in the host machine. When the compressed memory in the host machine is accessed by a process or there are compressed pages on the host machine and the host machine's memory usage is less than the host machine's memory hotspot threshold, memory decompression is triggered to decompress the host machine's compressed memory. A memory swap timing interval is set to trigger memory swap at fixed intervals, such as triggering memory swap once every 1 second, to swap different levels of host machine memory.

[0044] Step 4: Memory decompression is divided into passive decompression and active decompression.

[0045] Passive decompression means that when a process on the host machine accesses a compressed memory page, the accessed memory page is decompressed. After the accessed memory page is decompressed, it can be divided into three situations.

[0046] The host machine's memory usage is greater than the total host machine memory. At this time, the memory decompression program triggers the operating system to force memory recovery or memory swap to the SWAP partition to ensure that the host machine's memory can support the decompression operation of the accessed memory page. The SWAP partition is a special hard disk space, also known as virtual memory. When the physical memory is insufficient, it can virtualize a part of the hard disk space into memory, thereby solving the problem of insufficient memory capacity. The size of the SWAP partition is generally set to twice the size of the physical memory, but it can also be adjusted according to actual conditions. In the Linux operating system, the SWAP partition can be used as an extension of the memory. When the physical memory is exhausted, the system will automatically use the SWAP partition to replace the physical memory to maintain the stable operation of the system. The advantages of the SWAP partition mainly include: Expanded memory space: The SWAP partition can be used as an extension of the memory. When the physical memory is insufficient, a part of the hard disk space can be virtualized into memory, thereby solving the problem of insufficient memory capacity and improving system performance: By using the SWAP partition, the problem of system performance degradation caused by insufficient memory can be reduced. When physical memory is exhausted, the system automatically uses the SWAP partition to replace physical memory to maintain stable system operation. It reduces costs: Compared with adding physical memory, creating a SWAP partition is less expensive because the SWAP partition is virtual memory using hard disk space, requiring no additional hardware costs. It also enhances stability: The SWAP partition can help the system be more stable when encountering problems such as memory overflow. When physical memory is insufficient, the system automatically uses the SWAP partition, thus avoiding system crashes or data loss caused by memory problems.

[0047] The host machine's memory usage is less than the host machine's total memory but greater than the host machine's memory hotspot threshold. At this time, the memory decompression program triggers the memory compression program to eliminate the memory hotspot of the current host machine.

[0048] The host memory usage is less than the host memory hotspot threshold, and no additional operation is required.

[0049] Active decompression means that when there are compressed memory pages in the host memory, if the host memory usage is lower than the host memory hotspot threshold, the compressed memory pages are decompressed in descending order according to the number of recent accesses, while ensuring that the host memory usage is lower than the host memory hotspot threshold, until all compressed memory is decompressed or the memory hotspot threshold is reached.

[0050] While embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions, and variations may be made to these embodiments without departing from the principles and spirit of the invention, and that the scope of the invention is defined by the appended claims and their equivalents.

Claims

1. A method for eliminating memory hot spots based on memory classification and memory compression, characterized in that: Including steps such as, S1, the memory hotspot elimination scheduling system monitors the host machine memory status in real time; S2. When the host machine's memory usage is greater than the host machine's memory hotspot threshold, the memory compression process is triggered to compress the inactive memory pages in the host machine. S3. When the compressed memory in the host is accessed by a process or there is a compressed page on the host and the host memory usage is less than the host memory hotspot threshold, the memory decompression process is triggered to decompress the compressed memory of the host; S4. Set a memory exchange timing interval to trigger the memory exchange process at a fixed time interval, such as triggering a memory exchange once every 1 second, and exchange different levels of memory on the host machine.

2. The method for eliminating memory hot spots based on memory classification and memory compression according to claim 1, characterized in that: The following steps are involved: According to the operation steps in S1-4, the three parts of the memory compression process, the memory exchange process and the memory decompression process are triggered by a unified memory hotspot elimination scheduling system.

3. The method for eliminating memory hot spots based on memory classification and memory compression according to claim 1, characterized in that: The following steps are involved: According to the operation steps in S2, the memory compression process includes: S201, memory compression obtains access status of memory pages through an internal interface of the operating system, sorts the memory pages according to the number of times they have been recently accessed, and sets a fixed threshold; S202, marking a memory page whose recent access count is greater than a fixed threshold as an active memory page, such as marking a memory page whose recent access count is greater than 3 as an active memory page; S203, when the memory of the host machine reaches a certain hotspot threshold, compression starts from the memory page with the lowest number of recent accesses in the host machine memory according to the sorted memory page order; S204: When the host memory usage is lower than the host memory hotspot threshold, the Memory compression is not performed on memory that is an active memory page.

4. The method for eliminating memory hot spots based on memory classification and memory compression according to claim 1, characterized in that: The following steps are involved: According to the operation steps in S3, the memory decompression process is divided into passive decompression and active decompression.

5. The method for eliminating memory hot spots based on memory classification and memory compression according to claim 1, characterized in that: The following steps are involved: According to the operation steps in S3, the passive decompression means that when a process on the host machine accesses a compressed memory page, the accessed memory page is decompressed.

6. The method for eliminating memory hot spots based on memory classification and memory compression according to claim 1, characterized in that: The following steps are involved: According to the operation steps in S3, when the host machine memory usage is greater than the total host machine memory, the memory decompression program triggers the operating system to force memory recovery or memory swap to the SWAP partition to ensure that the host machine memory can support the decompression operation of the accessed memory page.

7. The method for eliminating memory hot spots based on memory classification and memory compression according to claim 1, characterized in that: The following steps are involved: According to the operation steps in S3, the host machine memory usage is less than the total host machine memory and greater than the host machine memory hotspot threshold. At this time, the memory decompression program triggers the memory compression program to eliminate the memory hotspot of the current host machine.

8. The method for eliminating memory hot spots based on memory classification and memory compression according to claim 1, characterized in that: The following steps are involved: According to the operation steps in S3, the host machine memory usage is less than the host machine memory hotspot threshold, and no additional operation is required.

9. The method for eliminating memory hot spots based on memory classification and memory compression according to claim 1, characterized in that: The following steps are involved: According to the operation steps in S3, the active decompression means that when there are compressed memory pages in the host memory, if the host memory occupancy is lower than the host memory hotspot threshold at this time, then while ensuring that the host memory occupancy is less than the host memory hotspot threshold, the compressed memory pages are decompressed in descending order according to the number of recent accesses until all compressed memory is decompressed or the memory hotspot threshold is reached.

10. The method for eliminating memory hot spots based on memory classification and memory compression according to claim 1, characterized in that: The following steps are involved: According to the operation steps in S4, the memory exchange process includes: S401, memory exchange classifies the available memory pool of the host machine according to the access delay through the host machine memory information, such as DRAM with the lowest access delay is classified as the first-level memory, PMem with the second highest access delay is classified as the second-level memory, and so on; S402, obtaining the hierarchical information of the host machine memory pool, and providing the allocation scheme of the host machine memory pages (including compressed memory) on different levels of memory in a manner of preferentially loading the memory with lower access latency in descending order of the number of recent accesses; S403: Compare the allocation of the current memory pages of the host machine on the memories of different levels, and perform memory swapping on the memory pages that need to adjust the memory distribution, so that the memory pages with higher recent access times are stored on the memory with lower access latency.

Citation Information

Patent Citations

  • Virtual machine memory optimization processing method and related device

    CN111651236A

  • Virtual machine memory allocation method and device, equipment and storage medium

    CN115454578A

  • Memory exchange method and device, computer equipment and storage medium

    CN116204309A

  • Blackbox security for containers

    US20210012011A1

Cited By

  • Memory resource management and control method and system, vehicle-mounted terminal and storage medium

    CN119603305A

  • Memory management method and device based on cloud management platform

    CN121705002A