Concurrent cold prefills of multiple sessions collapse throughput (1365 t/s solo -> 5-95 t/s each with 2 simultaneous prefills)
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 55/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- c
- Ambito
- ai-infra-agents, performance
Direzione di ricerca
Start with the mixed-prefill scheduler and reproduce the two parallel uncached requests using the provided ds4-server settings, comparing them with the solo baseline. Check whether concurrent cold prefills and the partial KV disk-cache hits share a scheduling or cache path. Done means concurrent prefills avoid the reported throughput collapse and the affected session can reuse the expected prefix.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Environment
- Mac Studio M5 Ultra, 256 GB, Metal backend
- Qwen3.8-Flash-Next Q4 (
qwen38-q4k, 69.7 GiB resident), BF16 n-grams on disk ds4-server --ctx 2097152 --batched-session 4 --kv-disk-space-mb 153600 --prefill-chunk 8192(+DS4_QWEN4_YARN_FACTOR=2)- Observed on two separate incidents on 2026-10-01, and reproducible on demand
Solo cold prefill (reference, same machine/config)
| prompt | rate |
|---|---|
| 468,960 tok | 1365 t/s (343.7 s) |
| 188,960 tok | 1645 t/s |
| 33,960 tok | 1804 t/s |
Two concurrent cold prefills
Incident 1 — a 282k-token session and a 91k-token session started cold prefill at the same time. Both collapsed to ~5 t/s per chunk-progress entry (aggregate ~10 t/s vs 1365 solo):
chat ctx=0..282540:282540 prefill chunk 27136/282540 (9.6%) chunk=4.78 t/s avg=141.45 t/s 191.846s
chat ctx=0..91087:91087 prefill chunk 512/91087 (0.6%) chunk=4.75 t/s avg=5.40 t/s 94.810s
Incident 2 — one ~70k session (turn 1) plus its next turns re-prefilling, two sessions prefilling concurrently. Both at 51-95 t/s:
chat ctx=20480..78997:58517 prefill chunk 36864/58517 (63.0%) chunk=83.92 t/s avg=79.88 t/s 461.510s
chat ctx=25728..70972:45244 prefill chunk 16384/45244 (36.2%) chunk=84.81 t/s avg=81.07 t/s 202.091s
Notes:
- The collapse is much worse than a fair time-share: two prefills should give ~600-700 t/s each; instead aggregate drops to 10-170 t/s (8-100x total loss).
- KV disk cache is not the cause: budget is 150 GiB, cache dir was purged between tests, no
disk-cache-fullevictions in the incident-2 window. - Warm/decode behavior while another session prefills is fine (65 t/s decode alongside 500-800 t/s incremental prefill chunks in normal operation).
What I tried
--mixed-prefill-quantum 4096(default 128) — no improvement, concurrent prefills still ran at 83-95 t/s.
Secondary observation (possibly related)
During/after concurrent prefill, the next turn of the same session only hit ~20-25k tokens of KV disk cache instead of the full 70k+ prefix — turn 2 re-prefilled from offset 20480/25728 (chunks are stored with reason=continued, cold_max=30000). Under solo operation, full-prefix hits work as expected (e.g. kv cache hit text tokens=133120 ... load=295.9 ms).
Repro
# two parallel fresh (uncached) 70k+ prompts to /v1/chat/completions
# (stream=false, max_tokens small) -> both prefill at 50-95 t/s instead of ~1400
Workaround
We now serialize big cold prefills at a proxy in front of ds4 (FIFO lock, released on first streamed token), which restores solo-speed prefills for queued requests. But it feels like the mixed-prefill scheduler could either serialize large prefills internally or interleave them without the collapse — is there a flag/approach I'm missing, or is this worth investigating in the scheduler?
Thank you for ds4 — it's genuinely impressive engineering; single-session performance is in a different league from anything else on this hardware.
- Lingua principale
- C
- Stelle
- 24.4k
- Fork
- 2.4k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di antirez/ds4
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
antirez/ds4#1189 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 75/100
antirez/ds4#1173 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 92/100
antirez/ds4#1032 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Issue simili
-
bug needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
awslabs/aws-c-common#1319 ·
-
editor/integration
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
DeusData/codebase-memory-mcp#3130 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 13 giorni
-
DBMS_UTILITY.FORMAT_ERROR_STACK exceeds the 2000-byte limitForse già presa @coder999o l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
zephyrproject-rtos/zephyr#127560 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni