In this guide, you will learn Linux Kernel network tuning to improve throughput, reduce latency, and increase connection scalability on production servers. You can use this setup for real-world workloads, including API backends, reverse proxies, storage replication, and an AI/GPU pipeline, where default Linux networking values often become a bottleneck under sustained traffic.
At Perlod Hosting, these optimizations are most useful for high-performance VPS and dedicated servers, which help you get faster downloads and uploads, keep connections stable under heavy traffic, and improve performance for latency-sensitive services.
At this point, you can calculate the required buffer size using the Bandwidth-Delay Product (BDP). BDP estimates how much data must be in flight on the network path to fully utilize the available bandwidth, so it gives a practical minimum for your TCP buffer sizing.
Use the formula below to compute BDP in bytes:
Bash
BDP(bytes)=Bandwidth(bits/sec) × RTT(seconds)/8
Now you can plug in your bandwidth and measured RTT to get a target buffer size for high-throughput transfers.
To measure your actual RTT, ping your target destination. For example, 8.8.8.8 for Google's DNS:
Bash
ping-c208.8.8.8|tail-1
Example output:
Bash
round-tripmin/avg/max/stddev=8.5/11.2/15.3/2.1ms
Or measure RTT to a specific server:
Bash
# To a far-away datacenterping-c101.1.1.1|grepavg# To measure specificallyforiin{1..20};doping-c1-W18.8.8.82>/dev/null|greptime=;done|awk-F'=''{print $NF}'|sort-n|tail-5
Step 3: Edit the Sysctl Configuration File
In this step, you can make your Linux kernel tuning persistent by adding the kernel networking settings to /etc/sysctl.conf, so they survive reboots and apply consistently across the server. These parameters control core TCP behavior, which directly impacts throughput and latency on high-speed WAN links like 10G and 100G.
Open the sysctl configuration file with the command below:
Bash
sudosysctl-p/etc/sysctl.conf
At the end of the file, add the following settings:
Bash
# ============================================================================# LINUX KERNEL NETWORK OPTIMIZATION - VERIFIED 2024/2025# Based on: Cloudflare, Google BBR, ESnet 100G Tuning Research# Last Updated: December 2025# ============================================================================# ============================================================================# 1. TCP BUFFER SIZES - Critical for Long-Distance Networks# ============================================================================# tcp_rmem = minimum initial maximum (in bytes)# For 100G networks, we recommend 512MB max buffernet.ipv4.tcp_rmem=4096131072536870912net.ipv4.tcp_wmem=4096131072536870912# 2. Core Socket Buffer Limits - System-wide maximums# Set to same as tcp_rmem/tcp_wmem max valuesnet.core.rmem_max=536870912net.core.wmem_max=536870912net.core.rmem_default=131072net.core.wmem_default=131072# ============================================================================# 3. TCP WINDOW SCALING - Enable larger windows# ============================================================================# Required for tcp_rmem/tcp_wmem to be effectivenet.ipv4.tcp_window_scaling=1# ============================================================================# 4. CONGESTION CONTROL & QUEUEING DISCIPLINE# ============================================================================# BBR (Bottleneck Bandwidth and Round-trip time)# - Superior to CUBIC for WAN connections (especially intercontinental)# - More efficient use of buffer, lower latency# - Maintains high throughput even with packet lossnet.ipv4.tcp_congestion_control=bbr# FQ (Fair Queuing) - Required for BBR to work effectively# - Eliminates bufferbloat# - Fair distribution of bandwidth# - Essential for low-latency applicationsnet.core.default_qdisc=fq# ============================================================================# 5. SYN FLOOD & CONNECTION QUEUE PROTECTION# ============================================================================# For servers handling thousands of concurrent connectionsnet.ipv4.tcp_max_syn_backlog=8192net.core.somaxconn=8192net.core.netdev_max_backlog=8192# ============================================================================# 6. TCP RELIABILITY & ACKNOWLEDGMENT FEATURES# ============================================================================# SACK (Selective Acknowledgment) - Faster recovery from packet lossnet.ipv4.tcp_sack=1# FACK (Forward Acknowledgment) - Better loss detectionnet.ipv4.tcp_fack=1# TCP Timestamps - Improves RTT measurement accuracynet.ipv4.tcp_timestamps=1# TCP Fast Open - Reduces connection setup time# 3 = enable for both client and servernet.ipv4.tcp_fastopen=3# ============================================================================# 7. TCP TIMEOUT & PORT REUSE# ============================================================================# Reduce TIME_WAIT duration for high-throughput serversnet.ipv4.tcp_fin_timeout=30# Allow reusing TIME_WAIT sockets for new connections# Safe when tcp_timestamps is enablednet.ipv4.tcp_tw_reuse=1# Expand available ephemeral portsnet.ipv4.ip_local_port_range=1000065535# ============================================================================# 8. MTU DISCOVERY & FRAGMENTATION# ============================================================================# Enable path MTU discovery with ICMP blackhole detection# Prevents packets being silently droppednet.ipv4.tcp_mtu_probing=1# ============================================================================# 9. TCP PERFORMANCE TUNING# ============================================================================# Don't reset slow-start after idle period# Allows better recovery on re-transmissionnet.ipv4.tcp_slow_start_after_idle=0# Auto-tuning of receive buffer (enabled by default)net.ipv4.tcp_moderate_rcvbuf=1# Prevent excessive buffering (bufferbloat mitigation)net.ipv4.tcp_notsent_lowat=16384# ============================================================================# 10. CONNECTION TIMEOUT & KEEPALIVE# ============================================================================# TCP Keep-Alive probe interval (reduces stale connections)net.ipv4.tcp_keepalive_time=300net.ipv4.tcp_keepalive_probes=3net.ipv4.tcp_keepalive_intvl=15# ============================================================================# 11. SYSTEM-WIDE LIMITS# ============================================================================# Maximum number of open file descriptors system-wide# Critical for C10k/C100k problem (thousands of concurrent connections)fs.file-max=2097152# Increase memory for netfilter/conntrack (if using iptables)net.nf_conntrack_max=1000000net.netfilter.nf_conntrack_max=1000000
Once you are done, save and close the file.
Apply the Linux kernel tuning changes by reloading the configuration:
This is OK, your kernel doesn't support that particular parameter, and other parameters will still be applied.
Step 4: Enable TCP BBR Congestion Control for Linux Kernel Tuning
TCP BBR is Google's modern congestion control algorithm designed to keep throughput high while avoiding the latency spikes you often see on high-bandwidth, high-RTT paths.
You can load the BBR module with the command below:
Bash
sudomodprobetcp_bbr
Verify BBR is loaded:
Bash
lsmod|greptcp_bbr
Example output:
Bash
tcp_bbr245760
The number after tcp_bbr is the reference count. Either 0 or another number is fine.
To make BBR load automatically on boot, create a module load configuration:
Then, start the iperf3 Server with the command below. Run on the server that will receive data:
Bash
iperf3-s-p5201-D
Now run on a different machine (iPerf3 Client), or use localhost for testing:
Bash
iperf3-c192.168.1.100-p5201-t30-P4
Next, you can measure the download or reverse speed:
Bash
iperf3-c192.168.1.100-p5201-t30-P4-R
The -R flag reverses the test direction, server sends, and client receives.
You can stop the server with the command below:
Bash
pkilliperf3
Step 7: Monitor Network Performance in Real-Time
In this step, you can monitor your network performance in real-time, so you can confirm your tuning is delivering stable throughput without hidden issues like rising latency, queue buildup, or retransmissions.
To monitor bandwidth usage, you can use the bmon tool:
Bash
sudoaptinstallbmon-ybmon-oascii
Press h for help, q to quit.
For monitoring connections and bandwidth per process, you can use the nethogs tool:
Bash
sudoaptinstallnethogs-ysudonethogseth0
To monitor TCP Socket Statistics, you can run:
Bash
watch-n1'ss -s'
To check current latency, you can run:
Bash
ping-c20192.168.1.100|tail-1
Monitor TCP retransmissions with the command below:
Bash
watch-n1'cat /proc/net/snmp | grep Tcp'
Lower TcpRetransSegs is better.
You can compare the benchmark results and see the improvements.
Advanced Linux Kernel Tuning for Extreme High-Performance
These optional tuning parameters focus on eliminating host-side bottlenecks that occur at 100 Gbps and above, particularly CPU power management, NUMA effects, and NIC queue limits.
For 100+ Gbps Networks:
Set CPU Governor to Performance Mode:
Bash
# Check current governorcat/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor# Set to performancesudoaptinstallcpupower-ysudocpupowerfrequency-set-gperformance# Verifycat/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
# Check NUMA configurationnumactl--hardware# Bind process to specific NUMA nodenumactl--cpunodebind=0--preferred=0./your-application
Increase RX/TX Ring Buffer:
Bash
# Check current valuesethtool-geth0# Increase (requires driver support)sudoethtool-Geth0rx4096tx4096
Disable Swap for Ultra-Low Latency:
Bash
# Check swap usagefree-h# Disable (if not needed)sudoswapoff-a# Permanent: comment out swap line in /etc/fstabsudonano/etc/fstab# Comment: #/swapfile none swap sw 0 0
Conclusion
Linux Kernel network tuning is most effective when it’s done methodically by measuring a baseline, applying a small set of proven kernel changes, verifying they actually took effect, and then re-testing under real load.
The best improvements usually come from three things: using the right congestion control (often BBR), pairing it with a matching queue setup (like FQ), and setting TCP buffer sizes based on your actual bandwidth and latency (BDP).
If you’re running high-traffic services, these kernel-level optimizations can remove hidden bottlenecks and make performance more stable.
We hope you enjoy this Linux kernel tuning guide. Subscribe to our X and Facebook channels to get the latest updates and articles.
Check the configured congestion control via sysctl, then confirm active connections using ss -tin.
FQ helps reduce latency spikes and improve fairness between flows. It’s also commonly recommended alongside BBR because it enables pacing behavior that enhances performance and stability.
This can help clients who open lots of new connections, but it needs careful testing in your setup. If the system is mainly a server handling incoming connections, prioritize increasing the connection backlog and tuning application keep-alives first, instead of depending on TIME_WAIT reuse.
We use cookies to run PerLod and to understand how the site is used. You can accept everything, or open Manage to turn individual categories off. Cookie policy.