Deploying ComfyUI for Image Generation: Production Pipelines
Typical scenario: a client uses Automatic1111 but needs full control over the graph and reduced latency. ComfyUI solves this but requires deep configuration: scheduler selection, optimization for specific hardware, balancing quality and speed. Our experience: 5+ years in MLOps, 40+ projects with generative models. The official ComfyUI documentation notes that node-based architecture can achieve GPU utilization up to 80% with proper configuration.
Problems We Solve
Scaling inference. The Stable Diffusion pipeline consumes a lot of VRAM. Without proper configuration, GPU utilization drops to 30% and p99 latency increases. We optimize batches, use TensorRT and ONNX Runtime for quantization (INT8). In one project, we reduced latency from 12 to 3 seconds on SDXL without quality loss. In a recent project with Flux.1, we implemented batch inference with dynamic batching, increasing throughput by 3x.
API stability. Open-source solutions often crash under concurrent requests. We configure a queue via Celery + Redis, health checks, and auto-restart. We guarantee 99.5% uptime.
Image quality. Artifacts and prompt mismatch result from incorrect graph assembly. We use ControlNet with precise weight selection, IP-Adapter for stylization, and T2I-Adapter for structural control. Results are verified using FID and CLIP score metrics.
How We Do It
Typical stack: PyTorch 2.2, ComfyUI latest, Hugging Face Transformers for models, Triton Inference Server for deployment, Weights & Biases for monitoring. Example: integrating IP-Adapter and ControlNet into a single workflow.
def build_advanced_workflow(
prompt: str,
control_image: str,
ip_adapter_image: str,
checkpoint: str = "sd_xl_base_1.0.safetensors"
) -> dict:
base = build_sdxl_workflow(prompt)
# ControlNet
base["10"] = {"class_type": "LoadImage", "inputs": {"image": control_image}}
base["11"] = {"class_type": "ControlNetLoader", "inputs": {"control_net_name": "control_v11p_sd15_canny.pth"}}
base["12"] = {"class_type": "ControlNetApply", "inputs": {"conditioning": base["2"]["inputs"], "control_net": ["11", 0], "image": ["10", 0], "strength": 0.9}}
# IP-Adapter
base["13"] = {"class_type": "LoadImage", "inputs": {"image": ip_adapter_image}}
base["14"] = {"class_type": "CLIPVisionEncode", "inputs": {"image": ["13", 0], "clip_vision": ["1", 3]}}
base["15"] = {"class_type": "IPAdapterApply", "inputs": {"ip_adapter": ["1", 4], "image": ["13", 0], "weight": 0.6}}
return base
What models and optimizations are used?
For inference, we use TensorRT and ONNX Runtime with FP16 or INT8 precision. This reduces latency by 20-40% without noticeable quality loss. For Flux models, we use vLLM (adapted for diffusion) and dynamic batching. GPU utilization stays at 75-85%.
How to Build a Scalable API on ComfyUI?
We write a service wrapper in FastAPI: WebSocket for streaming intermediate images, a priority queue, and batch support. For high load, we use Redis + Celery with one worker per GPU. Example endpoint:
@app.post("/generate")
async def generate(prompt: str):
prompt_id = client.queue_prompt(workflow)
return {"id": prompt_id, "status": "queued"}
@app.get("/result/{prompt_id}")
async def get_result(prompt_id: str):
images = client.get_images_ws(workflow) # wait
return StreamingResponse(io.BytesIO(images[0]), media_type="image/png")
For monitoring, we connect Prometheus + Grafana: track p99 latency, request count, GPU utilization. When thresholds are exceeded, an alert goes to Telegram.
Why ComfyUI is More Efficient Than Automatic1111 for Complex Pipelines?
ComfyUI outperforms Automatic1111 by up to 30% in generation speed and 2x in GPU utilization. Compare key characteristics:
| Parameter | ComfyUI | Automatic1111 |
|---|---|---|
| Architecture | Node-based graph | Modular (but linear) |
| Pipeline flexibility | Any chains without limits | Limited combinations |
| VRAM usage | Optimized, up to 80% GPU utilization | Often idle |
| API | Built-in WebSocket/HTTP | Requires plugins |
| Generation speed | 10-30% faster (depends on workflow) | Baseline |
ComfyUI gives control over every element of the graph, which is critical for production.
Deployment Options Comparison
| Option | Components | Timeline |
|---|---|---|
| Basic | One workflow, basic API | 1–2 days |
| Advanced | Custom workflows (ControlNet, IP-Adapter), FastAPI | 3–5 days |
| Complex | Batch processing, CI/CD, monitoring | Up to 2 weeks |
Contact us for a project assessment. Order a consultation — we will prepare a proposal within 24 hours. Get a free analysis of your pipeline.
Our Process
- Analysis — dissect current pipelines, bottlenecks, expected load.
- Design — create workflows on paper, select models (SDXL/Flux), optimizations.
- Implementation — write workflow code, API wrapper, connect monitoring.
- Testing — load test with 50 concurrent requests, quality checks.
- Deployment — configure CI/CD (GitHub Actions), Triton Server, autoscaling.
What's Included
- A server with ComfyUI tuned to your hardware
- Custom workflows (up to 3) with ControlNet, IP-Adapter, LoRA support
- Python API client (FastAPI or gRPC)
- Operational and customization documentation
- Team training (2 hours, recorded)
- 3 months of support (4-hour slots per week)
Timelines: from 1 day for basic to 2 weeks for complex pipeline with batch. Pricing starts at $1,500 for basic deployment; advanced from $4,000; complex projects from $10,000. We guarantee stability and quality.
Hardware requirements for different models
- SDXL: 8GB VRAM minimum (RTX 3070), recommended 12GB+ (RTX 4070/3090).
- Flux: from 24GB VRAM (A100, 4090).
- Concurrent users: on A100 up to 4 sessions simultaneously.







