mirror of
https://github.com/kvcache-ai/Mooncake.git
synced 2026-11-05 01:17:55 +00:00
[GH-ISSUE #2219] [Feature Request]: Disk Watermark Eviction: Proactive Disk Usage Management #610
Labels
No labels
ascend
auto-closed
bug
bug
CI/Build
Common
documentation
enhancement
feature request
good first issue
help wanted
high priority
MetaX
nightly-failure
pull-request
PyTorch Backend
question
RFC
Roadmap
stale
Store
Tests
Transfer Engine
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
kvcache-ai/Mooncake#610
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Colors-111 on GitHub (May 25, 2026).
Original GitHub issue: https://github.com/kvcache-ai/Mooncake/issues/2219
Describe your feature request
Problem
Disk eviction is currently triggered only reactively — when a write finds insufficient space via
EnsureDiskSpace. There is no proactive watermark-based eviction mechanism. This causes disk usage to remain at ~100% after the disk fills up, unlike memory which oscillates between watermark thresholds.Specific impacts:
eviction_high_watermark_ratio(default 0.95) with a background eviction thread, keeping usage fluctuating between ~90%–95%. Disk has no equivalent mechanism.file_storage.cpp:597marks// TODO(eviction): Implement an LRU eviction mechanism to manage local storage capacity., which remains unimplemented.Current vs Expected Behavior
Suggested Approach
Core Idea
Add disk watermark checks in the
FileStorage::Heartbeat()periodic thread. When usage exceeds the high watermark, proactively evict until usage drops below the low watermark. Reuse the existingEnsureDiskSpace()/EvictFile()logic inStorageBackend— no need to rewrite eviction strategies.Configuration
Add watermark config fields to
FileStorageConfig:disk_eviction_high_watermark_ratiodouble0.90disk_eviction_low_watermark_ratiodouble0.80Support environment variable overrides (
MOONCAKE_DISK_EVICTION_HIGH_WATERMARK_RATIO/MOONCAKE_DISK_EVICTION_LOW_WATERMARK_RATIO).Eviction Trigger Point
Add a new STEP 3 in
Heartbeat()after the existing STEP 2 (persist offloaded objects):Points to Address
StorageBackendInterfaceneeds aGetSpaceUsage()method forFileStorageto query current disk usage.EnsureDiskSpacealready returnsevicted_keys, but these are not currently reported to the master. After watermark eviction, the master must be notified to clean up LOCAL_DISK replica info for evicted objects — otherwise the master still believes the data resides on SSD, and subsequent reads will fail.EnsureDiskSpacemust remain thread-safe (currently protected byfile_queue_mutex_andspace_mutex_).Before submitting a new issue...
@CAICAIIs commented on GitHub (May 28, 2026):
hi, I’d like to take this one.
I’m planning to implement the first slice as proactive disk watermark eviction in
FileStorage::Heartbeat(), coveringfile_per_key_storage_backendandbucket_storage_backend, and keepingoffset_allocator_storage_backendas no-op for the initial version.I’ll also include config/env docs and tests for the watermark behavior and master-side LOCAL_DISK replica cleanup.
@Colors-111 commented on GitHub (May 28, 2026):
Thanks for driving this. The iterative approach makes a lot of sense. Looking forward to the PR.