Stop your socket buffer from acting like a bottleneck

Performance Tuning & Kernel Parameters (Sysctl)

Stop your socket buffer from acting like a bottleneck

🧩 The Challenge

Dealing with a high-throughput API that feels sluggish despite low CPU usage? You’ve probably got packets queuing up because the kernel defaults for buffer sizes are stuck in the mid-2000s.

💡 The Fix

Crank up your TCP receive and send buffers in sysctl to give your fast NIC the breathing room it actually needs. It turns your network stack from a narrow hallway into a wide corridor.

sysctl -w net.core.rmem_max=16777216
sysctl -w net.core.wmem_max=16777216
sysctl -w net.ipv4.tcp_rmem='4096 87380 16777216'
sysctl -w net.ipv4.tcp_wmem='4096 65536 16777216'

⚙️ Why It Works

Increasing these values forces the kernel to allocate more memory for window scaling, which is a lifesaver when you have high bandwidth-delay products. Without this adjustment, the connection throttles itself because it thinks the buffer is full long before the physical wire is saturated.

🚀 Pro-Tip: Check your actual buffer usage with ss -tm so you aren’t just guessing at the numbers.

Linux Tips & Tricks | © ngelinux.com | 9/17/2026

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted