VRAM & CUDA Tuning
Orchestrating Headless ComfyUI Workers With Redis & /prompt API
Serialize concurrent webhook requests into single-GPU ComfyUI queues with deterministic seed tracking, timeout watchdogs, and asset upload.
100% Serialized GPU Access · Zero Race OOMs · <40ms Enqueue
Never Expose Raw :8188 Directly to Public Traffic
Place a lightweight API gateway in front of ComfyUI that validates JSON workflow templates, injects prompt strings, and pushes jobs onto a Redis queue.
Warm Model Pinning Between API Calls
Keep --cache-lru 2 enabled so back-to-back API jobs reuse already-loaded Flux FP8 and T5-XXL tensors without touching NVMe.
Measured Thresholds & ComfyUI Configuration Matrix
| Orchestration Layer | Configuration Pattern | Failure Prevented |
|---|---|---|
| Job Queue (Redis / BullMQ) | Concurrency = 1 per GPU card | Stops parallel workflows colliding on VRAM |
| ComfyUI WebSocket Listener | Subscribe /ws?clientId=... for completion | Replaces fragile HTTP polling loops |
| Timeout Watchdog | 120s Flux / 360s Wan2.2 hard cap | Recovers hung custom nodes cleanly |