Skip to content

[core] Always-on StreamingSession in UnifiedRadixCache#23202

Merged
hnyls2002 merged 6 commits intomainfrom
lsyin/unified-session-always-on
Apr 20, 2026
Merged

[core] Always-on StreamingSession in UnifiedRadixCache#23202
hnyls2002 merged 6 commits intomainfrom
lsyin/unified-session-always-on

Conversation

@hnyls2002
Copy link
Copy Markdown
Collaborator

@hnyls2002 hnyls2002 commented Apr 20, 2026

Stacked on #23145.

Summary

  • Embed StreamingSession (renamed from SessionAwareCache) in UnifiedRadixCache unconditionally -- the try_* entries short-circuit on non-streaming reqs / real TreeNodes, so there is zero overhead when no streaming session is actually opened
  • Drop the per-cache enable_streaming_session plumbing for UnifiedRadixCache

Changes

Rename

  • session/session_aware_cache.pysession/streaming_session.py
  • Class SessionAwareCacheStreamingSession. The class still extends BasePrefixCache for wrapper-mode ergonomics (tree_cache = StreamingSession(RadixCache(...))), but its identity is "a streaming session component that also satisfies the cache interface" rather than "a cache variant"

Always-on embedding

  • CacheInitParams: drop the enable_streaming_session field (no longer plumbed)
  • UnifiedRadixCache.__init__: unconditionally construct self.session = StreamingSession(inner=self) (type is no longer Optional)
  • Drop if self.session is not None guards in dispatch methods (match_prefix / cache_finished_req / cache_unfinished_req / inc_lock_ref / dec_lock_ref), reset, sanity_check, release_session, and session_held_*
  • supports_streaming_session() now returns True
  • Scheduler: remove params.enable_streaming_session = server_args.enable_streaming_session plumbing

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

Base automatically changed from lsyin/unified-streaming-session to main April 20, 2026 03:47
@hnyls2002 hnyls2002 changed the title always-on session in UnifiedRadixCache [core] Always-on streaming session in UnifiedRadixCache Apr 20, 2026
@hnyls2002 hnyls2002 changed the title [core] Always-on streaming session in UnifiedRadixCache [core] Always-on StreamingSession in UnifiedRadixCache Apr 20, 2026
@hnyls2002
Copy link
Copy Markdown
Collaborator Author

/tag-and-rerun-ci

@hnyls2002 hnyls2002 merged commit eb76aab into main Apr 20, 2026
85 of 108 checks passed
@hnyls2002 hnyls2002 deleted the lsyin/unified-session-always-on branch April 20, 2026 04:19
zhangying098 pushed a commit to zhangying098/sglang that referenced this pull request Apr 23, 2026
kyx1999 pushed a commit to KMSorSMS/sglang that referenced this pull request Apr 27, 2026
@hnyls2002 hnyls2002 mentioned this pull request Apr 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant