Your VPS comes with conservative default settings that prioritize stability over speed. By tuning a handful of kernel parameters, CPU governors, and I/O schedulers, you can unlock significant performance gains — especially on budget VPS plans where every CPU cycle counts.
Check Your Current Performance Profile
Before making changes, capture a baseline. Run these commands to see your current configuration:
# CPU governor
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
# I/O scheduler
cat /sys/block/sda/queue/scheduler
# Current kernel parameters
sysctl -a | grep -E "swappiness|dirty_ratio|dirty_background"
1. Switch the CPU Governor to Performance
Most VPS instances default to the ondemand or powersave CPU governor, which scales clock speed down when the server is idle. For consistent performance, switch to the performance governor. This keeps the CPU running at maximum frequency at all times.
sudo apt install linux-tools-common cpufrequtils -y
echo 'GOVERNOR="performance"' | sudo tee /etc/default/cpufrequtils
sudo systemctl disable ondemand
sudo cpufreq-set -g performance
On virtualized environments, the hypervisor controls the actual clock speed, but setting the governor to performance tells the host scheduler to allocate CPU time more aggressively to your instance. Performance-optimized VPS plans typically have this set by default.
2. Choose the Right I/O Scheduler
The I/O scheduler determines how disk read/write requests are ordered. For SSD and NVMe drives, the none scheduler (or noop on older kernels) performs best because these drives have no mechanical seek time. For HDD-based plans, kyber or bfq can improve responsiveness.
# Set scheduler to none for NVMe/SSD
echo 'none' | sudo tee /sys/block/sda/queue/scheduler
# Make it permanent
echo 'ACTION=="add|change", KERNEL=="sd*", ATTR{queue/scheduler}="none"' | sudo tee /etc/udev/rules.d/60-iosched.rules
3. Tune sysctl for Lower Latency
Kernel parameters control how the Linux kernel handles memory, networking, and I/O. These settings are especially important on low-memory VPS plans (1–2 GB RAM):
# Reduce swappiness (default 60) — keeps more data in RAM
vm.swappiness=10
# Flush dirty pages more frequently
vm.dirty_ratio=20
vm.dirty_background_ratio=5
# Increase network buffer sizes for better throughput
net.core.rmem_max=134217728
net.core.wmem_max=134217728
# Enable TCP BBR congestion control
net.core.default_qdisc=fq
net.ipv4.tcp_congestion_control=bbr
Add these to /etc/sysctl.d/99-performance.conf and run sudo sysctl --system to apply them.
4. Optimize Transparent Huge Pages
Transparent Huge Pages (THP) can cause memory fragmentation on some workloads. For database servers running MySQL or PostgreSQL, disable THP for more consistent performance:
echo 'never' | sudo tee /sys/kernel/mm/transparent_hugepage/enabled
echo 'never' | sudo tee /sys/kernel/mm/transparent_hugepage/defrag
Add the same lines to /etc/rc.local to persist across reboots.
5. Verify Your Performance Gains
After applying these changes, re-run your benchmarks and compare:
# CPU benchmark
sysbench cpu run --threads=$(nproc)
# Disk I/O benchmark (4K random reads)
fio --name=randread --ioengine=libaio --iodepth=16 --rw=randread --bs=4k --direct=1 --size=512M --numjobs=4
# Network benchmark
iperf3 -c iperf.he.net
These tuning techniques work on any Linux VPS, but their impact varies depending on the underlying virtualization technology and hardware. Compare VPS performance benchmarks across providers to see which ones give you the most headroom for your budget.




Leave a Reply
You must be logged in to post a comment.