-
Notifications
You must be signed in to change notification settings - Fork 3.3k
feat: add time based eviction to data managed by cachinglayer #43490
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
7714da9
to
41f5a6e
Compare
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: zhengbuqian The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@zhengbuqian cpu-e2e job failed, comment |
@zhengbuqian go-sdk check failed, comment |
@zhengbuqian cpp-unit-test check failed, comment |
rerun cpp-unit-test |
rerun go-sdk |
/run-cpu-e2e |
rerun go-sdk |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #43490 +/- ##
==========================================
- Coverage 78.94% 78.94% -0.01%
==========================================
Files 1566 1567 +1
Lines 224453 224778 +325
==========================================
+ Hits 177205 177456 +251
- Misses 40834 40896 +62
- Partials 6414 6426 +12
🚀 New features to boost your workflow:
|
@zhengbuqian cpp-unit-test check failed, comment |
@zhengbuqian cpu-e2e job failed, comment |
@zhengbuqian go-sdk check failed, comment |
rerun go-sdk |
/run-cpu-e2e |
rerun cpp-unit-test |
41f5a6e
to
bf89009
Compare
@zhengbuqian go-sdk check failed, comment |
@zhengbuqian cpp-unit-test check failed, comment |
@zhengbuqian cpu-e2e job failed, comment |
bf89009
to
5a843d3
Compare
@zhengbuqian cpu-e2e job failed, comment |
Signed-off-by: Buqian Zheng <[email protected]>
Signed-off-by: Buqian Zheng <[email protected]>
5a843d3
to
5ddb0db
Compare
@zhengbuqian go-sdk check failed, comment |
@zhengbuqian cpu-e2e job failed, comment |
@zhengbuqian cpp-unit-test check failed, comment |
rerun cpp-unit-test |
/run-cpu-e2e |
rerun go-sdk |
@zhengbuqian cpu-e2e job failed, comment |
@zhengbuqian cpp-unit-test check failed, comment |
@zhengbuqian go-sdk check failed, comment |
@@ -2842,6 +2842,7 @@ type queryNodeConfig struct { | |||
TieredCacheTouchWindowMs ParamItem `refreshable:"false"` | |||
TieredEvictionIntervalMs ParamItem `refreshable:"false"` | |||
TieredLoadingMemoryFactor ParamItem `refreshable:"false"` | |||
CacheCellUnaccssedSurvivalTime ParamItem `refreshable:"false"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one typo: CacheCellUnaccssedSurvivalTime
-> CacheCellUnaccessedSurvivalTime
// Combine with logical eviction target (take the maximum) | ||
eviction_target.memory_bytes = std::max( | ||
eviction_target.memory_bytes, physical_eviction_needed); | ||
eviction_target.memory_bytes = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should eviction_target.file_bytes
and min_eviction.file_bytes
be updated here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
absolutely!
// we only need to evict for logical limit and we have succeeded. | ||
break; | ||
} | ||
|
||
if (physical_eviction_needed = checkPhysicalMemoryLimit(size); | ||
physical_eviction_needed == 0) { | ||
if (physical_eviction_needed = checkPhysicalResourceLimit(size); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since physical memory usage fluctuates over time, should min_eviction be set as a multiple of physical_eviction_needed?
This could handle the case where the minimum amount of evicted memory is immediately reused by another process outside the caching layer's control.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in checkPhysicalResourceLimit
we already multiplied size by the loading factor
@@ -144,12 +145,12 @@ DList::reserveMemoryInternal(const ResourceUsage& size) { | |||
"still need to evict {}", | |||
size.ToString(), | |||
evicted_size.ToString(), | |||
FormatBytes(physical_eviction_needed)); | |||
physical_eviction_needed.ToString()); | |||
} | |||
|
|||
// Reserve resources (both checks passed) | |||
used_memory_ += size; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After introducing disk resource reservation, used_memory_
seems confusing. What about used_resource_
or another appropriate name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sounds fair, done
@@ -269,7 +269,8 @@ DList::tryEvict(const ResourceUsage& expected_eviction, | |||
ResourceUsage actively_pinned{0, 0}; | |||
|
|||
// accumulate victims using expected_eviction. | |||
for (auto it = tail_; it != nullptr; it = it->next_) { | |||
ListNode* it = nullptr; | |||
for (it = tail_; it != nullptr; it = it->next_) { | |||
if (!would_help(it->size())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should these skipped it
be considered expired items?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't know, they may be pinned, or not pinned.
why?
Signed-off-by: Buqian Zheng <[email protected]>
issue: #41435
also added disk capacity protection