3

I have noticed both broadcom and Intel NICs allow you tune the number of transmit and receive buffers (A Higher number of buffers will cause more memory usage).

How do these buffers work:

  • What is their size?
  • What is the relation of buffers to TCP or Ethernet sessions if there is one? (i.e. 1 buffer per session or a pool of buffers?)
Kyle Brandt
  • 83,619
  • 74
  • 305
  • 448

3 Answers3

2

Well, there is some advice on network card buffers that indicates more is better, generally:

http://book.opensourceproject.org.cn/sysadmin/apache/apachetomcat/opensource/090.html

Set the receive buffers on the Network Interface Card on the Web server to a maximum. This reduces the number of dropped packets and reduces TCP retransmissions. You can set this parameter by going to Start | Settings | Control Panel | Network and Dial Up Connections. Select the active LAN Connection typically called Local Area Connection. Right click to select Properties. Click on the Configure button next to the Network Interface Card. Set the receive buffers to the maximum value 1024.

...

You may be wondering about the trade-offs in doing the above. The trade-off is that the operating system will need to allocate more memory for NIC receive buffers and user ports.

Jeff Atwood
  • 13,104
  • 20
  • 75
  • 92
  • Intel goes through recommended optimizations at http://www.intel.com/support/network/sb/cs-025829.htm as well. But I am interested in how these actually interact with the OS and TCP/IP stack. http://blogs.msdn.com/b/ddperf/archive/2008/06/10/mainstream-numa-and-the-tcp-ip-stack-part-i.aspx Gives a lot of insight in to what some of those are. – Kyle Brandt Feb 26 '11 at 22:03
2

The RX and TX buffers generally equate to one Ethernet frame. If you've configured the RX buffer count to 512, then the driver will set aside enough buffers to handle 512 Ethernet frames. The amount of memory will vary slightly as different NICs uses different buffer descriptor data structures, but in general you should multiply the buffer size by the MTU to estimate the amount of memory required.

Dave

Dave
  • 291
  • 2
  • 3
0

If you have code access, there is also the SO_RCVBUF option that is useful, especially on Windows.

Btw, someone knows what is the relation of the RX buffers from the NIC versus the SO_RCVBUF option ? (WskControlSocket/getsockopt)