243 lines
6.2 KiB
Markdown
243 lines
6.2 KiB
Markdown
# 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 <target> -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! 🚀
|
|
|