T The Triage ManualTechnical Guides for IT Emergencies
P3 · Remote Access & VPN

OpenVPN TCP Throughput Capped (~6 Mbps) Due to Hardcoded 64 KB Socket Buffer

OpenVPN's hardcoded 64 KB socket buffer (sndbuf/rcvbuf) prevents TCP Window Size Scaling from growing beyond 64 KB, capping throughput to approximately 5–7 Mbps on high-latency links regardless of available bandwidth or CPU headroom. The fix is to add 'sndbuf 0' and 'rcvbuf 0' to both server and client OpenVPN configuration files, restoring OS-managed buffer sizing. Removing the comp-lzo compression directive further eliminates single-core CPU bottlenecks that can persist after the buffer fix.

Indicators

Likely causes

Diagnostic steps

  1. Run iperf between VPN tunnel IPs to measure baseline VPN throughput: on the server run 'iperf -s'; on the client run 'iperf -c <tunnel_server_ip>'.
  2. Run the same iperf test directly between physical/LAN IPs (outside the VPN tunnel) to establish a non-VPN throughput baseline for comparison.
  3. During the iperf test, run 'top' and press '1' to view per-core CPU utilization; check whether any single core is saturated while others remain idle.
  4. During the iperf test, run 'ping <tunnel_peer_ip>' over the VPN and observe whether latency increases significantly compared to the idle tunnel baseline, indicating buffer saturation.
  5. Inspect the OpenVPN server and client configuration files for sndbuf/rcvbuf directives; if absent or set to 65536, OpenVPN is using its hardcoded 64 KB default.
  6. Calculate the theoretical maximum throughput: divide the socket buffer size in bytes by the RTT in seconds (e.g., 65536 ÷ 0.060 s ≈ 8.7 Mbps) and compare to the observed iperf result to confirm the buffer is the bottleneck.
  7. Add 'sndbuf 0' and 'rcvbuf 0' to both the server and client OpenVPN configuration files, restart OpenVPN on both ends, and rerun iperf to verify throughput improvement.
  8. If a single CPU core shows elevated utilization after the buffer fix, remove the 'comp-lzo' directive from both server and client configs, restart OpenVPN on both ends, and rerun iperf to confirm further improvement.

Resolution path

Prevention

Tools

References

openvpntcpthroughputnetwork-performancetcp-window-scalingsocket-buffersndbufrcvbufvpniperfcomp-lzolatencycentoslinux