VRAM & CUDA Tuning
Tuning --cache-lru and LoRA Merge Eviction to Stop RAM Leaks
Balance workflow switch speed against RAM exhaustion across multi-LoRA jobs using --cache-lru N and --cache-classic memory flags.
--cache-lru 2 (32-64 GB RAM) · --cache-lru 4 (128 GB+ RAM)
Why Unbounded Node Caching Leaks Host RAM
By default, ComfyUI caches intermediate node outputs aggressively. When batch jobs iterate over 20 different LoRA checkpoints, old patched DiT clones accumulate until OOM.
Clearing VRAM Between Disparate Pipelines
If one worker alternates between Flux.1-dev and Wan2.2 5B, pass --cache-lru 1 or call the /free API endpoint between pipeline switches.
Measured Thresholds & ComfyUI Configuration Matrix
| Host RAM Capacity | Recommended Cache Flag | Multi-LoRA Behavior |
|---|---|---|
| 32 GB Host RAM | --cache-lru 1 or 2 | Evicts stale LoRA-patched graphs promptly |
| 64 GB Host RAM (Vultr L4) | --cache-lru 2 | Keeps base Flux + 1 alternate LoRA stack warm |
| 128-180 GB RAM (L40S/A100) | --cache-lru 4 | Holds Flux, Wan2.2, and LoRA variants in RAM |