Network Buffer Size Calculator
Calculate optimal socket send/receive buffer sizes from the bandwidth-delay product across all concurrent connections.
Inputs
Number of sockets that each need their own buffer allocation
Recommended Buffer per Connection
6,103.52KB
Total Kernel Memory for All Connections
596.05MB
Recommended Buffer per Connection
6,250,000bytes
Total Kernel Memory for All Connections
610,352KB
Step by step
Values used
Link Bandwidth = 1,000 Mbps; Round-Trip Time (RTT) = 50 ms; Concurrent Connections = 100
Bandwidth-delay product buffer size
buffer = bandwidth_Mbps × RTT_ms / 8 × 1000
Total kernel memory
total = buffer_per_connection × connections
Recommended Buffer per Connection
= 6,103.52 KB
Total Kernel Memory for All Connections
= 596.05 MB
Recommended Buffer per Connection
= 6,250,000 bytes
Total Kernel Memory for All Connections
= 610,352 KB
How it works
To keep a TCP connection's throughput saturating the available bandwidth, the socket buffer must be at least as large as the bandwidth-delay product (BDP) — the volume of data that can be in flight before the first acknowledgment returns across the round-trip. Undersized buffers force the sender to stall waiting for ACKs, capping throughput well below the link's real capacity. Because each concurrent connection needs its own buffer allocation, the total kernel memory committed to networking scales linearly with connection count, which matters when sizing net.core.rmem_max/wmem_max on a server handling many simultaneous sockets.
Formulas
Bandwidth-delay product buffer size
buffer = bandwidth_Mbps × RTT_ms / 8 × 1000
- R
- bandwidth in Mbps
- T
- round-trip time in ms
Total kernel memory
total = buffer_per_connection × connections
- n
- concurrent connections
Frequently Asked Questions
Why divide by 8 in the bandwidth-delay product formula?
Bandwidth is conventionally measured in bits per second (Mbps) while buffer sizes are measured in bytes, so dividing by 8 converts bits to bytes before multiplying by the round-trip time to get a byte-denominated buffer size.
What happens if I set buffers larger than the calculated BDP?
Oversized buffers waste kernel memory across many connections and can increase latency under congestion (a phenomenon known as bufferbloat, where packets queue for longer than necessary before being dropped or delivered), so buffers should be sized close to the BDP rather than made arbitrarily large.
Where do I actually configure these buffer sizes on Linux?
The relevant sysctls are net.core.rmem_max and net.core.wmem_max for the system-wide ceiling, and net.ipv4.tcp_rmem / net.ipv4.tcp_wmem for the per-socket min/default/max triplet — set the max values at or above your calculated per-connection buffer size.