[Bugfix] Prefix-cache metrics double-counted when a KV connector defers requests (#48860)

Signed-off-by: Seiji Eicher <58963096+eicherseiji@users.noreply.github.com>
Signed-off-by: Seiji Eicher <seiji@anyscale.com>
Signed-off-by: Nick Hill <nickhill123@gmail.com>
Co-authored-by: Lixi Zhang <muxixibbb@gmail.com>
Co-authored-by: harjothkhara <harjoth.khara@gmail.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Co-authored-by: Nick Hill <nickhill123@gmail.com>
This commit is contained in:
Seiji Eicher
2026-07-21 15:02:03 +01:00
committed by GitHub
co-authored by Lixi Zhang harjothkhara Claude Opus 4.8 Nick Hill
parent 7bb49be4d1
commit 8950394e0a
5 changed files with 204 additions and 41 deletions
+9 -2
View File
@@ -38,8 +38,12 @@ from vllm.v1.structured_output import StructuredOutputManager
EOS_TOKEN_ID = 50256
def mock_kv(matched_tokens: int, is_async: bool):
return MockKVConfig(matched_tokens=matched_tokens, is_async=is_async)
def mock_kv(matched_tokens: int, is_async: bool, num_defers_before_matching: int = 0):
return MockKVConfig(
matched_tokens=matched_tokens,
is_async=is_async,
num_defers_before_matching=num_defers_before_matching,
)
def create_scheduler(
@@ -115,6 +119,9 @@ def create_scheduler(
kv_connector_extra_config={
"matched_tokens": use_kv_connector.matched_tokens,
"is_async": use_kv_connector.is_async,
"num_defers_before_matching": (
use_kv_connector.num_defers_before_matching
),
},
)
elif isinstance(use_kv_connector, str):