Skip to content

SGLang HiCache routing credits Mooncake pages SGLang does not load #18174

Open

Description

@jh-nv

With --shared-cache-type hicache, the KV router credits Mooncake (HiCache L3) pages that SGLang never loads, so it underestimates the prefill work some requests cost on some workers:

  1. It counts every stored page past the worker's GPU prefix, including pages after a missing page. SGLang prefetches only the unbroken run that starts where the worker's local prefix ends.
  2. It credits pages the worker already holds in host memory twice: once through host_cache_hit_weight and again through shared_cache_multiplier.
  3. It credits runs shorter than SGLang's prefetch_threshold (default 256 tokens), which SGLang skips.
  4. It credits LoRA requests with base-model pages. SGLang keys adapter pages under a separate namespace, so the adapter request cannot load them.
  5. Under attention DP, workers publish the full tp_size, but SGLang names storage keys by attention-TP rank, so the router never finds a hit for non-MLA models.

Expected: the shared-cache credit for a worker equals the pages SGLang would prefetch for that worker.

Agent notes

SGLang 0.5.23 references:

  • managers/scheduler.py: the prefetch starts at matched_len = req.prefix_len + req.host_hit_length (device plus host match).
  • managers/cache_controller.py _storage_hit_query: batch_exists returns the number of consecutive existing pages from the start and the query stops at the first miss.
  • mem_cache/unified_radix_cache.py: prefetch_length < self.prefetch_threshold declines the prefetch; the threshold comes from hicache_storage_backend_extra_config["prefetch_threshold"] (default 256) and the controller uses max(threshold, page_size).
  • mem_cache/utils.py get_storage_hash_str seeds storage chains with storage_namespace_seed(extra_key, cache_salt); schedule_batch.py appends lora_id to extra_key.
  • cache_controller.py _generate_storage_config uses attn_tp_rank and attn_tp_size when DP attention is enabled.

Dynamo: SharedCacheHits::hits_beyond in lib/kv-router/src/protocols.rs, the default scorer in lib/router-plugins/builtin/src/default/scorer.rs, the reference selector, lib/llm/src/kv_router/shared_cache.rs, and components/src/dynamo/sglang/register.py.

Activity

  1. self-assigned this
    on Nov 5, 2026
  2. added
    routerRelates to routing, KV-aware routing, etc.
    bugSomething isn't working
    kv-memoryCODEOWNER area -> @ai-dynamo/dynamo-kv-memory-codeowners
    on Nov 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

backend::sglangRelates to the sglang backendbugSomething isn't workingkv-memoryCODEOWNER area -> @ai-dynamo/dynamo-kv-memory-codeownersrouterRelates to routing, KV-aware routing, etc.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions