Apache Ignite-based SLRU page replacement algorithm optimization method
By improving the SLRU data structure and heat model, and combining heat threshold and dynamic decay mechanism, the flexibility and concurrency performance issues of the SLRU algorithm in complex scenarios are solved, and efficient cache management and resource utilization are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- PICC INFORMATION TECH CO LTD
- Filing Date
- 2025-12-12
- Publication Date
- 2026-05-08
AI Technical Summary
Existing SLRU page replacement algorithms suffer from insufficient flexibility, inaccurate heat identification, and limited concurrency performance when facing complex and ever-changing business scenarios, leading to cache pollution and wasted memory resources.
An improved SLRU data structure and heat model are constructed. Access frequency is recorded through an independent page heat table. Combined with heat thresholds and dynamic heat decay mechanisms, non-hot data can be accurately filtered. The capacity ratio between trial and protection segments is optimized through an adaptive ratio adjustment strategy.
It improves cache hit rate, reduces cache pollution, enhances memory resource utilization and concurrency performance, ensures high-frequency data is stored in protected segments, and reduces memory overhead and lock contention.
Smart Images

Figure CN121996583A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of distributed caching and in-memory computing technology, specifically to an optimization method for the SLRU page replacement algorithm based on Apache Ignite. Background Technology
[0002] Apache Ignite, as a memory-centric distributed database and computing platform, relies heavily on the efficiency of its in-memory data management for performance. Given limited memory resources, page replacement algorithms determine which data pages should remain in the cache and which should be evicted to free up space. While the traditional Least Recently Used (LRU) algorithm is simple to implement, it can easily misinterpret low-frequency data as hot data and fill the cache when faced with full table scans or large-scale data accesses, causing truly high-frequency data to be evicted—a problem known as cache pollution. To mitigate this issue, the Segmented LRU (SLRU) algorithm is widely used. It logically divides the cache space into a trial segment and a protected segment. Data enters the trial segment upon its first access and is only promoted to the protected segment upon subsequent accesses, thus providing a degree of filtering.
[0003] However, existing SLRU algorithms still have significant limitations when facing complex and ever-changing real-world business scenarios. Traditional promotion mechanisms typically rely solely on simple access hit determination, lacking quantitative recording and fine-grained management of page access frequency, i.e., "popularity." This mechanism is susceptible to interference from sudden bursts of access within a short period, failing to accurately distinguish between short-term and long-term popularity, resulting in non-long-term hot data potentially being mixed into the protected segment. Simultaneously, existing popularity maintenance mechanisms often lack effective time-dimensional decay strategies, causing historically high-popularity data to continue occupying valuable space in the protected segment even after access ceases, failing to be promptly eliminated and resulting in "popularity lag." Furthermore, in high-concurrency environments, frequent updates to data page status information can easily trigger lock contention between threads, and traditional implementations often directly bind statistical information to data objects, increasing memory coupling and overhead.
[0004] On the other hand, existing SLRU implementations typically use static configuration for the capacity allocation between the trial and protection segments, such as a fixed 50 / 50 or a specific ratio. This static allocation cannot adapt to dynamically changing business load characteristics. In practical applications, the size of hot data is not constant. When the system faces a sudden increase in the size of the hot dataset, the fixed protection segment space may not be sufficient to accommodate all hot data, leading to frequent replacement of high-value data; conversely, when hot data is sparse, an excessively large protection segment quota can result in idle and wasted memory resources. This memory allocation method, lacking adaptive adjustment capabilities, struggles to maintain a stable cache hit rate under fluctuating access patterns, thus limiting the overall throughput performance of the system. Summary of the Invention
[0005] To address the shortcomings of existing technologies, this invention provides an optimization method for the SLRU page replacement algorithm based on Apache Ignite, which solves the problems of insufficient flexibility, inaccurate hot identification, and limited concurrency performance of existing cache replacement algorithms when facing complex access patterns.
[0006] To achieve the above objectives, this invention provides the following technical solution: an optimization method for the SLRU page replacement algorithm based on Apache Ignite. First, an improved SLRU data structure and a popularity model are constructed. This data structure is logically divided into a trial segment and a protection segment to distinguish data pages with different popularity levels. Simultaneously, a page popularity table is established, which directly maps to the identifiers of data pages through array subscript indices. This makes the storage of popularity data independent of data page objects, thereby reducing direct intrusion into data objects and memory overhead.
[0007] During system operation, in response to access requests for data pages, the system updates the target page's popularity value in the page popularity table in real time and performs page replacement judgment based on this updated popularity value. The specific replacement judgment logic depends on the logical segment type to which the target page currently belongs. When the target page is in the trial segment and the protection segment is already fully loaded, the system performs an admission condition judgment. This admission condition requires that the target page's popularity value must reach a certain standard, specifically greater than or equal to the popularity value of the protection segment header page, or greater than or equal to the current average popularity value of the protection segment. The average popularity value of the protection segment is calculated by dividing the global protection segment popularity statistics variable maintained by the system in real time by the current number of pages in the protection segment. Only when the above admission conditions are met will the system perform an inter-segment replacement operation, moving the data page from the protection segment header to the trial segment and promoting the target page to the tail of the protection segment; if the conditions are not met, the target page is only moved to the tail of the trial segment without cross-segment promotion.
[0008] When accessing a page within a protected segment, the system uses the popularity value of the last page in the protected segment as a reference and compares the popularity value of the target page with that of the last page. Only if the popularity value of the target page is greater than or equal to that of the last page in the protected segment is the target page moved to the end of the protected segment; otherwise, the target page remains in its current position within the protected segment. This mechanism avoids frequent linked list operations for low-population increments, reducing maintenance overhead.
[0009] The system monitors the local access volume counter and the previous decay timestamp in real time. Once the local access volume counter reaches a preset access volume threshold, or the difference between the current system time and the previous decay timestamp reaches a preset time interval threshold, the system determines that heat decay has been triggered. During the decay process, the system first calculates the protection segment hit rate within the current period and then calculates the proportion coefficient of retained heat based on this hit rate. This proportion coefficient is positively correlated with the protection segment hit rate; that is, the higher the hit rate, the higher the proportion of retained heat. The specific calculation logic is as follows: the protection segment hit rate is weighted using a preset maximum decay upper limit constant to obtain the proportion coefficient. Subsequently, the system traverses the page heat table, multiplies the original heat value of each data page by the proportion coefficient, and truncates the calculation result to an integer before writing it back to the page heat table as the new heat value. To solve the performance bottleneck during concurrent updates, during the traversal process, the system uses thread-local variables to accumulate and calculate the new total heat of protection segments. After the traversal is completed, the accumulated thread-local variables are used to update the global protection segment heat statistics variable all at once.
[0010] The system monitors the hit rate and current capacity percentage of the protected segment. When the hit rate is lower than the preset reduction threshold and the current protected segment percentage is higher than the minimum percentage threshold, a reduction operation is performed; conversely, when the hit rate is higher than the increase threshold and the percentage is lower than the maximum percentage threshold, an increase operation is performed. The target expansion ratio increases with the increase of the protected segment hit rate, and the target contraction ratio increases with the decrease of the protected segment hit rate. When performing a reduction operation, the system multiplies the total capacity of cached pages in memory by the target contraction ratio to calculate the number of pages to be reduced. Then, starting from the head of the protected segment, the corresponding number of data pages are retrieved sequentially, moved to the tail of the protected segment, and the metadata tags of these pages are reset, thereby achieving dynamic adaptive adjustment of the cache structure.
[0011] The present invention also provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the above-described optimization method for the SLRU page replacement algorithm based on Apache Ignite.
[0012] This invention provides an optimization method for the SLRU page replacement algorithm based on Apache Ignite. It has the following beneficial effects: 1. This invention effectively reduces cache pollution caused by occasional access by constructing an array-type heat table independent of data objects and combining it with a strict admission judgment mechanism based on heat thresholds. The system only allows pages with heat values higher than the header or average level of the protection segment to be promoted to the protection segment, thereby accurately filtering non-hot data and ensuring that the protection segment stores truly high-frequency access data; at the same time, using an array of basic data types to store heat information avoids intrusion into the original data page objects and reduces memory overhead.
[0013] 2. This invention solves the problem of historically high-demand data occupying cache resources for a long time by introducing a dynamic popularity decay mechanism driven by both time and access volume. The system can dynamically calculate the decay rate based on the real-time protection segment hit rate, enabling the popularity value of cached pages to sensitively reflect the current access trend and promptly evict outdated data. In addition, the use of thread-local variables for accumulation during the statistical update process reduces lock contention for global statistical variables and improves the execution efficiency of the algorithm in high-concurrency environments.
[0014] 3. This invention achieves dynamic optimization of the capacity ratio between the trial segment and the protected segment through an adaptive proportional adjustment strategy based on load feedback. The system automatically calculates the extent of expansion or contraction based on the real-time monitored hit rate of the protected segment. When the hit rate increases, the protected segment quota is increased; when the hit rate decreases, resources are released to the trial segment. This mechanism breaks the limitation of fixed segment ratios in traditional algorithms, allowing memory resource allocation to adjust according to changes in actual business load, thereby maximizing cache space utilization. Attached Figure Description
[0015] Figure 1 This is a flowchart of the method of the present invention; Figure 2 This is a schematic diagram illustrating the construction of the improved SLRU data structure and heat model of the present invention; Figure 3 This is a schematic diagram illustrating the principle of the admission replacement mechanism based on heat threshold of the present invention; Figure 4 This is a schematic diagram of the dynamic heat decay process driven by the two factors of the present invention. Figure 5 This is a schematic diagram of the adaptive proportional adjustment process based on load feedback according to the present invention.
[0016] Figure 6 This is a schematic diagram of the computer device structure of the present invention.
[0017] Among them, 40 is computer equipment; 41 is processor; 42 is memory; and 43 is storage medium. Detailed Implementation
[0018] The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0019] See attached document Figure 1 , Figure 1 This is a flowchart illustrating an optimization method for the SLRU page replacement algorithm based on Apache Ignite according to an embodiment of the present invention. The present invention addresses the memory pollution problem caused by sequential scanning in Apache Ignite under persistent storage mode due to physical pages containing multiple data entries, and provides an improved page replacement strategy. The method mainly includes the following steps: S1. Construct an improved SLRU data structure based on the heat attribute: establish a logically segmented doubly linked list in memory, and construct a global page heat table independent of the linked list to record the access frequency of physical pages. S2, Real-time updates of page access and popularity: During the data access process, the popularity value of the target page is updated in real time, and the popularity statistics of the protected segment are maintained. S3, Admission replacement decision based on popularity threshold: When a trial segment page is accessed, the popularity of the page is compared with the admission popularity threshold of the protection segment to determine whether to promote it to the protection segment, thereby filtering scanning traffic; S4, Execute dynamic popularity decay: Based on a dual trigger mechanism of local access volume or time interval, the page popularity is periodically decayed to prevent historical hot spots from becoming entrenched. S5, perform adaptive proportional adjustment: dynamically adjust the capacity ratio of the trial section and the protection section based on the real-time hit rate feedback of the protection section to adapt to different workloads.
[0020] The following section will provide a detailed explanation of each of the above steps and the core technical principles involved, in conjunction with specific implementation details and mathematical models.
[0021] See attached document Figure 2 , Figure 2 This is a schematic diagram of the data structure for an improved SLRU page replacement algorithm according to an embodiment of the present invention. The process of constructing the improved SLRU data structure specifically includes the following sub-steps: S11, establish a logically segmented doubly linked list structure.
[0022] In Apache Ignite's off-heap memory management architecture, the memory area used for caching data pages is logically divided into two contiguous segments: the probationary segment and the protected segment. Physically, all data pages are linked together by pointers to form a doubly linked list. The system maintains four key pointers to define the boundaries between these two segments: the probationary segment head pointer, the probationary segment tail pointer, the protected segment head pointer, and the protected segment tail pointer.
[0023] The successor node at the end of the trial segment points to the head of the protected segment, thus logically concatenating the two segments into a single ordered linked list. The trial segment stores newly written pages or pages that have not yet been verified as frequently accessed, while the protected segment stores high-value, frequently accessed pages that have been filtered. During system initialization, the ratio of the number of pages in the trial segment to the number of pages in the protected segment is set to 1:1, meaning each segment occupies 50% of the total memory capacity. For the specific pointer operations and memory address mappings of the linked list nodes, those skilled in the art can refer to existing doubly linked list technology for implementation, and will not be elaborated upon here.
[0024] S12, construct a page popularity table independent of the linked list.
[0025] To record the access frequency of each data page in memory with low overhead, the system allocates a contiguous block of storage space in memory to construct a page heat map. This page heat map is specifically implemented using an integer array data structure, and the length of the array is consistent with the maximum number of pages that the Ignite memory region can hold.
[0026] This array establishes a direct mapping from physical pages to their degree values. Each data page has a unique Page-ID, which typically includes a Partition-ID and a Page-Index. The system directly determines the page's index in the integer array by extracting the feature values from the Page-ID and performing a linear offset calculation, rather than using a general hash algorithm that may cause collisions. The element at the corresponding index position in the array stores the page's degree value. Using an array structure instead of a hash table (HashMap) or object field to store the degree value is to leverage the spatial locality of CPU cache lines, ensuring that the operation of retrieving and updating any page degree value has a time complexity of O(1), avoiding performance losses caused by traversal or hash collisions.
[0027] Regarding specific storage overhead, Ignite's default page size is 4KB, while each element in the page heat table is an int type, occupying 4 bytes. Therefore, the additional memory overhead brought by introducing the page heat table is only about one-thousandth of the total memory capacity, which is feasible in engineering.
[0028] S13, Initialize the global heat statistics counter.
[0029] The system maintains a global statistical variable in memory to record the sum of the page popularity values of all pages in the protected segment in real time. To support concurrent access and updates in a multi-threaded environment, this statistical variable is implemented using the AtomicLong data type.
[0030] Meanwhile, the system maintains a real-time counter that records the current number of pages in the protected segment. This counter is updated synchronously when a page enters or leaves the protected segment to ensure that the time complexity of obtaining the number of pages is O(1).
[0031] This atomic counter works in conjunction with the page heat table to support the calculation of the average heat of the protected segment in subsequent steps. The current number of pages in the protected segment is defined as... The total heat recorded by the atomic counter is The average heat of the protection section Calculated using the following formula: ; in, and All values are real-time values that change with system operation. By maintaining a global counter and a quantity counter, the system can directly obtain heat statistics characteristics without traversing all pages of the protected segment for each decision.
[0032] See attached document Figure 3 , Figure 3 This is a schematic diagram of the SLRU algorithm data structure incorporating heat attribute optimization according to an embodiment of the present invention. The process of performing heat threshold admission permutation based on this data structure specifically includes the following sub-steps: S21 executes real-time updates of page popularity and global statistics maintenance.
[0033] When the system receives an access request for any physical page, it locates the corresponding position in the page popularity table based on the page identifier. It reads the current popularity value, increments it by one, and writes the updated result back to the array. To prevent the popularity value from increasing indefinitely and causing integer overflow, a popularity upper limit constant (e.g., the maximum value of an integer) is set; once the popularity value reaches this upper limit, it stops increasing.
[0034] If the currently accessed page is located within a protected segment, the system updates the page's own popularity score while simultaneously updating the global popularity statistics counter via an atomic increment operation, incrementing the total popularity score of the protected segment by one. This step ensures that the average popularity score of the protected segment always reflects the latest memory status, providing real-time basis for subsequent access control decisions.
[0035] S22, execute the admission decision and replacement operation for the trial page.
[0036] When the accessed page is in the trial segment and is hit, the system first checks whether the current number of pages in the protected segment has reached the preset capacity limit.
[0037] If the protected segment is not full, disconnect the page's pointers from the trial segment, move it and insert it at the end of the protected segment (the most recently used end), and update the boundary pointers of both the trial and protected segments.
[0038] If the protection segment is full, an access competition logic based on a popularity threshold is triggered. The system obtains the popularity value of the protection segment header (least recently used terminal) page and records it as follows. Simultaneously, read the global heat statistics counter and the number of pages in the protected segment, calculate the current average heat of the protected segment, and record it as . The system will target the page's popularity score. The comparison is performed using the two eigenvalues mentioned above, following the admission criteria defined by the formula below. : ; The formula indicates that as long as the popularity of the hit page is not lower than that of the header page of the protected section, or not lower than the average popularity of the protected section, the page is deemed to meet the promotion qualification.
[0039] If the above admission criteria are met Perform inter-segment replacement operation: move the page at the head of the protected segment out and insert it at the tail of the trial segment, and clear its corresponding protected segment mark; at the same time, move the currently hit trial segment page to the tail of the protected segment and set its protected segment mark.
[0040] If the above eligibility criteria are not met If the access is determined to be an occasional scan or low-value traffic, the structure of the protected segment remains unchanged, and only the currently hit page is moved to the end of the trial segment. Through this mechanism, low-frequency sequential scan data is restricted to circulating or being discarded within the trial segment, preventing contamination of high-value data in the protected segment.
[0041] If the above eligibility criteria are not met If the access is determined to be an occasional scan or low-value traffic, the structure of the protected segment remains unchanged, and only the currently hit page is moved to the end of the trial segment. Through this mechanism, low-frequency sequential scan data is restricted to circulating or being discarded within the trial segment, preventing contamination of high-value data in the protected segment.
[0042] S23, perform local sorting optimization within the protected segment. When the accessed page already exists in the protected segment, to reduce the performance overhead caused by frequently adjusting linked list pointers, a local comparison strategy is used instead of full sorting. The system obtains the popularity value of the last page in the protected segment, denoted as... The popularity value of the currently hit page. and Compare. Only when If the page is in an optimal position, it is detached from its current location and moved to the end of the protection segment. Otherwise, the page's position in the linked list remains unchanged. This step utilizes the approximate order of the LRU linked list, reducing the frequency of pointer operations within the protection segment while ensuring that high-frequency data is roughly located at the MRU end.
[0043] See attached document Figure 4 , Figure 4 This is a schematic diagram of a dynamic heat decay process according to an embodiment of the present invention. The process of performing two-factor driven dynamic heat decay specifically includes the following sub-steps: S41 monitors and determines the trigger conditions for heat decay. During operation, the system maintains a local access counter and the last decay timestamp in real time. The system presets two corresponding trigger thresholds: access threshold... and time interval threshold Each time a data page access event occurs, the system increments the local access counter and checks if the current value is greater than or equal to the access threshold. Simultaneously, the system calculates the difference between the current system time and the previous decay timestamp and checks if this difference is greater than or equal to the time interval threshold. When either of these conditions is met, the system triggers heat decay and proceeds to the next calculation. This logical OR triggering mechanism can accommodate both on-demand triggering under high load and time-based triggering under low load.
[0044] S42, calculate the dynamic attenuation coefficient based on the protection section hit rate. The system counts the number of times the protection section is hit within the cycle. and the total number of accesses processed by the system And calculate the protection segment hit rate. Define the maximum upper limit constant of decay as This parameter controls the maximum reduction in calorific value. The system calculates the current attenuation ratio based on the following formula. : ; in, This represents the proportionality coefficient for heat retention. This represents the protection segment hit rate within the current statistical period. This is a preset constant (e.g., 0.7). According to this formula, the attenuation ratio coefficient ratio is positively correlated with the protection segment hit rate; that is, the higher the hit rate, the larger the proportion retained, and the smaller the attenuation magnitude.
[0045] S43, execute full heat reduction and state reset.
[0046] Determining the attenuation ratio coefficient Then, the system initiates a traversal of the page heat table. To reduce concurrent write contention to global atomic variables, the system uses thread-local variables to accumulate the new total heat of protected segments during the traversal process.
[0047] For each data page in the popularity table, read its current original popularity value. And calculate the new heat value according to the following formula. : ; in, The new heat value after decay. This is the original heat value before decay. The calculation result is truncated to an integer using a type cast and then written back to the heat table.
[0048] After the traversal is complete, the system updates the global protected segment heat statistics variable once using the accumulated local variables. Subsequently, the system updates the local access counter, as well as Reset to 0 and update the last decay timestamp to the current system time.
[0049] See attached document Figure 5 , Figure 5 This is a schematic diagram of an adaptive scaling adjustment process according to an embodiment of the present invention. The process of performing adaptive scaling adjustment based on load feedback specifically includes the following sub-steps: S51, monitoring the triggering conditions for proportional adjustment and the status of the protection section.
[0050] The system uses a two-factor driven logic to trigger ratio adjustments, and monitors the cumulative local access volume and the time interval since the last adjustment in real time. When any indicator reaches the preset trigger threshold, the ratio adjustment process is initiated.
[0051] After startup, the system counts the number of protection segment hits and the total number of accesses within the current period, and calculates the protection segment hit rate. Meanwhile, the proportion of the number of pages read from the current protected segment to the total number of pages in memory is denoted as... The system has four pre-set configuration parameters: hit rate reduction threshold. (e.g., 0.1) Hit rate threshold adjustment (e.g., 0.3) Minimum proportional threshold for the protection segment (e.g., 0.1) and the maximum proportional threshold of the protection segment (e.g., 0.8). These parameters define the adaptive adjustment boundaries of the algorithm.
[0052] S52, determine the adjustment strategy and calculate the dynamic adjustment range.
[0053] The system determines whether to implement an expansion or reduction strategy based on the current protection segment hit rate and percentage status: and The operation was determined to be a downsizing (shrinkage) to free up protected segment space to accommodate new trial pages.
[0054] like and The operation is identified as an increase (expansion) to increase the capacity of the protected segment and thus cache more frequently accessed data.
[0055] After determining the strategy, the system dynamically calculates the adjustment range based on the protection section hit rate. The proportional adjustment baseline step size constant is defined as follows: (Default value is 0.1). For upward adjustments, calculate the increase ratio. : ; For downward adjustments, calculate the reduction percentage. : ; in, To achieve the target expansion ratio; The target reduction ratio; By introducing As a weighting factor, the increase in the adjustment range is larger when the hit rate is high, in order to adapt to the trend of enhanced access locality; when the hit rate is low, the decrease in the adjustment range is larger, in order to accelerate the elimination of low-value pages.
[0056] S53 performs linked list reconstruction and page migration.
[0057] The system updates the target capacity value of the protected section based on the calculated adjustment ratio.
[0058] If an upward adjustment is performed, calculate the newly added capacity quota. (Round down) and add it to the current maximum capacity limit of the protected segment. There's no need to migrate the page immediately at this point; it will be done later when the trial segment page is hit. Upon promotion, the newly added capacity space will be automatically filled.
[0059] If the operation is a reduction, calculate the number of pages that need to be reduced. The calculation formula is: ; in, This represents the total capacity of cached pages in memory. Subsequently, the system retrieves pages sequentially, starting from the header of the protected segment (the least recently used segment), through a loop. Each page is removed and moved to the end of the trial segment. The metadata tag of its segment is reset, and the linked list boundary pointer is updated. This process forcibly evicts the least popular pages in the protected segment, ensuring that the protected segment always retains a high-value set of data.
[0060] Please see the appendix Figure 6 The present invention also provides a computer device 40, including a processor 41 and a memory 42, wherein the memory 42 stores a computer program executable by the processor, and the computer program performs the method described above when executed by the processor.
[0061] The present invention also provides a storage medium 43 on which a computer program is stored, and the computer program is executed by a processor 41 to perform the method described above.
[0062] The storage medium 43 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read-Only Memory (EPROM), Programmable Red-Only Memory (PROM), Read-Only Memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.
Claims
1. An optimization method for the SLRU page replacement algorithm based on Apache Ignite, characterized in that, Includes the following steps: S1. Construct an improved SLRU data structure and a heat model. The improved SLRU data structure includes a trial segment and a protection segment with logical segmentation. The heat model includes a page heat table for recording the access frequency of data pages. S2, in response to an access request for a data page, update the popularity value of the target page in the page popularity table, and perform a page replacement determination based on the updated popularity value; S3, monitor the heat decay trigger condition, and when the condition is met, calculate the dynamic decay coefficient and perform a full reduction on all page heat values in the page heat table; S4, monitor the proportional adjustment trigger conditions. When the conditions are met, calculate the adjustment range based on the protection segment hit rate and dynamically adjust the capacity ratio of the trial segment and the protection segment. The page popularity table establishes a mapping relationship between array subscript indices and data page identifiers, and is stored independently of data page objects.
2. The SLRU page replacement algorithm optimization method based on Apache Ignite according to claim 1, characterized in that, Step S2 specifically includes: Determine the logical segment type to which the target page belongs; If the target page is located in the trial period and the protection period is full, then determine whether the popularity value of the target page meets the admission conditions. If the admission conditions are met, an inter-segment replacement operation is performed, moving the data page at the head of the protection segment to the trial segment and moving the target page to the tail of the protection segment; If the admission criteria are not met, the target page will simply be moved to the end of the trial segment.
3. The SLRU page replacement algorithm optimization method based on Apache Ignite according to claim 2, characterized in that, The admission criteria are: the popularity value of the target page is greater than or equal to the popularity value of the header page of the protected segment, or the popularity value of the target page is greater than or equal to the average popularity value of the protected segment. The average heat value of the protection segment is calculated by dividing the global protection segment heat statistics variable maintained by the system in real time by the current number of protection segment pages.
4. The SLRU page replacement algorithm optimization method based on Apache Ignite according to claim 1, characterized in that, Step S2 further includes: If the target page is located in the protection segment, then obtain the popularity value of the page at the end of the protection segment, and compare the popularity value of the target page with the popularity value of the page at the end of the protection segment; If the popularity value of the target page is greater than or equal to the popularity value of the page at the end of the protection segment, then the target page will be moved to the end of the protection segment. If the popularity value of the target page is less than the popularity value of the page at the end of the protection segment, then the current position of the target page in the protection segment remains unchanged.
5. The SLRU page replacement algorithm optimization method based on Apache Ignite according to claim 1, characterized in that, The process of monitoring the heat decay triggering condition in step S3 specifically includes: Maintain the local access count counter and the last decay timestamp in real time; Determine whether the value of the local access counter is greater than or equal to the access threshold, or whether the difference between the current system time and the previous decay timestamp is greater than or equal to the time interval threshold. When any of the above conditions are met, it is determined that heat decay is triggered.
6. The SLRU page replacement algorithm optimization method based on Apache Ignite according to claim 1, characterized in that, The process of calculating the dynamic attenuation coefficient and performing a full reduction on all page popularity values in the page popularity table in step S3 specifically includes: Calculate the protection segment hit rate within the current period; The proportional coefficient of the retained heat is calculated based on the hit rate of the protection segment and the preset maximum attenuation constant. The proportional coefficient is positively correlated with the hit rate of the protection segment. The page popularity table is traversed, the original popularity value of each data page is multiplied by the ratio coefficient, and the calculation result is truncated to an integer and written back to the page popularity table as a new popularity value.
7. The SLRU page replacement algorithm optimization method based on Apache Ignite according to claim 6, characterized in that, The process of performing a full reduction on all page popularity values in the page popularity table also includes: During the process of traversing the page heat table, the new total heat of the protected segment is calculated by accumulating thread-local variables; After the traversal is complete, the accumulated thread-local variables are used to update the global protection segment heat statistics variable all at once.
8. The SLRU page replacement algorithm optimization method based on Apache Ignite according to claim 1, characterized in that, The process of calculating the adjustment range based on the protection segment hit rate in step S4 specifically includes: Determine whether the hit rate of the protection segment in the current cycle is lower than the hit rate reduction threshold and whether the current protection segment ratio is higher than the minimum protection segment ratio threshold. If so, determine that it is a reduction operation and calculate the target reduction ratio based on the hit rate of the protection segment. Determine whether the hit rate of the protection segment in the current cycle is higher than the hit rate adjustment threshold and whether the current protection segment ratio is lower than the maximum protection segment ratio threshold. If so, it is determined to be an adjustment operation, and the target expansion ratio is calculated based on the hit rate of the protection segment. The target expansion ratio increases with the increase of the protection segment hit rate, and the target reduction ratio increases with the decrease of the protection segment hit rate.
9. The SLRU page replacement algorithm optimization method based on Apache Ignite according to claim 8, characterized in that, The process of dynamically adjusting the capacity ratio of the trial segment and the protection segment in step S4 specifically includes: If the operation is determined to be an upward adjustment, the newly added capacity quota is calculated and added to the current maximum capacity limit of the protection segment; If it is determined to be a downsizing operation, the total capacity of cached pages in memory is multiplied by the target shrinkage ratio to calculate the number of pages that need to be reduced. Starting from the beginning of the protection segment, the data pages corresponding to the number of pages to be reduced are extracted sequentially, moved to the end of the trial segment, and the metadata tags of the extracted data pages are reset.
10. 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 computer program, it implements the method as described in any one of claims 1-9.