Optimizing LLM inference performance with Dual RTX 3090 + NVLink on Proxmox #161
Replies: 1 comment
|
Really appreciate you writing this up @duart — and for flagging it's AI-summarized. The host-tuning checklist (NUMA alignment, CPU pinning, HugePages, performance governor) is solid general hygiene and the meta-point ("attention to the whole stack, not just the GPU") is right. One reframe that should help you recover the rest of the performance, not just the 3×: Our own reference rig also runs under Proxmox — 2× RTX 3090, PCIe-only (no NVLink), GPUs passed through to the VM, and zero of your optimizations applied (stock governor, no HugePages, no manual pinning). It sustains the documented dual-card baselines untuned: The one hardware difference between your rig and ours explains both: you have NVLink across two passed-through GPUs; we don't. NVLink-over-VM-passthrough is a notoriously fragile path — when IOMMU grouping / ACS / NUMA placement is off, NCCL silently can't use the NVLink peer link and collapses to a slow cross-bridge fallback (exactly a ~3×-down floor). Your NUMA-alignment + pinning changes most likely let NVLink actually engage, rather than fixing "Proxmox" per se. This is a known recurring class here — see #137 (NVLink-not-engaging under container/VM passthrough). The tell: a correctly engaged NVLink 2×3090 runs ~10–15% faster than our PCIe-only baseline (per our controlled NVLink A/Bs) — comfortably north of 80–90 on the same workload, not 60. So you've recovered most of a collapsed-NVLink penalty but likely not all of it; there's real headroom left. To confirm whether NVLink is now actually being used and find the remaining gap: Thanks again — the NUMA-alignment angle for multi-socket passthrough hosts is genuinely useful; I've folded a credited pointer into our container-runtimes notes. |
Uh oh!
There was an error while loading. Please reload this page.
Optimizing LLM inference performance with 2x RTX 3090 + NVLink on Proxmox
I used AI to summarize my experiences, so the text below may not sound fully natural, even after I've edited it.
Problem
I was struggling to achieve the benchmarked performance declared in documentation using 2x RTX 3090 GPUs with NVLink. After spending several hours investigating potential solutions, I finally achieved a 3x performance improvement (from ~20 tokens per second to 60 tokens per second ) through VM configuration changes. It still not perfect, but already enough to make this configuration usable for agentic tasks.
Hardware & Software Stack
The Solution
Three key optimizations were essential to achieving the expected performance:
1. CPU Dedication (CPU Pinning)
Pinning vCPUs to specific physical cores prevents the hypervisor from migrating VM threads, which can cause performance degradation and unpredictable latency spikes. This is important for latency-sensitive workloads like LLM inference (as some forums suggest).
2. HugePages
Enabling HugePages reduces the number of pages the CPU must manage, improving memory performance. Instead of managing hundreds of thousands of default 4KB pages, HugePages with 1GB pages, reducing TLB misses and memory translation overhead (as some forums suggest).
3. Better CPU frequencies setup
Setting the CPU scaling governor to ~ performance (accelerator-performance in tuned ) mode ensures the CPU runs at optimal frequencies by maintaining constant clock speeds at the highest available frequency within limits. This prevents the CPU from scaling down during idle periods and eliminates latency from frequency transitions.
Results
Key Takeaways
If you're running LLM inference on Proxmox with similar types of GPUs, ensure you've properly configured CPU dedication and frequencies management and HugePages before assuming your hardware is underperforming.
This experience highlights that achieving benchmarked performance requires attention to the entire stack—not just the GPU hardware.
Some references:
Complete Guide: Proxmox VM Optimization for LLM Inference
📋 Overview
Goal: Improve LLM inference performance from ~20 tokens/second to 60+ tokens/second on VM with dual RTX 3090 GPUs.
Hardware: Proxmox host with dual RTX 3090s (NVLink), VM ID 200 in my case
Result Achieved: All optimizations successfully implemented and verified ✅
🎯 Optimizations Applied
Expected Total Gain: 200% improvement (20 → 60 tokens/second)
🔧 Settings Needed
1. Host System Settings
GRUB Configuration
Sysctl Configuration
Tuned Profile (better CPUs frequency management for GPU accelerators)
2. VM 200 Configuration
Expected output:
💻 Code to Achieve (AI generated by Claude Sonnet)
Hook Script (configuration need to be applied before and after VM runs)
✅ Code to Test
1. Verify VM Configuration
2. Verify Hugepages
3. Verify vCPU Pinning
4. Verify Tuned Profile
5. Verify Hook Script Execution
6. Verify NUMA Alignment
7. Monitor CPU Usage
8. Monitor GPU Usage
9. Performance Test (Inside VM)
10. Complete Verification Script
📊 Architecture Summary
🎯 Expected Performance
📝 Key Files Reference
/etc/default/grub/etc/sysctl.conf/etc/pve/qemu-server/200.conf/var/lib/vz/snippets/hook-200.sh✅ Checklist
accelerator-performanceAll reactions