feat(mem_cache): add client-side metadata cache for HiCacheFile storage - #29716
Merged
Jiminator merged 3 commits intoJul 8, 2026
Merged
Conversation
tyuchn
requested review from
Ying1123,
alphabetc1,
hanming-lu,
hnyls2002,
hzh0425,
ispobock,
merrymercy,
xiezhq-hermann and
yizhang2077
as code owners
June 30, 2026 05:35
Contributor
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
tyuchn
force-pushed
the
feature/hicache-metadata-cache
branch
from
June 30, 2026 05:38
524b2d0 to
45e1d6a
Compare
Collaborator
|
cc @HZY-Wade |
xiezhq-hermann
approved these changes
Jul 7, 2026
…ile storage - Add client-side in-memory MetadataCache to bypass folder listings (os.scandir) and direct filesystem checks. - Add invalidation callback in LRUFileEvictor for disk evictions. - Make the feature optional via SGLANG_HICACHE_FILE_BACKEND_ENABLE_METADATA_CACHE (default False). - Add integration tests in test_hicache_file_lru_unit.py.
tyuchn
force-pushed
the
feature/hicache-metadata-cache
branch
from
July 7, 2026 05:20
1634d55 to
eca9a4e
Compare
Chronostasys
pushed a commit
to MindLab-Research/sglang
that referenced
this pull request
Aug 24, 2026
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.
Motivation
This PR resolves the filesystem metadata bottleneck in multi-tier offloading when using the file backend by introducing an in-memory client-side positive metadata cache in SGLang. Bypassing directory traversals via the in-memory cache directly resolves the MDS bottleneck, avoiding event loop blockage warnings when listing a large number of cache files, and reducing latency.
Modifications
We modified three main components in the codebase:
SGLANG_HICACHE_FILE_BACKEND_ENABLE_METADATA_CACHE(EnvBool, defaults toFalse) to make the metadata cache optional, andSGLANG_HICACHE_FILE_BACKEND_METADATA_TTL(defaulting to5.0seconds) to control expiration.LRUFileEvictorto accept anon_evictcallback. Whenever a file is deleted from disk to satisfy space bounds, the callback invalidates the evicted key in SGLang's client-side metadata cache.MetadataCachewith thread-safety and hard TTL logic.HiCacheFile'sexists(),get(),set(), and eviction hook when enabled, falling back to original direct filesystem paths when disabled.Accuracy Tests
We integrated unit tests into SGLang's official
test_hicache_file_lru_unit.pysuite:TestHiCacheFileMetadataIntegrationto verify:os.path.exists.os.scandir.Speed Tests and Profiling
We evaluated SGLang on a shared Lustre filesystem populated with 157,195 cache files under a synthetic shared-prefix workload:
os.scandirprevented event loop blockage warnings when listing 157k files, ensuring smooth scheduling steps.Benchmarking details:
Checklist
CI States
Latest PR Test (Base): ✅ Run #28899997114
Latest PR Test (Extra): ❌ Run #28899996914