Files
proxmox/docs/10-best-practices/PERFORMANCE_TUNING.md
defiQUG 9c37af10c0 Complete optional next steps: fix references and consolidate duplicates
- Fixed 104 broken references in 59 files
- Consolidated 40+ duplicate status files
- Archived duplicates to reports/archive/duplicates/
- Created scripts for reference fixing and consolidation
- Updated content inconsistency reports

All optional cleanup tasks complete.
2026-01-06 02:25:38 -08:00

6.0 KiB

Performance Tuning Guide

Last Updated: 2025-01-20
Document Version: 1.0
Status: Active Documentation


Overview

This guide provides performance tuning recommendations for Proxmox infrastructure, including host optimization, VM/container optimization, storage optimization, and network optimization.


Host Performance Tuning

CPU Optimization

Settings:

  1. CPU Governor:

    # Set performance governor
    cpupower frequency-set -g performance
    
    # Make permanent
    echo 'GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_pstate=disable"' >> /etc/default/grub
    update-grub
    
  2. CPU Affinity:

    • Pin critical VMs to specific CPU cores
    • Isolate CPU cores for host operations
    • Use CPU sets for resource allocation

Memory Optimization

Settings:

  1. Transparent Huge Pages:

    # Check current setting
    cat /sys/kernel/mm/transparent_hugepage/enabled
    
    # Set to always (for performance)
    echo always > /sys/kernel/mm/transparent_hugepage/enabled
    
  2. Swappiness:

    # Reduce swappiness (default is 60)
    echo 10 > /proc/sys/vm/swappiness
    
    # Make permanent
    echo 'vm.swappiness=10' >> /etc/sysctl.conf
    
  3. Memory Overcommit:

    # Allow memory overcommit (for Proxmox)
    echo 1 > /proc/sys/vm/overcommit_memory
    

Storage Optimization

ZFS Tuning:

  1. ARC Size:

    # Set ARC max size (adjust based on RAM)
    echo 'options zfs zfs_arc_max=4294967296' >> /etc/modprobe.d/zfs.conf
    
  2. ZFS Recordsize:

    # Set recordsize for database workloads
    zfs set recordsize=16k <pool>/<dataset>
    
  3. ZFS Compression:

    # Enable compression (lz4 recommended)
    zfs set compression=lz4 <pool>/<dataset>
    

LVM Tuning:

  1. I/O Scheduler:
    # Set to deadline or noop for SSDs
    echo deadline > /sys/block/sda/queue/scheduler
    

VM/Container Performance

VM Optimization

CPU Settings:

  1. CPU Type:

    • Use host CPU type for best performance
    • Or use specific CPU model matching host
  2. CPU Cores:

    • Allocate appropriate number of cores
    • Avoid over-allocation
    • Consider CPU pinning for critical VMs

Memory Settings:

  1. Memory Allocation:

    • Allocate sufficient memory
    • Use ballooning for dynamic allocation
    • Monitor memory usage
  2. Memory Ballooning:

    # Enable ballooning in VM config
    balloon: 1024
    

Storage Settings:

  1. Disk Cache:

    • Use writeback cache for better performance
    • Use none for critical data integrity
  2. Disk I/O:

    • Set appropriate I/O limits
    • Use SSD storage for high I/O workloads
    • Consider separate storage pools

Container Optimization

Resource Limits:

  1. CPU Limits:

    # Set CPU limit in container config
    lxc.cgroup.cpuset.cpus = "0-3"
    
  2. Memory Limits:

    # Set memory limit
    lxc.cgroup.memory.limit_in_bytes = 2147483648
    
  3. I/O Limits:

    # Set I/O limits
    lxc.cgroup.blkio.weight = 500
    

Network Performance

Network Optimization

Settings:

  1. Network Interface:

    • Use virtio network drivers
    • Enable SR-IOV if available
    • Tune network buffer sizes
  2. Bridge Optimization:

    # Increase bridge forward delay
    echo 0 > /sys/class/net/vmbr0/bridge/forward_delay
    
  3. TCP Tuning:

    # Increase TCP buffer sizes
    echo 'net.core.rmem_max = 16777216' >> /etc/sysctl.conf
    echo 'net.core.wmem_max = 16777216' >> /etc/sysctl.conf
    sysctl -p
    

Monitoring Performance

Key Metrics

  1. CPU:

    • CPU utilization
    • CPU wait time
    • CPU steal time
  2. Memory:

    • Memory usage
    • Swap usage
    • Memory pressure
  3. Storage:

    • I/O wait
    • Disk utilization
    • I/O throughput
  4. Network:

    • Network throughput
    • Packet loss
    • Latency

Monitoring Tools

  1. Proxmox Built-in:

    • Resource usage graphs
    • Performance metrics
    • Historical data
  2. External Tools:

    • Prometheus + Grafana
    • Zabbix
    • Custom monitoring scripts

Performance Benchmarks

Baseline Measurements

Before Optimization:

  • Document current performance
  • Identify bottlenecks
  • Set performance targets

After Optimization:

  • Measure improvements
  • Document results
  • Adjust as needed

Benchmark Tools

  1. CPU:

    # CPU benchmark
    sysbench cpu --cpu-max-prime=20000 run
    
  2. Memory:

    # Memory benchmark
    sysbench memory --memory-total-size=10G run
    
  3. Disk:

    # Disk I/O benchmark
    fio --name=test --ioengine=libaio --iodepth=16 --rw=read --bs=4k --size=1G
    

Troubleshooting Performance Issues

Common Issues

  1. High CPU Usage:

    • Check for runaway processes
    • Review CPU allocation
    • Consider CPU pinning
  2. High Memory Usage:

    • Check for memory leaks
    • Review memory allocation
    • Enable ballooning
  3. High I/O Wait:

    • Check disk I/O
    • Review storage configuration
    • Consider SSD storage
  4. Network Latency:

    • Check network configuration
    • Review network drivers
    • Tune network settings

Best Practices

  1. Regular Monitoring:

    • Monitor performance metrics
    • Identify trends
    • Proactive optimization
  2. Baseline Measurements:

    • Document baseline performance
    • Track changes over time
    • Set performance targets
  3. Gradual Optimization:

    • Make one change at a time
    • Measure impact
    • Document results
  4. Resource Planning:

    • Plan for growth
    • Monitor resource usage
    • Scale proactively


Last Updated: 2025-01-20
Review Cycle: Quarterly