RTX 3050 - Order Now
Home / Blog / Model Guides / Deploy Stable Diffusion on a Dedicated GPU Server
Model Guides

Deploy Stable Diffusion on a Dedicated GPU Server

Step-by-step guide to deploying Stable Diffusion XL and Flux on a dedicated GPU server with ComfyUI or Automatic1111 — including GPU benchmarks, CLI commands, and remote access setup.

Why Self-Host Stable Diffusion?

Cloud image generation APIs charge per image — and costs add up fast at scale. Running Stable Diffusion on a dedicated GPU server gives you unlimited generations at a fixed monthly cost, full control over models and workflows, and zero content filtering restrictions. For studios, SaaS products, and agencies generating thousands of images daily, self-hosted Stable Diffusion is the only approach that makes financial sense.

This guide covers everything from GPU selection to a working deployment with either ComfyUI or Automatic1111. You’ll have SDXL or Flux generating images remotely within 30 minutes. For a broader look at GPU options, see our best GPU for Stable Diffusion breakdown.

GPU Performance Comparison

Image generation speed is measured in iterations per second (it/s). Higher is better. The table below shows real benchmarks from our image generation hosting servers running SDXL at 1024×1024 with 30 sampling steps:

GPU VRAM SDXL (it/s) SDXL Time per Image Flux.1-dev (it/s) Flux Time per Image
RTX 40608 GB2.1 it/s~14.3s0.9 it/s~33s
RTX 4060 Ti16 GB3.4 it/s~8.8s1.5 it/s~20s
RTX 309024 GB4.8 it/s~6.3s2.1 it/s~14.3s
RTX 508016 GB6.2 it/s~4.8s3.0 it/s~10s
RTX 509032 GB9.5 it/s~3.2s4.8 it/s~6.3s

The RTX 3090 remains the best value for image generation workloads — enough VRAM for any model and checkpoint combination, with strong throughput at a lower price point than newer cards. For a detailed cost-versus-speed analysis, check our RTX 3090 vs RTX 5090 comparison.

Server Selection & OS Setup

Provision a dedicated GPU server with at least 16 GB VRAM for SDXL and 24 GB for comfortable Flux workflows with LoRAs loaded. SSH into your server and prepare the environment:

# Update and install essentials
sudo apt update && sudo apt upgrade -y
sudo apt install -y git wget python3.11 python3.11-venv python3-pip libgl1 libglib2.0-0

# Verify NVIDIA driver and CUDA
nvidia-smi

# Install PyTorch with CUDA support
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121

Confirm that nvidia-smi shows your GPU with the expected VRAM. GigaGPU servers ship with NVIDIA drivers and CUDA pre-installed, so you can typically skip the driver step. For custom PyTorch hosting configurations, refer to the official PyTorch compatibility matrix.

Option A: Deploy with ComfyUI

ComfyUI is a node-based interface that gives you full control over generation pipelines. It is lighter, faster, and better suited for production API workflows than A1111.

# Clone ComfyUI
cd ~
git clone https://github.com/comfyanonymous/ComfyUI.git
cd ComfyUI

# Install dependencies
pip install -r requirements.txt

# Launch ComfyUI on all interfaces for remote access
python main.py --listen 0.0.0.0 --port 8188

ComfyUI will be accessible at http://your-server-ip:8188. For production use, place it behind a reverse proxy with TLS and basic authentication.

Option B: Deploy with Automatic1111

Automatic1111 (A1111) WebUI is the classic Stable Diffusion interface with a large extension ecosystem. It is best for interactive use and experimentation.

# Clone Automatic1111
cd ~
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
cd stable-diffusion-webui

# Launch with remote access enabled
./webui.sh --listen --port 7860 --xformers --api

The --api flag exposes a REST API at /sdapi/v1/ for programmatic image generation. The --xformers flag enables memory-efficient attention, which is critical for getting the most out of your VRAM.

Download SDXL & Flux Models

With your UI running, download the model checkpoints. Place them in the correct directories for your chosen interface:

# For ComfyUI — download SDXL base
wget -O ~/ComfyUI/models/checkpoints/sd_xl_base_1.0.safetensors \
  "https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/resolve/main/sd_xl_base_1.0.safetensors"

# For ComfyUI — download Flux.1-dev (requires HF token)
huggingface-cli download black-forest-labs/FLUX.1-dev \
  --local-dir ~/ComfyUI/models/unet/flux1-dev

# For A1111 — download SDXL base
wget -O ~/stable-diffusion-webui/models/Stable-diffusion/sd_xl_base_1.0.safetensors \
  "https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/resolve/main/sd_xl_base_1.0.safetensors"

SDXL base is roughly 6.5 GB. Flux.1-dev is approximately 24 GB for the full model. Ensure you have sufficient disk space — a 1 TB NVMe (standard on GigaGPU servers) provides plenty of room for multiple checkpoints and LoRAs.

To generate your first image via the ComfyUI API:

# Queue a generation via ComfyUI API
curl -X POST http://localhost:8188/prompt \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": {
      "3": {
        "class_type": "KSampler",
        "inputs": {
          "seed": 42,
          "steps": 30,
          "cfg": 7.5,
          "sampler_name": "euler_ancestral",
          "scheduler": "normal",
          "denoise": 1.0,
          "model": ["4", 0],
          "positive": ["6", 0],
          "negative": ["7", 0],
          "latent_image": ["5", 0]
        }
      }
    }
  }'

Skip the Setup — Deploy Stable Diffusion in Minutes

GigaGPU servers come pre-loaded with ComfyUI, SDXL checkpoints, and NVIDIA drivers. Start generating immediately with full root access and fixed monthly pricing.

See Stable Diffusion Hosting Plans

Benchmarking & Next Steps

After deployment, benchmark and optimise your setup:

  • Measure throughput — Generate a batch of 20 images at your target resolution and divide total time by count. Compare against the GPU table above to confirm your server is performing as expected.
  • Enable optimisations — Use --xformers (A1111) or the built-in memory management in ComfyUI. For Flux, FP8 quantisation reduces VRAM usage significantly with minimal quality loss.
  • LoRA and ControlNet — Both ComfyUI and A1111 support LoRA fine-tuned weights and ControlNet for guided generation. Download them into the respective models/loras/ and models/controlnet/ directories.
  • Cost analysis — At scale, self-hosted generation costs a fraction of API pricing. A dedicated RTX 3090 generating roughly 14,000 SDXL images per day costs pennies per image versus $0.01-0.06 per image on API platforms.
  • Explore other models — Once your server is set up, you can run any diffusion model. Check our model guides for walkthroughs on deploying LLMs, vision models, and more.

For teams considering GPU options for mixed workloads, our best GPU for LLM inference guide covers how these same cards perform on language model tasks. You can also explore vision model hosting if your pipeline includes image understanding alongside generation. Browse all available configurations on the dedicated GPU hosting page.

Need a Dedicated GPU Server?

Deploy from RTX 3050 to RTX 5090. Full root access, NVMe storage, 1Gbps — UK datacenter.

Browse GPU Servers

gigagpu

We benchmark, deploy, and optimise GPU infrastructure for AI workloads. All data in our guides comes from real-world testing on our UK-based dedicated GPU servers.

Ready to deploy your AI workload?

Dedicated GPU servers from our UK datacenter. NVMe storage, 1Gbps networking, full root access.

Browse GPU Servers Contact Sales

Have a question? Need help?