From e419e29acda83abb6da79069e42c7c039cf523d4 Mon Sep 17 00:00:00 2001 From: mindesbunister Date: Mon, 6 Oct 2025 10:52:32 +0200 Subject: [PATCH] Add comprehensive Proxmox optimization guide --- PROXMOX_OPTIMIZATIONS.md | 242 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 242 insertions(+) create mode 100644 PROXMOX_OPTIMIZATIONS.md diff --git a/PROXMOX_OPTIMIZATIONS.md b/PROXMOX_OPTIMIZATIONS.md new file mode 100644 index 0000000..69c6098 --- /dev/null +++ b/PROXMOX_OPTIMIZATIONS.md @@ -0,0 +1,242 @@ +# Proxmox Host Optimizations + +## โœ… Yes, Now Supported! + +The one-button optimizer now has **built-in Proxmox host support**. Just run it and select Mode 1! + +```bash +sudo ./one-button-optimizer.sh +``` + +--- + +## ๐ŸŽฏ What Gets Optimized on Proxmox Host + +### Comparison: Desktop vs Proxmox Mode + +| Optimization | Desktop Mode | Proxmox Mode | +|--------------|-------------|--------------| +| **zram** | โœ… 50% of RAM | โŒ Skipped (VMs need RAM) | +| **tmpfs** | โœ… 40% of RAM (6+ mounts) | โš ๏ธ 2GB APT cache only | +| **Kernel params** | `swappiness=1` (aggressive) | `swappiness=10` (balanced) | +| | `dirty_ratio=3` | `dirty_ratio=10` | +| **Networking** | Basic | โœ… BBR + FQ (optimized) | +| **Browser/IDE** | โœ… Auto-configured | โŒ Skipped (N/A) | +| **RAM Impact** | ~40-50% allocated | ~2-3% allocated | + +--- + +## ๐Ÿš€ Proxmox-Specific Optimizations + +### 1. **Kernel Parameters** (Hypervisor-Tuned) + +```bash +# Memory Management (balanced for VMs) +vm.swappiness = 10 # Allow some swap, don't be aggressive +vm.dirty_ratio = 10 # Handle VM write bursts +vm.dirty_background_ratio = 5 # Start background writes earlier +vm.vfs_cache_pressure = 50 # Balance cache usage +vm.min_free_kbytes = 67584 # Keep RAM available + +# Networking (optimized for VM traffic) +net.core.default_qdisc = fq # Fair Queue scheduling +net.ipv4.tcp_congestion_control = bbr # Better bandwidth & latency +net.core.netdev_max_backlog = 5000 +net.ipv4.tcp_max_syn_backlog = 8192 +net.core.rmem_max = 16777216 +net.core.wmem_max = 16777216 + +# File System +fs.file-max = 2097152 # Support many open files +fs.inotify.max_user_watches = 524288 # For file monitoring + +# Stability +kernel.panic = 10 # Auto-reboot on panic +kernel.panic_on_oops = 1 +``` + +**Why these values?** +- `swappiness=10` (not 1): Allows kernel to use swap when beneficial for cache +- `dirty_ratio=10` (not 3): Handles burst writes from multiple VMs +- BBR congestion control: Better throughput for VM network traffic +- FQ qdisc: Fair scheduling for multiple VMs competing for bandwidth + +### 2. **Minimal tmpfs** (Optional) + +```bash +# Only for APT package cache (2GB) +/tmp/tmpfs-cache/apt โ†’ tmpfs 2GB +``` + +**Benefits:** +- Faster `apt upgrade` operations +- Minimal RAM impact (2GB vs 40GB in desktop mode) +- Leaves maximum RAM for VMs + +### 3. **No zram** + +**Desktop Mode:** Creates 50% RAM as compressed swap +**Proxmox Mode:** โŒ **Skipped entirely** + +**Reason:** +- VMs need predictable, direct RAM access +- zram adds latency and unpredictability +- Proxmox already manages memory efficiently + +### 4. **No Desktop Applications** + +Skips: +- Browser cache configuration +- IDE configuration +- NPM/Pip cache setup + +**Why:** Proxmox hosts typically don't run GUI apps + +--- + +## ๐Ÿ” Comparison: Similar but Different + +### What's Similar to Desktop VMs? + +Both desktop VMs and Proxmox hosts benefit from: + +โœ… **Kernel tuning** - But with different values! +- Desktop: Aggressive (`swappiness=1`) +- Proxmox: Balanced (`swappiness=10`) + +โœ… **Network optimization** - Both use BBR & FQ + +โœ… **File system tuning** - Open file limits, inotify + +### What's Different? + +โŒ **RAM allocation strategy** +- Desktop: Use lots of RAM for caching (you have it!) +- Proxmox: Minimize host usage (VMs need it!) + +โŒ **Swap strategy** +- Desktop: Compressed swap in RAM (zram) +- Proxmox: Traditional swap or none + +โŒ **Cache strategy** +- Desktop: Aggressive tmpfs everywhere +- Proxmox: Minimal tmpfs, let VMs cache + +--- + +## ๐Ÿ“Š Real-World Impact on Proxmox + +### Before Optimization: +``` +vm.swappiness = 60 # Default (too high for hypervisor) +vm.dirty_ratio = 20 # Default (causes write stalls) +TCP congestion = cubic # Default (suboptimal) +APT operations = disk I/O # Slower updates +``` + +### After Optimization (Proxmox Mode): +``` +vm.swappiness = 10 # Balanced for VMs +vm.dirty_ratio = 10 # Smoother writes +TCP congestion = bbr # Better VM networking +APT operations = RAM speed # Faster updates +``` + +### Expected Improvements: +- ๐Ÿ“ˆ **VM Network:** 10-30% better throughput with BBR +- ๐Ÿ’พ **Host Updates:** 50-70% faster `apt upgrade` +- โšก **Write Performance:** Smoother, less stalling +- ๐Ÿ“Š **Memory:** 2GB vs 40GB allocation (huge difference!) + +--- + +## ๐ŸŽฏ Decision Tree + +``` +Are you on Proxmox host? +โ”‚ +โ”œโ”€ YES: Run one-button-optimizer +โ”‚ โ”‚ +โ”‚ โ”œโ”€ Want to optimize HOST? +โ”‚ โ”‚ โ””โ”€ Choose Mode 1 (Proxmox) +โ”‚ โ”‚ โœ… Hypervisor-tuned +โ”‚ โ”‚ โœ… Minimal RAM usage +โ”‚ โ”‚ โœ… Network optimized +โ”‚ โ”‚ +โ”‚ โ””โ”€ Want to optimize desktop VM? +โ”‚ โ””โ”€ SSH into VM, run there +โ”‚ โœ… Full desktop optimizations +โ”‚ โœ… Browser/IDE caching +โ”‚ โœ… Aggressive tmpfs +โ”‚ +โ””โ”€ NO (regular desktop): Run one-button-optimizer + โ””โ”€ Enjoy full desktop optimizations! +``` + +--- + +## ๐Ÿ’ก Best Practices + +### โœ… DO: +1. **Run in Proxmox Mode on host** - Safe, beneficial +2. **Run in Desktop Mode inside VMs** - Perfect use case +3. **Use minimal tmpfs** - 2GB APT cache is plenty +4. **Apply network optimizations** - BBR helps all VMs + +### โŒ DON'T: +1. **Run Desktop Mode on Proxmox host** - Wastes VM RAM +2. **Skip network tuning** - Free performance win +3. **Ignore kernel parameters** - They really help + +--- + +## ๐Ÿงช Testing Proxmox Optimizations + +### Test Network Improvement: +```bash +# Before and after comparison +iperf3 -c -t 30 + +# Expected: 10-30% better throughput with BBR +``` + +### Test APT Speed: +```bash +# Clear cache first +apt-get clean + +# Time an update +time apt-get update +time apt-get upgrade + +# With tmpfs: significantly faster +``` + +### Monitor VM Performance: +```bash +# Check if VMs have enough RAM +free -h + +# Monitor VM responsiveness +pveperf + +# Watch network stats +nload +``` + +--- + +## ๐Ÿ“– Summary + +**Yes, Proxmox hosts CAN be optimized**, but differently than desktops: + +| Aspect | Approach | +|--------|----------| +| RAM Strategy | **Minimize host usage, maximize for VMs** | +| Swap Strategy | **No zram, traditional swap** | +| Cache Strategy | **Minimal tmpfs, let VMs handle caching** | +| Kernel Tuning | **Balanced, not aggressive** | +| Network | **Optimized (BBR, FQ) for VM traffic** | + +**Result:** Better VM performance without sacrificing host resources! ๐Ÿš€ +