Skip to content

fix: keep meta cache out of rss pressure eviction (#24648) - #24662

Merged
XuPeng-SH merged 2 commits into
matrixorigin:mainfrom
LeftHandCold:cp-24648
May 28, 2026
Merged

XuPeng-SH merged 2 commits into
matrixorigin:mainfrom
LeftHandCold:cp-24648

Conversation

@LeftHandCold

Copy link
Copy Markdown
Collaborator

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

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:

  • 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

## 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]>
Copilot AI review requested due to automatic review settings May 28, 2026 03:33
@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@matrix-meow matrix-meow added the size/M Denotes a PR that changes [100,499] lines label May 28, 2026
@XuPeng-SH
XuPeng-SH self-requested a review May 28, 2026 05:30
@XuPeng-SH
XuPeng-SH merged commit 69aaf6d into matrixorigin:main May 28, 2026
22 of 23 checks passed
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
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]>
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
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]>
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
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]>

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/enhancement kind/test-ci size/M Denotes a PR that changes [100,499] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants