Synchronous model loads run inside the shared workflows thread pool, stalling all concurrent workflow runs (latency collapse with idle GPU/CPU)
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Tranquilla
- Stack tecnologico
- python
- Ambito
- backend, machine-learning, performance
Direzione di ricerca
Inizia tracciando le chiamate a shared_thread_pool_executor e ExecutionEngine.init in inference/core/interfaces/http/http_api.py, quindi analizza il locking e l’eviction della cache in inference/core/managers/decorators/fixed_size_cache.py. Riproduci l’esaurimento del pool con caricamenti sincroni dei modelli e rivedi i test di workflow esistenti. Il lavoro è completato quando i caricamenti non occupano più lo shared step pool e sono presenti test di copertura per l’esecuzione concorrente dei workflow e per il comportamento di caricamento richiesto.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
On a GPU inference server (roboflow-inference-server-gpu, build of 2026-06-05 / v1.3.0 era) serving multi-model Workflows under sustained production traffic, we observed a latency collapse mode where p50 latency of all workflow endpoints rises 3–10x while accelerator duty cycle stays ≤13% and CPU stays under 25% of limit. Raw /infer/* endpoints on the same pods remain fast. Root cause analysis points at a structural issue: synchronous model loads (3–19s each) execute inside the shared workflows ThreadPoolExecutor, starving step execution for every concurrent workflow run in the process.
Environment
gpu_http:appvia uvicorn, 1 worker, defaults:HTTP_API_SHARED_WORKFLOWS_THREAD_POOL_ENABLED=True(16 workers),WORKFLOWS_MAX_CONCURRENT_STEPS=4,MAX_ACTIVE_MODELS=20,MEMORY_FREE_THRESHOLD=0.20- Workload: ~6 workflow variants chaining 3–5 models each; working set ~12 model/version combos (~600MB VRAM each) on NVIDIA L4
- Horizontal autoscaling on request rate; replica churn redistributes traffic across pods regularly
Observed
Model loaded: ... load_time=events: p50 ≈ 5s, p90 ≈ 11s, occurring continuously in steady state (~200–700/hr fleet-wide) because the model working set +MEMORY_FREE_THRESHOLDVRAM guard keeps theWithFixedSizeCachemanager evicting (reason=memory_pressure) and re-loading- When autoscaler churn raises per-pod cache-miss rates, workflow p50/p90 explodes (0.8s → 4–8s p90 across all workflow endpoints uniformly) while GPU duty cycle ≤13% and CPU well under limit — classic heavy-tailed-service queueing on a software bottleneck (E[S²] dominated by inline loads), not a hardware one
/infer/*on the same pods degrades only mildly (~2x p90 at worst) — consistent with it not using the shared workflows pool, only the model-manager lock
Code path
inference/core/interfaces/http/http_api.py(~L1193): one process-globalself.shared_thread_pool_executor = ThreadPoolExecutor(max_workers=16)is created and passed to everyExecutionEngine.init(...)(~L1293)- Model blocks execute as steps in that pool; a cold model triggers
add_model→ download + deserialize + VRAM upload (3–19s) inside a step worker, while also holding theWithFixedSizeCachequeue lock for eviction bookkeeping (inference/core/managers/decorators/fixed_size_cache.py), so concurrent runs both lose a pool worker and contend on the lock - Under churn, several in-flight loads consume a large fraction of the 16 workers; queued steps back up; every workflow run slows; in-flight requests then pile up to whatever the ASGI concurrency limit is, producing 503 load shedding while the GPU is idle
Asks
- Isolate model loading from step execution — run loads on a dedicated loader executor (or async path) so a cold model only blocks requests that need that model, never the shared step pool
- First-class model pre-warming: a way to declare the deployment's model set to be loaded at startup (and pinned), with readiness gated on warm-up, so steady-state inline loads approach zero (the
_pinned_modelsmachinery inWithFixedSizeCachelooks close but isn't exposed/documented for this) - Hysteresis / actively-used protection on
memory_pressureevictions — under the VRAM threshold, LRU eviction of models that are in active rotation creates a permanent evict↔reload cycle - Observability: counters/histograms for model load duration, cache miss rate, and shared-pool queue depth would have made this diagnosable from metrics instead of log archaeology
Happy to provide more detail on the analysis.
- Lingua principale
- Python
- Stelle
- 2.5k
- Fork
- 340
- Merge medio
- 2g 11h
- PR unite (30g)
- 92
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 roboflow/inference
-
Allow Pillow 13 in inference-sdkForse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
roboflow/inference#3335 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
roboflow/inference#3173 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
roboflow/inference#2993 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Add context manager (__enter__ / __exit__) support to InferencePipelineForse già presa @KushagraKanaujia l’ha presa 67 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
roboflow/inference#2744 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
roboflow/inference#1913 · 1 commento · 2 reazioni ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di roboflow/inference
Issue simili
-
SslLibrary crashes with unhandled OSError: port/proto not found on non-standard SSL portsForse già presa @himanchalkaushale l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
OWASP/Nettacker#1884 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
A-connection-core C-enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
aws-samples/sample-per-model-bedrock#869 ·
I maintainer di solito rispondono entro 1 giorno
-
Spec: say that included_antigen_sources gates LENS labels; do not merge it into antigen kindsAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
fzn0x/watchtower#17 ·