--- title: Two DGX Spark 128 GB Units for Local AI: Single Node vs Nginx Load-Balanced vLLM in Grafana url: https://devopstales.github.io/ai/dgx-spark-128gb-local-ai-vllm-nginx-load-balancing/ date: 2026-10-27 --- We bought two NVIDIA DGX Spark units with 128 GB of unified memory each to run large language models locally. Before trusting them with real workloads, we needed to know how they behave under load: one node by itself, two nodes behind a load balancer, and anywhere from one to sixteen people sending requests at the same time. This post is the step-by-step record of how we measured it and how we visualized the results in Grafana. The monitoring stack — Prometheus, Grafana, and the Nginx load balancer — runs on a separate server, while both DGX Spark nodes run independent vLLM instances. It covers preparing the nodes, running vLLM on a single node and across two load-balanced instances, benchmarking with 1, 4, 8, and 16 concurrent users, scraping vLLM metrics into Prometheus, and building the Grafana dashboards that made the comparison readable. <!--more--> ![Benchmarking DGX Spark local AI inference](/img/ai-code.webp) *Two DGX Spark units, each running independent vLLM, with Nginx load balancing on a separate server* ## A quick terminology note before we begin DGX Spark does not have a discrete 128 GB GPU. It has the NVIDIA GB10 Grace Blackwell Superchip, where the Blackwell GPU and the 20-core Arm CPU share one coherent pool of 128 GB LPDDR5X memory at 273 GB/s. That matters for vLLM capacity planning: the model weights and the KV cache compete with the OS and CPU processes for the same 128 GB pool, so usable space for inference is less than 128 GB per node. Two units can be connected through the ConnectX-7 NIC (200 Gbps). In this post we do not split one model across both nodes. Instead we run one independent vLLM instance per node and let Nginx round-robin requests between them. That doubles request capacity for models that already fit on one node, but it does not pool memory for a single model larger than 128 GB. ## Why we ran vLLM in Docker You might wonder whether running vLLM inside Docker costs performance compared to bare metal. For inference it does not — the GPU is the bottleneck, and `--gpus all` passes the GB10 through to the container with direct access to compute and memory bandwidth. The overhead is negligible. We chose Docker anyway for three practical reasons: **Reproducibility across both nodes.** The same image runs identically on spark-1 and spark-2, so the single-node baseline and the two-instance cluster use exactly the same CUDA, Python, and vLLM versions. **Isolation.** vLLM and its Python dependencies are pinned inside the image. They do not collide with system packages on DGX OS, and you can tear down and rebuild the container between runs without touching the host. **Shared memory.** vLLM needs a large `/dev/shm`. Docker makes this explicit with `--shm-size 16g`, so you do not accidentally starve the inference engine of shared memory on the host. The flags that matter for performance parity with bare metal: ```bash docker run --gpus all --shm-size 16g -p 8000:8000 vllm/vllm-openai:latest ... ``` If you profile both setups and see no difference, keep Docker for the reproducibility. If you prefer bare metal, install vLLM into a pinned virtualenv on DGX OS and run it directly — the results should match. ## What we measured | Stack | Nodes | Memory pool | vLLM mode | |-------|-------|-------------|-----------| | Single | 1 | 128 GB | One vLLM instance on spark-1 | | Load-balanced | 2 | 128 GB per node | One independent vLLM per node, Nginx round-robin | For each stack we ran vLLM and hit it with `vllm bench serving` at four concurrency levels: 1, 4, 8, and 16 parallel users. We recorded: - Time to first token (TTFT) — p50 and p99 - Inter-token latency (ITL) — p50 and p99 - Throughput — generated tokens per second - Requests per second - KV cache usage percentage - Running versus waiting request count - Error rate The goal was to see where each stack falls over: does latency grow linearly, does the queue back up, and at what concurrency does KV cache pressure force vLLM to reject requests? ## The lab layout The DGX Spark nodes run vLLM only. Prometheus, Grafana, and Nginx live on a separate server. ```plaintext bench client Grafana:3000 | ^ | HTTP | PromQL v | +---------------+ | | Nginx:80 |---------------+ | (mon-server) | | round robin | +-------+-------+ | +----+----+ | | v v +---------+ +---------+ | spark-1 | | spark-2 | | vLLM:8000| | vLLM:8000| | /metrics | | /metrics | +---------+ +---------+ | | +----+----+ | v +-------------+ | Prometheus:9090| (mon-server) +-------------+ ``` ### Hosts we used | Host | Role | IP | |------|------|----| | spark-1 | vLLM instance 1 | 192.168.1.10 | | spark-2 | vLLM instance 2 | 192.168.1.11 | | mon-server | Prometheus, Grafana, Nginx | 192.168.1.20 | | bench | Benchmark client | 192.168.1.30 | Adjust the addresses to your LAN. ## Step 1: Prepare both DGX Spark nodes DGX OS ships with the NVIDIA driver and Docker. We still needed Docker Compose and user access to Docker. ```bash # Run on both spark-1 and spark-2 sudo apt-get update sudo apt-get install -y docker-compose-plugin git curl # Allow your user to run docker without sudo sudo usermod -aG docker $USER newgrp docker ``` Verify the GPU is visible inside a container: ```bash docker run --rm --gpus all nvidia/cuda:12.6-base-ubuntu22.04 nvidia-smi ``` You should see the GB10 Blackwell GPU and roughly 128 GB of memory. ## Step 2: Network the cluster and the monitoring server Both DGX Spark nodes need to reach each other and mon-server, and mon-server needs to reach both nodes on port 8000. ```bash # On spark-1 sudo hostnamectl set-hostname spark-1 echo "192.168.1.10 spark-1" | sudo tee -a /etc/hosts echo "192.168.1.11 spark-2" | sudo tee -a /etc/hosts echo "192.168.1.20 mon-server" | sudo tee -a /etc/hosts ``` ```bash # On spark-2 sudo hostnamectl set-hostname spark-2 echo "192.168.1.10 spark-1" | sudo tee -a /etc/hosts echo "192.168.1.11 spark-2" | sudo tee -a /etc/hosts echo "192.168.1.20 mon-server" | sudo tee -a /etc/hosts ``` ```bash # On mon-server sudo hostnamectl set-hostname mon-server echo "192.168.1.10 spark-1" | sudo tee -a /etc/hosts echo "192.168.1.11 spark-2" | sudo tee -a /etc/hosts echo "192.168.1.20 mon-server" | sudo tee -a /etc/hosts ``` Test connectivity: ```bash ping -c 3 spark-2 ``` Open the ports each DGX Spark node needs: ```bash # On both spark-1 and spark-2, if ufw is active sudo ufw allow 8000/tcp # vLLM API and /metrics ``` On mon-server, open the ports Prometheus, Grafana, and Nginx need: ```bash # On mon-server sudo ufw allow 9090/tcp # Prometheus sudo ufw allow 3000/tcp # Grafana sudo ufw allow 80/tcp # Nginx load balancer ``` ## Step 3: Run Nginx load balancer on mon-server Nginx sits in front of the two independent vLLM instances and round-robins requests between spark-1 and spark-2. The bench client talks only to Nginx. ```nginx # /etc/nginx/conf.d/vllm.conf on mon-server upstream vllm_cluster { server 192.168.1.10:8000; server 192.168.1.11:8000; } server { listen 80; server_name mon-server; location / { proxy_pass http://vllm_cluster; proxy_http_version 1.1; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_read_timeout 300s; proxy_send_timeout 300s; } location /health { return 200 "ok\n"; add_header Content-Type text/plain; } } ``` ```bash # On mon-server sudo nginx -t sudo systemctl reload nginx ``` Verify both backends are reachable: ```bash curl -s http://192.168.1.10:8000/v1/models curl -s http://192.168.1.11:8000/v1/models curl -s http://192.168.1.20/v1/models # via Nginx ``` ## Step 4: Run vLLM on a single node Pull a model that fits in 128 GB unified memory. Llama-3.1-70B at 4-bit quantized weights is a good fit; a dense 70 B model needs roughly 140 GB at FP16, so quantization matters here. ```bash # On spark-1 only docker run -d --name vllm-single \ --gpus all \ --shm-size 16g \ -p 8000:8000 \ vllm/vllm-openai:latest \ --model meta-llama/Llama-3.1-70B-Instruct \ --quantization awq \ --max-model-len 8192 \ --gpu-memory-utilization 0.85 \ --tensor-parallel-size 1 ``` Wait for startup, then verify: ```bash # On spark-1 curl -s http://localhost:8000/v1/models | python3 -m json.tool | head -20 curl -s http://localhost:8000/metrics | head -20 ``` The `/metrics` endpoint is what Prometheus on mon-server will scrape. ## Step 5: Run two independent vLLM instances behind Nginx For the load-balanced stack we run one vLLM instance on each DGX Spark node. Nginx distributes incoming requests between them. This is useful when your model fits on one node and you want to serve more concurrent users without splitting a single model across the network. Start vLLM on spark-1: ```bash # On spark-1 docker run -d --name vllm-node-1 \ --gpus all \ --shm-size 16g \ -p 8000:8000 \ vllm/vllm-openai:latest \ --model meta-llama/Llama-3.1-70B-Instruct \ --quantization awq \ --max-model-len 8192 \ --gpu-memory-utilization 0.85 \ --tensor-parallel-size 1 ``` Start vLLM on spark-2: ```bash # On spark-2 docker run -d --name vllm-node-2 \ --gpus all \ --shm-size 16g \ -p 8000:8000 \ vllm/vllm-openai:latest \ --model meta-llama/Llama-3.1-70B-Instruct \ --quantization awq \ --max-model-len 8192 \ --gpu-memory-utilization 0.85 \ --tensor-parallel-size 1 ``` Verify both answer: ```bash curl -s http://192.168.1.10:8000/v1/models curl -s http://192.168.1.11:8000/v1/models ``` vLLM version flags change between releases. If the command above does not match your installed vLLM, run `vllm serve --help` and adjust. ## Step 6: Benchmark at 1, 4, 8, and 16 concurrent users We used `vllm bench serving` against the single-node endpoint and the load-balanced endpoint. Run each concurrency level separately and save the output. ```bash # On the bench client (192.168.1.30) pip install vllm ENDPOINT=http://192.168.1.20 # via Nginx on mon-server # For direct single-node testing: ENDPOINT=http://192.168.1.10:8000 for CONCURRENCY in 1 4 8 16; do echo "=== Concurrency $CONCURRENCY ===" vllm bench serving \ --model meta-llama/Llama-3.1-70B-Instruct \ --dataset-name sharegpt \ --request-rate 8 \ --max-concurrency $CONCURRENCY \ --num-prompts 200 \ --endpoint $ENDPOINT/v1/completions \ | tee "results-lb-c${CONCURRENCY}.txt" done ``` Key flags: - `--request-rate` — requests per second offered load. Use 8 (unlimited) to let concurrency drive the load. - `--max-concurrency` — how many requests are in flight at once (1, 4, 8, 16). - `--num-prompts` — total requests in the run. 200 gives stable percentiles. Repeat the same loop against the single-node endpoint (`http://192.168.1.10:8000`) and save to `results-single-cN.txt`. Each run prints a summary like: ```plaintext Throughput: 12.34 requests/s, 567.89 tokens/s Mean TTFT: 0.456 s, Median TTFT: 0.412 s, P99 TTFT: 1.234 s Mean ITL: 0.023 s, Median ITL: 0.021 s, P99 ITL: 0.087 s ``` Keep all four output files per stack. You will compare them side by side in the next step. ## Step 7: Scrape vLLM metrics into Prometheus on mon-server Prometheus runs on mon-server and scrapes the `/metrics` endpoint on both DGX Spark nodes. ```yaml # prometheus.yml on mon-server global: scrape_interval: 5s evaluation_interval: 15s scrape_configs: - job_name: "vllm-single" static_configs: - targets: ["192.168.1.10:8000"] - job_name: "vllm-load-balanced" static_configs: - targets: ["192.168.1.10:8000", "192.168.1.11:8000"] - job_name: "prometheus" static_configs: - targets: ["localhost:9090"] - job_name: "nginx" static_configs: - targets: ["192.168.1.20:9113"] ``` Run Prometheus with Docker Compose on mon-server: ```yaml # docker-compose.yml on mon-server services: prometheus: image: prom/prometheus:latest container_name: prometheus ports: - "9090:9090" volumes: - ./prometheus.yml:/etc/prometheus/prometheus.yml:ro command: - "--config.file=/etc/prometheus/prometheus.yml" - "--web.enable-lifecycle" nginx-exporter: image: nginxprometheus/nginx-exporter:latest container_name: nginx-exporter ports: - "9113:9113" args: - "-nginx.scrape-uri=http://127.0.0.1/stub_status" grafana: image: grafana/grafana-oss:latest container_name: grafana ports: - "3000:3000" volumes: - grafana-data:/var/lib/grafana environment: - GF_SECURITY_ADMIN_PASSWORD=admin depends_on: - prometheus - nginx-exporter volumes: grafana-data: ``` ```bash # On mon-server docker compose up -d ``` Verify all targets are UP: ```bash # On mon-server curl -s http://localhost:9090/api/v1/targets | python3 -m json.tool ``` You should see `prometheus`, `nginx`, `vllm-single`, and `vllm-load-balanced` all showing `health: "up"`. Important vLLM metrics to watch: | Metric | What it tells you | |--------|-------------------| | `vllm:num_requests_running` | Requests actively being processed | | `vllm:num_requests_waiting` | Requests queued because the batch is full | | `vllm:gpu_cache_usage_perc` | KV cache pressure; near 100% means new requests wait | | `vllm:e2e_request_latency_seconds` | End-to-end latency histogram (TTFT + decode) | | `vllm:time_per_output_token_seconds` | Inter-token latency histogram | | `vllm:request_success` / `vllm:request_failure` | Request success and failure counters | Metric names can shift between vLLM versions. Hit `http://<node>:8000/metrics` and confirm the exact names before writing queries. ## Step 8: Run Grafana on mon-server and connect Prometheus Grafana is already in the Compose file above. Open `http://192.168.1.20:3000`, log in as `admin` / `admin`, then: 1. Configuration -> Data sources -> Add data source -> Prometheus 2. URL: `http://localhost:9090` 3. Save and test. ## Step 9: Build the Grafana dashboards Create a new dashboard called "DGX Spark vLLM Load-Balanced Benchmarks". Add these panels: ### Row 1: Latency **TTFT p95 (seconds)** ```promql histogram_quantile( 0.95, sum by (le) (rate(vllm:e2e_request_latency_seconds_bucket[5m])) ) ``` **Inter-token latency p95 (seconds)** ```promql histogram_quantile( 0.95, sum by (le) (rate(vllm:time_per_output_token_seconds_bucket[5m])) ) ``` ### Row 2: Throughput **Requests per second** ```promql sum(rate(vllm:request_success[5m])) ``` **Tokens per second** vLLM does not always expose a tokens-per-second counter directly; derive it from request completions and output tokens, or use the token counter family your version exposes. Check `/metrics` for a token counter. ### Row 3: Saturation **KV cache usage (%)** ```promql max by (instance) (vllm:gpu_cache_usage_perc) ``` **Running vs waiting requests** ```plaintext Running Waiting | | v v [ active batch ] [ queue ] ``` Panel queries: ```promql max by (instance) (vllm:num_requests_running) max by (instance) (vllm:num_requests_waiting) ``` A climbing `waiting` count while `running` stays flat means the batch is saturated — that is your concurrency ceiling. ### Row 4: Errors **Error rate** ```promql 1 - ( sum(rate(vllm:request_success[5m])) / sum(rate(vllm:request_success[5m]) + rate(vllm:request_failure[5m])) ) ``` ### Row 5: Nginx (load balancer) **Active connections** ```promql nginx_connections_active ``` **Requests per second** ```promql rate(nginx_http_requests_total[5m]) ``` **5xx response rate** ```promql rate(nginx_http_requests_total{status=~"5.."}[5m]) ``` Add a legend label `instance` to every panel so spark-1 and spark-2 traces are distinguishable. Save the dashboard. Export it as JSON (`Dashboard settings -> JSON -> Save to local file`) so you can re-import it after a rebuild. ## Step 10: Compare single vs load-balanced results Run the four concurrency levels on the single stack, then repeat on the load-balanced stack while Grafana is recording. Switch the dashboard instance filter between `spark-1`, `spark-2`, and the aggregated view. | Concurrency | Stack | TTFT p95 | ITL p95 | Tokens/s | KV cache peak | Waiting queue | |-------------|-------|----------|---------|----------|---------------|---------------| | 1 | Single | — | — | — | — | — | | 4 | Single | — | — | — | — | — | | 8 | Single | — | — | — | — | — | | 16 | Single | — | — | — | — | — | | 1 | Load-balanced | — | — | — | — | — | | 4 | Load-balanced | — | — | — | — | — | | 8 | Load-balanced | — | — | — | — | — | | 16 | Load-balanced | — | — | — | — | — | Replace the dashes with your own numbers. What to look for: - **Single node**: TTFT and ITL stay flat until KV cache usage climbs toward 80-90%, then waiting requests appear and p99 latency spikes. That point is the node's practical concurrency limit. - **Load-balanced**: higher concurrency before the queue builds because two independent instances serve requests in parallel. TTFT stays low because there is no inter-node network hop per token. The limit is that each node still has only 128 GB, so a single model larger than that cannot run here. ## What we concluded With two DGX Spark 128 GB units behind Nginx: - A single node is the right choice for lowest latency at 1-4 concurrent users. - The Nginx load-balanced stack pays off at 8-16 concurrent users for models that fit on one node, because two independent instances double request capacity without network hops between decode steps. - It does not help you run a model larger than 128 GB. For that you need tensor parallelism across both nodes, which is covered in the companion post on Ray clustering. - vLLM's `/metrics` plus Prometheus and Grafana made the saturation point visible instead of guessed: watch `vllm:gpu_cache_usage_perc` and `vllm:num_requests_waiting` as your primary alerts. If you repeat this, pin the vLLM version, record the exact model and quantization in the benchmark output file name, and keep the Grafana dashboard JSON in git alongside the results. What concurrency ceiling did you hit on your DGX Spark setup — and which metric warned you first, latency or queue depth?