[feature](filecache)A 2Q-LRU mechanism for protecting hotspot data in the normal queue#57410
[feature](filecache)A 2Q-LRU mechanism for protecting hotspot data in the normal queue#57410wenzhenghu wants to merge 86 commits intoapache:masterfrom
Conversation
…' into normal_queue_cold_hot_seperation
ClickBench: Total hot run time: 27.96 s |
BE Regression && UT Coverage ReportIncrement line coverage Increment coverage report
|
|
run buildall |
|
run buildall |
Cloud UT Coverage ReportIncrement line coverage Increment coverage report
|
FE UT Coverage ReportIncrement line coverage `` 🎉 |
BE UT Coverage ReportIncrement line coverage Increment coverage report
|
BE Regression && UT Coverage ReportIncrement line coverage Increment coverage report
|
|
run buildall |
Cloud UT Coverage ReportIncrement line coverage Increment coverage report
|
TPC-H: Total hot run time: 28723 ms |
TPC-DS: Total hot run time: 183694 ms |
BE UT Coverage ReportIncrement line coverage Increment coverage report
|
BE Regression && UT Coverage ReportIncrement line coverage Increment coverage report
|
|
run buildall |
Cloud UT Coverage ReportIncrement line coverage Increment coverage report
|
TPC-H: Total hot run time: 29392 ms |
TPC-DS: Total hot run time: 184487 ms |
BE UT Coverage ReportIncrement line coverage Increment coverage report
|
|
run buildall |
FE UT Coverage ReportIncrement line coverage `` 🎉 |
TPC-H: Total hot run time: 28954 ms |
TPC-DS: Total hot run time: 184233 ms |
BE UT Coverage ReportIncrement line coverage Increment coverage report
|
BE Regression && UT Coverage ReportIncrement line coverage Increment coverage report
|
PR Objective
In this PR, We have introduced a segmented(hot-cold) LRU mechanism To make sure that frequently accessed (“hot”) pages remain in the filecache, even as read-ahead and full table/index scans bring in new blocks that might or might not be accessed afterward.
Implementation Description
Specifically, we split the NORMAL queue of the filecache into two LRU queues, which cache hot/young data and cold/old data respectively. (The design of the hot-cold LRU mechanism references the implementation of MySQL InnoDB's midpoint LRU. For details, please refer to the link.)
The hot data remains in the original NORMAL queue. A new cold data queue, COLD_NORMAL, is added. Data that originally entered the NORMAL queue will now first enter the COLD_NORMAL queue and can only be promoted to the NORMAL queue after meeting certain conditions(reside in COLD_NORMAL queue more than normal_queue_cold_time_ms before being accessed again).
During cache block eviction, the newly added COLD_NORMAL queue has an eviction priority between the DISPOSABLE queue and the NORMAL queue. It is important to note that cache blocks evicted from the NORMAL queue will not enter the COLD_NORMAL queue.
BE-Side Configuration Parameter
In terms of implementation, we have added three new BE configuration parameters:
enable_file_cache_normal_queue_2qlru (Boolean)
file_cache_2qlru_cold_blocks_percent (Double)
file_cache_2qlru_cold_blocks_promotion_ms (Integer)
Core Function Modifications
TPCH Test Results
The test results indicate that after enabling the cold-hot dual LRU feature, both the cache hit rate and query performance have improved, with a more significant performance improvement observed under low cache allocation ratios. The testing utilized the TPC-H benchmark. The result data is as follows:
TPCH 100 (about 25GB data should cache)
Compatibility-Related Implementation:
Related Old PR: #57353 , it is old draft pr
None
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)