Why change net.inet.tcp.tcbhashsize in FreeBSD?
- by sh-beta
In virtually every FreeBSD network tuning document I can find:
# /boot/loader.conf
net.inet.tcp.tcbhashsize=4096
This is usually paired with some unhelpful statement like "TCP control-block hash table tuning" or "Set this to a reasonable value." man 4 tcp isn't much help either:
tcbhashsize Size of the TCP control-block hash table (read-only).
This may be tuned using the kernel option TCBHASHSIZE
or by setting net.inet.tcp.tcbhashsize in the
loader(8).
The only document I can find that touches on this mysterious thing is the Protocol Control Block Lookup subsection beneath Transport Layer in Optimizing the FreeBSD IP and TCP Stack, but its description is more about potential bottlenecks in using it. It seems tied to matching new TCP segments to their listening sockets, but I'm not sure how.
What exactly is the TCP Control Block used for? Why would you want to set its hash size to 4096 or any other particular number?