Linux TCP: packet segmentation?

时间:2016-04-21 22:39:56

标签: linux sockets tcp

I am working on a virtualization environment (Linux over HyperV). The Linux driver for the virtual NIC supports TSO and GSO (tcp segmentation is ON and generic segmentation is ON).

Now, I create TCP socket and the send buffer set to 128K. But based on ifconfig data (TX bytes and TX packets), the average packet size is about 11 K.

So my question is, where is my packet be segmented (from 128K to 11K)? How do I control/configure this in socket options or TCP options?

thanks!

===========EDIT==================

I have an application which can reach 8Gbps throughput in a 10G network with 32 TCP connections - in this case, the average packet size is about 20 Kbytes which is pretty good; but when I increased the TCP connections to 256, then the throughput is just about 1Gbps as the packet size on NIC is down to about 3 KBytes.

I know the packet size is critical to the performance as the cost of processing traffic is per packet, not per bytes, so the packet on NIC, it is better if bigger.

SO, MY QUESTION IS: how do I increase the TCP packet size? Is there any TCP settings control this?

2 个答案:

答案 0 :(得分:0)

您的问题似乎有点令人困惑,但您需要使用许多设置才能让10GigE在Linux上正常运行。

见这里: http://dak1n1.com/blog/7-performance-tuning-intel-10gbe/

答案 1 :(得分:0)

  • 设置套接字选项SO_SNDBUF,SO_RCVBUF可能有所帮助,但TCP IP不保证接收/发送时的块大小。