Repository navigation
fix: keep meta cache out of rss pressure eviction (#24648) - #24662
Conversation
## What type of PR is this? - [ ] API-change - [ ] BUG - [x] Improvement - [ ] Documentation - [ ] Feature - [x] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Refs matrixorigin#24644 ## What this PR does / why we need it: This PR implements Step 1 and Step 2 of the RSS cache pressure optimization plan: - keep objectio meta cache out of RSS forced eviction - stop setting RSS pressure admission targets on objectio meta cache - keep RSS pressure eviction focused on fileservice memory/data caches - allow pressure admission for data cache ghost hits by evicting cold data first - keep cold one-shot data rejected under pressure to avoid scan pollution - move memory cache pressure admission decisions into DataCache/FifoCache so the real SHARED memory cache write path can use ghost-hit admission - update tests for memory-cache-only RSS eviction, fifocache ghost admission, and MemCache-level ghost admission The meta cache still keeps its normal configured capacity and normal eviction. This change only removes meta cache from the RSS pressure eviction/admission path. For data cache pressure, the old behavior rejected a write in `MemCache.Update` when `used + newEntry > target`. That controlled memory, but it also prevented the lower-level cache from recognizing ghost hits. The new behavior lets `DataCache/FifoCache` decide admission: cold entries are still rejected under pressure, while ghost-hit entries can evict cold data first and then be admitted while keeping usage near the target. This PR intentionally does not include Step 3. RSS pressure state-machine changes, TTL removal, and RSS hysteresis should be handled in a separate PR because they affect pressure enter/exit semantics, eviction cadence, admission target lifetime, and OOM risk handling. In the 2026-05-26 nightly regression run, `sysbench_delete_pk_10_10000000 / vuser=1000` dropped from the previous baseline. During the affected window, RSS pressure reduced: - SHARED memory cache from about `11.66GiB` to `9.60GiB` - objectio meta cache from about `1.63GiB` to `1.60GiB` The meta eviction saved only about `29MiB`, but pressure admission later caused about `0.85M` meta admission skips and a large number of repeated objectio/dedup load failures. For this workload, meta cache is small but high value, while SHARED data cache is the meaningful RSS elasticity source. Testing: - `GOCACHE=/private/tmp/mo-gocache-rss-meta go test ./pkg/fileservice/fifocache -run 'TestCachePressureAdmission|TestEvictToTargetWithWait' -count=1` - `GOCACHE=/private/tmp/mo-gocache-rss-meta go test ./pkg/fileservice -run 'TestMemoryCachePressureAdmission|TestMemoryCacheEvictToCapacityPercent' -count=1` - `GOCACHE=/private/tmp/mo-gocache-rss-meta go test ./pkg/cnservice -run TestMakeRSSCacheEvictorEvictsMemoryCacheOnly -count=1` - `GOCACHE=/private/tmp/mo-gocache-rss-meta go test ./pkg/vm/engine/disttae -run '^$' -count=0` - `git diff --check` --------- Co-authored-by: Copilot <[email protected]> Co-authored-by: XuPeng-SH <[email protected]>
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
There was a problem hiding this comment.
Pull request overview
This PR refines RSS cache pressure handling so forced eviction and pressure admission target only SHARED/fileservice memory data caches, while objectio meta cache keeps normal capacity-based behavior. It also moves pressure admission logic into fifocache/DataCache to allow ghost-hit data entries to re-enter by evicting colder data.
Changes:
- Removed objectio meta cache from CN/workspace RSS pressure eviction and admission target setup.
- Added fifocache/DataCache admission rejection signaling and ghost-hit admission with targeted eviction.
- Added/updated tests for memory-only RSS eviction and pressure admission behavior.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
pkg/vm/engine/disttae/engine.go |
Limits workspace RSS eviction to fileservice memory caches and uses a timeout cause. |
pkg/fileservice/mem_cache.go |
Delegates pressure admission decisions to the underlying data cache and counts rejected admissions. |
pkg/fileservice/mem_cache_test.go |
Adds coverage for MemCache ghost-hit admission under pressure. |
pkg/fileservice/fscache/data_cache.go |
Introduces a shared admission rejection sentinel error. |
pkg/fileservice/fifocache/fifo.go |
Returns insertion/rejection status from Set and implements ghost-hit admission by evicting cold data. |
pkg/fileservice/fifocache/fifo_test.go |
Adds fifocache ghost-hit pressure admission coverage. |
pkg/fileservice/fifocache/data_cache.go |
Maps fifocache rejection status to the DataCache error contract. |
pkg/common/moerr/cause.go |
Adds context timeout causes for RSS cache eviction paths. |
pkg/common/moerr/cause_test.go |
Registers the new causes in cause validation coverage. |
pkg/cnservice/server.go |
Removes meta cache RSS pressure eviction/admission from CN service RSS handling. |
pkg/cnservice/server_test.go |
Updates RSS evictor coverage to assert memory-cache-only eviction. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
Looked through the RSS pressure path, the lower-level cache admission change, and the new coverage. The behavior change is coherent: meta cache is fully removed from RSS pressure eviction/admission, while memory cache pressure admission now still rejects cold one-shot writes but allows ghost-hit re-admission by evicting colder data first. I did not find a blocking correctness issue in this PR.
matrixorigin#24662) ## What type of PR is this? - [ ] API-change - [ ] BUG - [x] Improvement - [ ] Documentation - [ ] Feature - [x] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue matrixorigin#24644 ## What this PR does / why we need it: This PR implements Step 1 and Step 2 of the RSS cache pressure optimization plan: - keep objectio meta cache out of RSS forced eviction - stop setting RSS pressure admission targets on objectio meta cache - keep RSS pressure eviction focused on fileservice memory/data caches - allow pressure admission for data cache ghost hits by evicting cold data first - keep cold one-shot data rejected under pressure to avoid scan pollution - move memory cache pressure admission decisions into DataCache/FifoCache so the real SHARED memory cache write path can use ghost-hit admission - update tests for memory-cache-only RSS eviction, fifocache ghost admission, and MemCache-level ghost admission The meta cache still keeps its normal configured capacity and normal eviction. This change only removes meta cache from the RSS pressure eviction/admission path. For data cache pressure, the old behavior rejected a write in `MemCache.Update` when `used + newEntry > target`. That controlled memory, but it also prevented the lower-level cache from recognizing ghost hits. The new behavior lets `DataCache/FifoCache` decide admission: cold entries are still rejected under pressure, while ghost-hit entries can evict cold data first and then be admitted while keeping usage near the target. This PR intentionally does not include Step 3. RSS pressure state-machine changes, TTL removal, and RSS hysteresis should be handled in a separate PR because they affect pressure enter/exit semantics, eviction cadence, admission target lifetime, and OOM risk handling. In the 2026-05-26 nightly regression run, `sysbench_delete_pk_10_10000000 / vuser=1000` dropped from the previous baseline. During the affected window, RSS pressure reduced: - SHARED memory cache from about `11.66GiB` to `9.60GiB` - objectio meta cache from about `1.63GiB` to `1.60GiB` The meta eviction saved only about `29MiB`, but pressure admission later caused about `0.85M` meta admission skips and a large number of repeated objectio/dedup load failures. For this workload, meta cache is small but high value, while SHARED data cache is the meaningful RSS elasticity source. Testing: - `GOCACHE=/private/tmp/mo-gocache-rss-meta go test ./pkg/fileservice/fifocache -run 'TestCachePressureAdmission|TestEvictToTargetWithWait' -count=1` - `GOCACHE=/private/tmp/mo-gocache-rss-meta go test ./pkg/fileservice -run 'TestMemoryCachePressureAdmission|TestMemoryCacheEvictToCapacityPercent' -count=1` - `GOCACHE=/private/tmp/mo-gocache-rss-meta go test ./pkg/cnservice -run TestMakeRSSCacheEvictorEvictsMemoryCacheOnly -count=1` - `GOCACHE=/private/tmp/mo-gocache-rss-meta go test ./pkg/vm/engine/disttae -run '^$' -count=0` - `git diff --check` Co-authored-by: Copilot <[email protected]> Co-authored-by: XuPeng-SH <[email protected]>
matrixorigin#24662) ## What type of PR is this? - [ ] API-change - [ ] BUG - [x] Improvement - [ ] Documentation - [ ] Feature - [x] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue matrixorigin#24644 ## What this PR does / why we need it: This PR implements Step 1 and Step 2 of the RSS cache pressure optimization plan: - keep objectio meta cache out of RSS forced eviction - stop setting RSS pressure admission targets on objectio meta cache - keep RSS pressure eviction focused on fileservice memory/data caches - allow pressure admission for data cache ghost hits by evicting cold data first - keep cold one-shot data rejected under pressure to avoid scan pollution - move memory cache pressure admission decisions into DataCache/FifoCache so the real SHARED memory cache write path can use ghost-hit admission - update tests for memory-cache-only RSS eviction, fifocache ghost admission, and MemCache-level ghost admission The meta cache still keeps its normal configured capacity and normal eviction. This change only removes meta cache from the RSS pressure eviction/admission path. For data cache pressure, the old behavior rejected a write in `MemCache.Update` when `used + newEntry > target`. That controlled memory, but it also prevented the lower-level cache from recognizing ghost hits. The new behavior lets `DataCache/FifoCache` decide admission: cold entries are still rejected under pressure, while ghost-hit entries can evict cold data first and then be admitted while keeping usage near the target. This PR intentionally does not include Step 3. RSS pressure state-machine changes, TTL removal, and RSS hysteresis should be handled in a separate PR because they affect pressure enter/exit semantics, eviction cadence, admission target lifetime, and OOM risk handling. In the 2026-05-26 nightly regression run, `sysbench_delete_pk_10_10000000 / vuser=1000` dropped from the previous baseline. During the affected window, RSS pressure reduced: - SHARED memory cache from about `11.66GiB` to `9.60GiB` - objectio meta cache from about `1.63GiB` to `1.60GiB` The meta eviction saved only about `29MiB`, but pressure admission later caused about `0.85M` meta admission skips and a large number of repeated objectio/dedup load failures. For this workload, meta cache is small but high value, while SHARED data cache is the meaningful RSS elasticity source. Testing: - `GOCACHE=/private/tmp/mo-gocache-rss-meta go test ./pkg/fileservice/fifocache -run 'TestCachePressureAdmission|TestEvictToTargetWithWait' -count=1` - `GOCACHE=/private/tmp/mo-gocache-rss-meta go test ./pkg/fileservice -run 'TestMemoryCachePressureAdmission|TestMemoryCacheEvictToCapacityPercent' -count=1` - `GOCACHE=/private/tmp/mo-gocache-rss-meta go test ./pkg/cnservice -run TestMakeRSSCacheEvictorEvictsMemoryCacheOnly -count=1` - `GOCACHE=/private/tmp/mo-gocache-rss-meta go test ./pkg/vm/engine/disttae -run '^$' -count=0` - `git diff --check` Co-authored-by: Copilot <[email protected]> Co-authored-by: XuPeng-SH <[email protected]>
matrixorigin#24662) ## What type of PR is this? - [ ] API-change - [ ] BUG - [x] Improvement - [ ] Documentation - [ ] Feature - [x] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue matrixorigin#24644 ## What this PR does / why we need it: This PR implements Step 1 and Step 2 of the RSS cache pressure optimization plan: - keep objectio meta cache out of RSS forced eviction - stop setting RSS pressure admission targets on objectio meta cache - keep RSS pressure eviction focused on fileservice memory/data caches - allow pressure admission for data cache ghost hits by evicting cold data first - keep cold one-shot data rejected under pressure to avoid scan pollution - move memory cache pressure admission decisions into DataCache/FifoCache so the real SHARED memory cache write path can use ghost-hit admission - update tests for memory-cache-only RSS eviction, fifocache ghost admission, and MemCache-level ghost admission The meta cache still keeps its normal configured capacity and normal eviction. This change only removes meta cache from the RSS pressure eviction/admission path. For data cache pressure, the old behavior rejected a write in `MemCache.Update` when `used + newEntry > target`. That controlled memory, but it also prevented the lower-level cache from recognizing ghost hits. The new behavior lets `DataCache/FifoCache` decide admission: cold entries are still rejected under pressure, while ghost-hit entries can evict cold data first and then be admitted while keeping usage near the target. This PR intentionally does not include Step 3. RSS pressure state-machine changes, TTL removal, and RSS hysteresis should be handled in a separate PR because they affect pressure enter/exit semantics, eviction cadence, admission target lifetime, and OOM risk handling. In the 2026-05-26 nightly regression run, `sysbench_delete_pk_10_10000000 / vuser=1000` dropped from the previous baseline. During the affected window, RSS pressure reduced: - SHARED memory cache from about `11.66GiB` to `9.60GiB` - objectio meta cache from about `1.63GiB` to `1.60GiB` The meta eviction saved only about `29MiB`, but pressure admission later caused about `0.85M` meta admission skips and a large number of repeated objectio/dedup load failures. For this workload, meta cache is small but high value, while SHARED data cache is the meaningful RSS elasticity source. Testing: - `GOCACHE=/private/tmp/mo-gocache-rss-meta go test ./pkg/fileservice/fifocache -run 'TestCachePressureAdmission|TestEvictToTargetWithWait' -count=1` - `GOCACHE=/private/tmp/mo-gocache-rss-meta go test ./pkg/fileservice -run 'TestMemoryCachePressureAdmission|TestMemoryCacheEvictToCapacityPercent' -count=1` - `GOCACHE=/private/tmp/mo-gocache-rss-meta go test ./pkg/cnservice -run TestMakeRSSCacheEvictorEvictsMemoryCacheOnly -count=1` - `GOCACHE=/private/tmp/mo-gocache-rss-meta go test ./pkg/vm/engine/disttae -run '^$' -count=0` - `git diff --check` Co-authored-by: Copilot <[email protected]> Co-authored-by: XuPeng-SH <[email protected]>
What type of PR is this?
Which issue(s) this PR fixes:
issue #24644
What this PR does / why we need it:
This PR implements Step 1 and Step 2 of the RSS cache pressure optimization plan:
The meta cache still keeps its normal configured capacity and normal eviction. This change only removes meta cache from the RSS pressure eviction/admission path.
For data cache pressure, the old behavior rejected a write in
MemCache.Updatewhenused + newEntry > target. That controlled memory, but it also prevented the lower-level cache from recognizing ghost hits. The new behavior letsDataCache/FifoCachedecide admission: cold entries are still rejected under pressure, while ghost-hit entries can evict cold data first and then be admitted while keeping usage near the target.This PR intentionally does not include Step 3. RSS pressure state-machine changes, TTL removal, and RSS hysteresis should be handled in a separate PR because they affect pressure enter/exit semantics, eviction cadence, admission target lifetime, and OOM risk handling.
In the 2026-05-26 nightly regression run,
sysbench_delete_pk_10_10000000 / vuser=1000dropped from the previous baseline. During the affected window, RSS pressure reduced:11.66GiBto9.60GiB1.63GiBto1.60GiBThe meta eviction saved only about
29MiB, but pressure admission later caused about0.85Mmeta admission skips and a large number of repeated objectio/dedup load failures. For this workload, meta cache is small but high value, while SHARED data cache is the meaningful RSS elasticity source.Testing:
GOCACHE=/private/tmp/mo-gocache-rss-meta go test ./pkg/fileservice/fifocache -run 'TestCachePressureAdmission|TestEvictToTargetWithWait' -count=1GOCACHE=/private/tmp/mo-gocache-rss-meta go test ./pkg/fileservice -run 'TestMemoryCachePressureAdmission|TestMemoryCacheEvictToCapacityPercent' -count=1GOCACHE=/private/tmp/mo-gocache-rss-meta go test ./pkg/cnservice -run TestMakeRSSCacheEvictorEvictsMemoryCacheOnly -count=1GOCACHE=/private/tmp/mo-gocache-rss-meta go test ./pkg/vm/engine/disttae -run '^$' -count=0git diff --check