Repository navigation
Conversation
This PR adds an RSS pressure controller for memory cache pressure handling. Before this change, RSS cache pressure used a fixed admission-target TTL as the main lifecycle mechanism. If RSS recovered quickly, the memory cache admission target could still remain active until the TTL expired, slowing data cache recovery. This PR changes that behavior by: - adding explicit RSS pressure states: `none`, `soft`, and `hard`; - using hysteresis for state transitions: - `none -> soft`: RSS >= 85%; - `soft -> hard`: RSS >= 92%; - `hard -> soft`: RSS <= 88%; - `soft/hard -> none`: RSS <= 80%; - setting memory cache admission target by state: - soft: 80%; - hard: 50%; - clearing the memory cache admission target immediately when pressure exits; - keeping evict and `debug.FreeOSMemory` actions throttled by cooldown; - keeping the target TTL as a lease fallback that is renewed while pressure remains active; - splitting target set/clear from cache eviction so asynchronous evict actions cannot restore stale pressure targets; - guarding async evict with a pressure generation check. The change keeps Step 1/2 behavior intact: RSS pressure still only controls data/memory cache and does not force objectio meta cache eviction. Approved by: @gouhongshen, @XuPeng-SH (cherry picked from commit 2b52daa)
LeftHandCold
requested review from
XuPeng-SH,
fengttt and
gouhongshen
as code owners
May 28, 2026 10:39
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
Backports the RSS pressure controller state machine and improves memory cache pressure target lifecycle so cache admission limits are applied/renewed only while RSS pressure is active and cleared immediately on exit, with owner-scoped targets to prevent different controllers from overwriting each other.
Changes:
- Introduces an explicit RSS pressure state machine (
none/soft/hard) with hysteresis and separates state transitions from throttled actions (evict /debug.FreeOSMemorycooldown). - Adds owner-scoped memory cache pressure targets in
fileservice, computing an effective target across active owners and supporting per-owner clear. - Wires CN and Workspace RSS controllers to set/clear their own cache pressure targets and updates/extends unit tests for the new lifecycle.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/vm/engine/disttae/engine.go | Adds workspace-specific owner-scoped cache pressure target setter/clearer and passes them into the RSS throttler options. |
| pkg/fileservice/mem_cache.go | Implements owner-scoped pressure targets with an aggregated effective admission target and adds clear APIs. |
| pkg/fileservice/mem_cache_test.go | Adds tests for clearing pressure targets and verifying owner isolation behavior. |
| pkg/common/rscthrottler/resource_throttler.go | Replaces threshold-only behavior with an RSS pressure state machine + target lifecycle hooks and generation-guarded async eviction. |
| pkg/common/rscthrottler/resource_throttler_test.go | Adds lifecycle/state-machine tests and updates concurrency test inputs for the new hysteresis behavior. |
| pkg/cnservice/server.go | Adds CN-specific owner-scoped cache pressure target setter/clearer and wires them into the RSS throttler options. |
XuPeng-SH
approved these changes
May 28, 2026
gouhongshen
approved these changes
May 28, 2026
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
/kind improvement
What this PR does / why we need it:
Cherry-pick #24665 to 4.0-dev.
This backports the RSS pressure controller state machine and cache pressure target lifecycle improvements:
Which issue(s) this PR fixes:
Refs #24664
Backport of #24665
Special notes for your reviewer:
The cherry-pick had one conflict in pkg/common/rscthrottler/resource_throttler.go. The conflict was resolved by keeping the main-branch generation guard for async cache eviction.
Does this PR introduce a user-facing change?
NONE
How to test: