We had 88 instances of i7-13700H laptops with 16GB RAM and Intel UHD 770 GPUs sitting in a lab. We wanted to turn them into a self-hosted LLM inference cluster that runs 24/7 — no cloud, no API keys, no budget. Here’s how we did it.

The cluster is live at swarm.ftds.online. Source code: ftulabs/cluster.

Architecture

The design is straightforward: one leader node runs the orchestrator, load balancer, and monitoring stack. The remaining nodes are workers, each running a quantized LLM via llama.cpp. An Nvidia Jetson Xavier runs a larger 35B MoE model with CUDA for higher-quality responses.

┌──────────────────────────────────────────────────────────┐
│  Leader (10.0.190.65)                                    │
│  ┌──────────┐ ┌───────────┐ ┌───────┐ ┌──────────┐     │
│  │ Open     │ │  CrewAI   │ │Grafana│ │Prometheus│     │
│  │ WebUI    │ │  Master   │ │       │ │          │     │
│  │ :3001    │ │  :9091    │ │ :3000 │ │  :9090   │     │
│  └────┬─────┘ └─────┬─────┘ └───────┘ └──────────┘     │
│       └──────┬───────┘                                   │
│              ▼                                           │
│  ┌──────────────────────┐                                │
│  │  nginx llm-proxy     │  weighted round-robin          │
│  │  :8888               │  Xavier weight=4, workers w=1  │
│  └──────┬──────┬────────┘                                │
│    ┌────▼──┐ ┌─▼────────────────────────────────────┐    │
│    │Xavier │ │ 40 x i7 Workers (Swarm, :8080)       │    │
│    │35B MoE│ │ Qwen3.5-4B each, round-robin         │    │
│    │CUDA   │ └──────────────────────────────────────┘    │
│    │:8081  │                                             │
│    └───────┘                                             │
└──────────────────────────────────────────────────────────┘

Stack

  • Docker Swarm — orchestration across all 40+ nodes
  • llama.cpp — GGUF model inference, OpenAI-compatible API on each worker
  • nginx — weighted round-robin proxy (Xavier gets 4x weight, workers get 1x)
  • CrewAI — multi-agent orchestrator on the leader node
  • Redis — shared state store
  • Prometheus + Grafana — metrics and dashboards
  • Open WebUI — chat interface at port 3001
  • Ansible — automated bootstrap for all nodes

Deployment

We automated the entire setup with Ansible. A single playbook handles Docker installation, GPU auto-detection, Swarm initialization, node labeling, model distribution (~2.6GB per node), image builds, and stack deployment.

# Configure inventory
# ansible/inventory.ini
[leader]
10.0.190.65 ansible_user=minh

[workers]
10.0.190.101 ansible_user=worker
10.0.190.102 ansible_user=worker
# ... up to 40 nodes

# Run bootstrap
ansible-playbook -i ansible/inventory.ini ansible/bootstrap.yml

# Verify
curl http://10.0.190.65:8888/v1/models
curl http://10.0.190.65:3001  # Web UI

For quick local testing, you can spin up a single node with Docker Compose:

./scripts/download-model.sh
docker compose -f docker-compose.local.yml up -d
./scripts/test-agent.sh

Routing & Load Balancing

nginx handles request routing with weighted round-robin. The Xavier node (35B MoE model, ~11.4 tok/s with CUDA) gets weight=4, absorbing ~80% of traffic when idle. The 40 worker nodes (Qwen3.5-4B, ~2 tok/s each, 4 parallel slots per node) handle overflow under heavy load.

Under >4 concurrent users, requests automatically spill into the worker pool. The API is fully OpenAI-compatible — any tool that speaks the OpenAI API works out of the box, no API key required on the LAN.

# Chat via API (works with any OpenAI-compatible client)
curl http://10.0.190.65:8888/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-3.5-turbo",
    "messages": [{"role":"user","content":"Hello!"}],
    "max_tokens": 500
  }'

Multi-Agent Orchestration

The CrewAI master service on the leader node coordinates multi-agent workflows. You submit a goal, and the orchestrator distributes sub-tasks across available workers, tracks progress in Redis, and returns aggregated results.

# Submit a goal
curl -X POST http://localhost:9091/goal \
  -H "Content-Type: application/json" \
  -d '{"goal": "Analyze the top 5 programming languages by popularity"}'

# Check workers
curl http://localhost:9091/workers

# Check performance
curl http://localhost:9091/performance

# Trigger calibration
curl -X POST http://localhost:9091/calibrate

Services Overview

Service Port Description
Worker (LLM) 8080 llama.cpp server, OpenAI-compatible API
Master (Orchestrator) 9091 CrewAI orchestrator, POST /goal
Open WebUI 3001 Chat interface
nginx proxy 8888 Weighted round-robin LLM proxy
Redis 6379 State store
Prometheus 9090 Metrics
Grafana 3000 Dashboards

What We Learned

  • Quantized 4B models on CPU are slow (~2 tok/s) but usable when you have 40 of them behind a load balancer.
  • Docker Swarm is underrated — simple, stable, and good enough for our scale. No need for Kubernetes.
  • The biggest bottleneck was network setup: getting 40+ machines on the same subnet and keeping them there reliably.
  • Ansible made the difference between “this will take a week” and “this takes 20 minutes.”

Links