Socket Buffer Calculator
Size per-socket send and receive buffers from the BDP, and total the kernel memory a server needs.
Inputs
Buffer Per Socket
4 MiB
Bandwidth Delay Product
2 MiB
Suggested tcp_rmem Max (power of two)
4 MiB
Total Buffer Memory
2 GiB
Total Buffer Memory
1,907.3MB
Step by step
Values used
Bandwidth per socket = 200 Mbit/s; Round-trip time = 80 ms; Concurrent sockets = 500 sockets; Kernel overhead factor = 2 ×
Socket Buffer
buffer = BDP × overhead factor, where BDP = bandwidth × RTT ÷ 8.
Server memory footprint
total kernel memory = per-socket buffer × concurrent sockets
Buffer Per Socket
= 4,000,000
Bandwidth Delay Product
= 2,000,000
Suggested tcp_rmem Max (power of two)
= 4,194,304
Total Buffer Memory
= 2,000,000,000
Total Buffer Memory
= 1,907.3 MB
How it works
A socket buffer has to hold one BDP of unacknowledged data, plus the kernel's own per-packet structures — which is why Linux treats the value in tcp_rmem as including roughly a 2× overhead. Multiplying by the connection count gives the memory the box must have spare. Buffers set too small throttle every transfer to window ÷ RTT; set too large across thousands of sockets they exhaust kernel memory and trigger connection resets under load.
Formulas
Socket Buffer
buffer = BDP × overhead factor, where BDP = bandwidth × RTT ÷ 8.
- BDP
- Bytes in flight for one socket
- overhead factor
- Linux charges roughly 2× the payload for skb bookkeeping
Server memory footprint
total kernel memory = per-socket buffer × concurrent sockets
- concurrent sockets
- Established connections held at peak
Frequently Asked Questions
How is Socket Buffer calculated?
buffer = BDP × overhead factor, where BDP = bandwidth × RTT ÷ 8. A socket buffer has to hold one BDP of unacknowledged data, plus the kernel's own per-packet structures — which is why Linux treats the value in tcp_rmem as including roughly a 2× overhead. Multiplying by the connection count gives the memory the box must have spare.
Why does Socket Buffer matter?
Buffers set too small throttle every transfer to window ÷ RTT; set too large across thousands of sockets they exhaust kernel memory and trigger connection resets under load.
What values do I need to enter?
This calculator takes 4 inputs: Bandwidth per socket, Round-trip time, Concurrent sockets, Kernel overhead factor. The pre-filled defaults are a realistic starting point — replace them with figures from your own environment for a result you can act on.
You might also need
- TCP Window Size CalculatorCommonly used together
- Bandwidth Delay Product CalculatorCommonly used together
- Connection Capacity CalculatorCommonly used together
- Packets Per Second CalculatorAlso in TCP & Transport
- Buffer Size CalculatorAlso in TCP & Transport
- Connection Timeout CalculatorAlso in TCP & Transport