A comprehensive optimization tool specifically designed for Linux virtual machines running on Proxmox VE. This tool automatically detects your system configuration and applies optimal settings for memory management, disk I/O, network performance, and Proxmox-specific features.
Author: David Touzeau dtouzeau@gmail.com License: MIT Language: Go 1.21+
Optional cache dropping for cleanup
Disk I/O Optimization
Persistent udev rules creation
Network Performance
IPv6 optimizations
Proxmox VM Specific
Unnecessary service disabling
Safety Features
cd proxmox-optimizer
go mod init proxmox-optimizer
go mod tidy
go build -ldflags="-s -w" -o proxmox-optimizer
sudo cp proxmox-optimizer /usr/local/bin/
sudo chmod +x /usr/local/bin/proxmox-optimizer
Show system information:
sudo proxmox-optimizer -info
Apply all optimizations with automatic backup:
sudo proxmox-optimizer
Dry-run to see what would be changed:
sudo proxmox-optimizer -dry-run
Apply specific optimization categories:
# Memory optimizations only
sudo proxmox-optimizer -optimize memory
# Disk I/O optimizations only
sudo proxmox-optimizer -optimize disk
# Network optimizations only
sudo proxmox-optimizer -optimize network
# Proxmox VM specific optimizations only
sudo proxmox-optimizer -optimize proxmox
# All optimizations (default)
sudo proxmox-optimizer -optimize all
For high-performance systems (use with caution):
sudo proxmox-optimizer -aggressive
Aggressive mode applies: - Swappiness = 1 (minimal swapping) - Smaller dirty page ratios - BBR congestion control - Performance CPU governor - Cache dropping - Higher buffer sizes
Generate a sample configuration:
proxmox-optimizer -generate-config > optimizer-config.json
Use custom configuration:
sudo proxmox-optimizer -config optimizer-config.json
Example configuration file:
{
"memory": {
"swappiness": 10,
"cache_pressure": 100,
"dirty_ratio": 15,
"dirty_background_ratio": 10,
"enable_hugepages": true,
"drop_caches": false
},
"disk": {
"ssd_scheduler": "mq-deadline",
"hdd_scheduler": "mq-deadline",
"readahead_ssd": 256,
"readahead_hdd": 2048,
"nr_requests": 128,
"enable_write_cache": false
},
"network": {
"rmem_max": 16777216,
"wmem_max": 16777216,
"tcp_mem_min": 4096,
"tcp_mem_default": 87380,
"tcp_mem_max": 16777216,
"congestion_control": "cubic",
"netdev_max_backlog": 2000,
"somaxconn": 1024,
"enable_ipv6": true
},
"proxmox": {
"enable_guest_agent": true,
"optimize_virtio": true,
"enable_balloon": true,
"optimize_rng": true,
"enable_timesync": true,
"disable_unnecessary_services": false,
"cpu_governor": "ondemand"
}
}
Create backup without applying changes:
sudo proxmox-optimizer -backup -dry-run
Disable automatic backup:
sudo proxmox-optimizer -backup=false
Restore from backup:
sudo proxmox-optimizer -restore /var/backups/proxmox-optimizer/backup-20250114-120000.tar.gz
List available backups:
ls -lh /var/backups/proxmox-optimizer/
The tool modifies the following kernel parameters:
Memory:
- vm.swappiness - Controls swap usage preference
- vm.vfs_cache_pressure - Inode/dentry cache reclaim pressure
- vm.dirty_ratio - Percentage of RAM that can be filled with dirty pages
- vm.dirty_background_ratio - Background writeback threshold
- vm.min_free_kbytes - Minimum free memory reserved
- vm.page-cluster - Swap readahead pages (0 for SSD)
Network:
- net.core.rmem_max / net.core.wmem_max - Maximum socket buffer sizes
- net.ipv4.tcp_rmem / net.ipv4.tcp_wmem - TCP buffer sizes
- net.ipv4.tcp_mem - TCP memory allocation
- net.ipv4.tcp_congestion_control - Congestion control algorithm
- net.core.netdev_max_backlog - Network device backlog
- net.core.somaxconn - Socket listen backlog
- net.ipv4.tcp_fastopen - TCP Fast Open
- net.ipv4.tcp_mtu_probing - Path MTU discovery
- Many more TCP/IP optimizations...
Per-device optimizations:
- I/O scheduler (/sys/block/*/queue/scheduler)
- Read-ahead buffer (/sys/block/*/queue/read_ahead_kb)
- I/O queue depth (/sys/block/*/queue/nr_requests)
- Write cache settings (/sys/block/*/queue/write_cache)
- Entropy collection (/sys/block/*/queue/add_random)
Persistent rules:
- Udev rules created at /etc/udev/rules.d/60-proxmox-optimizer-disk.rules
Installed/Enabled:
- qemu-guest-agent - Communication with Proxmox host
- rng-tools - Hardware RNG utilization
- systemd-timesyncd - Time synchronization
Potentially Disabled (in aggressive mode):
- bluetooth.service
- ModemManager.service
- avahi-daemon.service
- cups.service
Check applied settings:
# Check sysctl values
sysctl vm.swappiness
sysctl net.ipv4.tcp_congestion_control
# Check disk scheduler
cat /sys/block/sda/queue/scheduler
# Check QEMU guest agent
systemctl status qemu-guest-agent
# View all custom settings
cat /etc/sysctl.d/99-proxmox-optimizer.conf
Before and after benchmarks:
# Disk I/O
sudo fio --name=randread --ioengine=libaio --iodepth=16 --rw=randread --bs=4k --direct=1 --size=1G --numjobs=4 --runtime=60 --group_reporting
# Network throughput
iperf3 -c <server-ip>
# Memory bandwidth
sysbench memory run
Tested on: - Debian 11/12 - Ubuntu 20.04/22.04/24.04 - Proxmox VE 7.x/8.x guests - Kernel 5.4+
Should work on any systemd-based Linux distribution.
/var/backups/proxmox-optimizer/# Check if BBR module is available
modprobe tcp_bbr
lsmod | grep bbr
# If not available, use cubic (default)
# Ensure you're running as root
sudo proxmox-optimizer -info
# Verify sysctl config
cat /etc/sysctl.d/99-proxmox-optimizer.conf
# Manually reload
sudo sysctl --system
# Reload udev
sudo udevadm control --reload-rules
sudo udevadm trigger
Remove all optimizations:
# Restore from latest backup
LATEST_BACKUP=$(ls -t /var/backups/proxmox-optimizer/backup-*.tar.gz | head -1)
sudo proxmox-optimizer -restore "$LATEST_BACKUP"
# Or manually remove
sudo rm /etc/sysctl.d/99-proxmox-optimizer.conf
sudo rm /etc/udev/rules.d/60-proxmox-optimizer-disk.rules
sudo sysctl --system
sudo udevadm control --reload-rules && sudo udevadm trigger
This tool is part of a larger system optimization toolkit. Improvements welcome!
MIT License - See LICENSE file for details
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
David Touzeau dtouzeau@gmail.com
Created for optimizing Proxmox VE virtual machines in production environments.
$ claude mcp add proxmox-optimizer \
-- python -m otcore.mcp_server <graph>