Skip to content

[Fix] linker: Renew Mooncake read leases that lapse during a load - #49043

Merged
kpham-sgl merged 5 commits into
sgl-project:mainfrom
alphabetc1:fix/linker-mooncake-lease-renewal
Nov 10, 2026
Merged

kpham-sgl merged 5 commits into
sgl-project:mainfrom
alphabetc1:fix/linker-mooncake-lease-renewal

Conversation

@alphabetc1

@alphabetc1 alphabetc1 commented Nov 7, 2026 •

Copy link
Copy Markdown
Collaborator

Original authors: @Fridge003, @alphabetc1

Port of #48414

Fixes and guards for the Mooncake direct linker from the Kimi-K3.1 Day-0 branch (#48414), plus two fixes found while porting them.

  • A long load can outlive its get-session leases, which aborted every request in the batch. The lapsed keys are renewed and their reads retried.
  • New here: Mooncake reports a lapsed lease as -707 only on the first read of a key; every later read of it, from the same ranged get (requests sharing a prefix) or from a concurrent layer-group read, gets -600. Both codes now count as lapsed; without it the renewal never ran on shared-prefix batches.
  • New here: a renewal can race reads still in flight on the old lease, so an immediate retry can see -600 again. The renew-and-retry runs up to four times with a short backoff, then fails the load as before.
  • local_buffer_size in the Mooncake JSON or extra config (default 16 MiB) for transports that stage GPU data through host memory, and MooncakeStore honors SGLANG_HICACHE_MOONCAKE_REUSE_TE.
  • The linker has no pipeline-parallel coordination, so --pp-size > 1 is rejected at startup.

Against the raw port: the renewal sits in the ranged get of the parallel layer-group loads (#45106) instead of the per-layer loop. The branch's session cleanup after a partial start failure is dropped: main already tracks sessions before starting them (#46168).

Modifications

  • mem_cache/storage/mooncake_store/mooncake_direct_linker.py: lease renewal with bounded retries.
  • mem_cache/storage/mooncake_store/mooncake_store.py, README.md: local_buffer_size, transfer-engine reuse switch.
  • arg_groups/hicache_hook.py: reject --pp-size > 1 with the linker.

Tests

  • Unit: test_unified_cache_linker.py::test_range_get_* (shared keys, keys another read reported, a racing read, bounded give-up, other failures not renewed), test_mooncake_store_config.py, test_external_linker_factory.py.
  • Kimi-K3.1-Pro, B300 TP8, DFLASH, Mooncake linker, GSM8K with a 16-shot shared prefix and a cache flush every 64 questions:

Touches the same spot of mooncake_direct_linker.py as #49355 (both add module-level definitions); whichever merges second needs a trivial rebase.


CI States

Latest PR Test (Base): ✅ Run #42776916105
Latest PR Test (Extra): ✅ Run #42776916031
Latest PR Test (AMD ROCm 10): ❌ Run #42776916237

Tip

Base CI only covers the core cases, and its workload may not exercise your change. Use /rerun-test to run the tests your change touches, or copy this prompt for an agent:

Find the registered tests this PR affects and run them with /rerun-test, following https://github.com/sgl-project/sglang/blob/main/.agents/skills/rerun-test/SKILL.md

Co-authored-by: Baizhou Zhang [email protected]
Co-authored-by: Shuwen Wang [email protected]

@claude claude Bot 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.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@alphabetc1
alphabetc1 force-pushed the fix/linker-mooncake-lease-renewal branch from 882ab28 to fc829ed Compare November 9, 2026 17:52
@alphabetc1 alphabetc1 added run-ci CI: run the baseline test suite on this PR run-ci-nv-extra CI: NVIDIA/shared Extra suite (requires run-ci) labels Nov 10, 2026
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Nov 10, 2026
@kpham-sgl
kpham-sgl merged commit 10e5008 into sgl-project:main Nov 10, 2026
189 of 197 checks passed
kpham-sgl added a commit that referenced this pull request Nov 11, 2026
@alphabetc1
alphabetc1 deleted the fix/linker-mooncake-lease-renewal branch November 11, 2026 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation hicache Hierarchical Caching for SGLang mooncake run-ci CI: run the baseline test suite on this PR run-ci-nv-extra CI: NVIDIA/shared Extra suite (requires run-ci)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants