Two-Stage Memory Compression for Swap Space Efficiency
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing computing devices face performance degradation during memory reclamation due to prioritizing compression speed over compression ratio, leading to delayed access and performance issues when using algorithms with high compression ratios for memory reclamation.
Innovation Solution
Implement a two-stage compression method where a high-speed compression algorithm is used initially to maintain performance during memory reclamation, followed by a secondary compression using an algorithm with a higher compression ratio when the CPU is idle, selectively targeting rarely accessed memory data for further compression to improve memory efficiency.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Quantity of substance
If a compression algorithm with high compression ratio is used during memory reclamation, then more memory space is available, but compression speed decreases and system performance degrades
Solution Approach 1:
The compression process is divided into two distinct stages: a first compression stage using a high-speed algorithm (e.g., LZ4) to quickly reduce memory pressure, and a second compression stage using a high-ratio algorithm (e.g., zstandard) to maximize space utilization. This segmentation allows the system to achieve both speed and compression ratio by performing each function in its optimal stage.
Solution Approach 2:
The first compression stage performs preliminary compression action using a fast algorithm to immediately reduce memory usage and create available space. This preliminary action prepares the data for subsequent secondary compression, ensuring that memory reclamation is achieved quickly while leaving room for optimization later.
2Productivity
If a compression algorithm with high compression speed is used during memory reclamation, then system performance is maintained, but compression ratio is low and less memory space is available
Solution Approach 1:
The compression process is divided into two distinct stages: a first compression stage using a high-speed algorithm (e.g., LZ4) to quickly reduce memory pressure, and a second compression stage using a high-ratio algorithm (e.g., zstandard) to maximize space utilization. This segmentation allows the system to achieve both speed and compression ratio by performing each function in its optimal stage.
Solution Approach 2:
The system performs compression actions periodically in two phases: initially using fast compression to address immediate memory pressure, then periodically applying secondary compression to maximize space utilization. This periodic action allows the system to balance between speed and compression ratio based on timing and memory conditions.
3Speed
If memory reclamation is performed quickly to maintain system performance, then response speed is high, but compression ratio is low and memory efficiency is reduced
Solution Approach 1:
The compression process is divided into two distinct stages: a first compression stage using a high-speed algorithm (e.g., LZ4) to quickly reduce memory pressure, and a second compression stage using a high-ratio algorithm (e.g., zstandard) to maximize space utilization. This segmentation allows the system to achieve both speed and compression ratio by performing each function in its optimal stage.
Solution Approach 2:
The first compression stage performs preliminary compression action using a fast algorithm to immediately reduce memory usage and create available space. This preliminary action prepares the data for subsequent secondary compression, ensuring that memory reclamation is achieved quickly while leaving room for optimization later.
Data Source
Figure 1
Figure 2
Figure 3
AI summary
A computing device and an operating method thereof are provided. The computing device includes a memory and a processor configured to: perform a first compression on a data object stored in the memory according to a first compression method, store the first compressed data object in a swap data storage area, and reclaim a portion of the memory in which the first compressed data object was stored; register information about the first compressed data object in a first management table; obtain the information about the first compressed data object from the first management table based on a usage ratio of the processor; and perform a second compression on the first compressed data object according to a second compression method, store the second compressed data object in the swap data storage area, and reclaim a portion of the swap data storage area in which the first compressed data object was stored.