
VPS Network Performance: Bandwidth and Latency Optimization
Boost network performance on your VPS server: TCP BBR, kernel tuning, DNS optimization, and bandwidth monitoring. Latency reduction techniques guide.
Elif Demir
Cloud Solutions Architect
Are your API response times high, or are file download speeds falling below expectations? Even if your VPS has sufficient CPU and RAM, default Linux kernel network settings are not optimized for most server workloads. VPS network performance optimization - changing the TCP congestion control algorithm, adjusting buffer sizes, and configuring connection limits - increases throughput and reduces latency. In this guide, we'll improve your network performance with concrete sysctl settings and monitoring tools.
Essential Network Metrics
| Metric | Definition | Ideal Value |
|---|---|---|
| Latency (RTT) | Round-trip time of a packet | Same continent: <30 ms, intercontinental: <150 ms |
| Bandwidth (Throughput) | Amount of data transferred per second | 80%+ of your plan should be usable |
| Packet Loss | Percentage of lost packets | <0.1% (close to zero) |
| Jitter | Inconsistency in latency | <5 ms |
Increasing Throughput with TCP BBR
Developed by Google, BBR (Bottleneck Bandwidth and Round-trip propagation time) works by modeling bandwidth and RTT, unlike traditional loss-based congestion control algorithms. It significantly increases throughput, especially on connections with high latency or packet loss.
# Check current congestion control algorithm
sysctl net.ipv4.tcp_congestion_control
# Enable BBR
sudo sysctl -w net.core.default_qdisc=fq
sudo sysctl -w net.ipv4.tcp_congestion_control=bbr
# Make it persistent
echo 'net.core.default_qdisc=fq' | sudo tee -a /etc/sysctl.conf
echo 'net.ipv4.tcp_congestion_control=bbr' | sudo tee -a /etc/sysctl.conf
# Verify
sysctl net.ipv4.tcp_congestion_control
# Output: net.ipv4.tcp_congestion_control = bbr
Kernel Network Parameters
Default Linux kernel network settings are designed for low-resource systems. Optimize the following sysctl settings for web servers and APIs:
# TCP buffer sizes (for high bandwidth)
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.ipv4.tcp_rmem = 4096 87380 16777216
net.ipv4.tcp_wmem = 4096 65536 16777216
# Connection queue (for heavy traffic)
net.core.somaxconn = 65535
net.core.netdev_max_backlog = 65535
# Quickly recycle TIME_WAIT sockets
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_fin_timeout = 15
# TCP keepalive (connection liveness check)
net.ipv4.tcp_keepalive_time = 300
net.ipv4.tcp_keepalive_intvl = 30
net.ipv4.tcp_keepalive_probes = 5
# SYN flood protection
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_max_syn_backlog = 65535
⚠️ Important Warning: Back up your current values before applying these settings: sysctl -a > /tmp/sysctl-backup.conf. Apply changes with sudo sysctl -p and test network performance. If you experience issues, you can revert from the backup.
DNS Optimization
Every HTTP request starts with a DNS resolution. Slow DNS slows down all connections. You can speed up repeated queries by setting up a local DNS cache:
# Local DNS cache with systemd-resolved
sudo systemctl enable --now systemd-resolved
# Test DNS resolution time
dig hosted.cloud | grep "Query time"
# Use fast DNS servers (/etc/systemd/resolved.conf)
# DNS=1.1.1.1 8.8.8.8
# FallbackDNS=9.9.9.9 8.8.4.4
Network Monitoring Tools
# Bandwidth test (iperf3)
sudo apt install iperf3 -y
iperf3 -c speedtest.serverius.net -p 5002
# Latency and packet loss test
mtr --report --report-cycles 100 google.com
# Real-time bandwidth monitoring
nload eth0
# Connection status summary
ss -s
For comprehensive server performance monitoring, you can also check out our resource monitoring guide. Network performance is optimized with high bandwidth and low latency on Hosted Cloud cloud servers.
Frequently Asked Questions
Does BBR work on all Linux kernels?
BBR is available with Linux kernel 4.9+. Ubuntu 18.04+, Debian 10+, and CentOS 8+ support it by default. Check your kernel version with uname -r.
Are sysctl settings applied without restarting the server?
Yes. The sudo sysctl -p command applies changes immediately. However, they must be written to /etc/sysctl.conf to persist across reboots.
Latency is high but the server is nearby, why?
Possible causes: DNS resolution delay, TCP handshake time (including SSL/TLS), slow application response on the server side, or routing issues in the network path. Use mtr for hop-by-hop analysis to identify the bottleneck.
Conclusion
VPS network performance optimization starts with concrete steps like enabling TCP BBR, adjusting kernel buffer sizes, and setting up DNS caching. These changes are typically applied in a few minutes and provide noticeable improvement in throughput. Back up your current settings before making changes and compare before/after results with iperf3.
Low Latency, High Bandwidth
Hosted Cloud cloud servers offer low latency and high throughput with premium network infrastructure.
View Cloud Server Plans →Elif Demir
Cloud Solutions Architect
Specializing in enterprise cloud migration projects and hybrid infrastructure design with 8 years of experience in AWS, Azure, and private cloud environments.
Comments coming soon