简体   繁体   English

Linux TCP:数据包分段?

[英]Linux TCP: packet segmentation?

I am working on a virtualization environment (Linux over HyperV).我正在开发一个虚拟化环境(Linux over HyperV)。 The Linux driver for the virtual NIC supports TSO and GSO (tcp segmentation is ON and generic segmentation is ON).虚拟网卡的 Linux 驱动程序支持 TSO 和 GSO(tcp 分段打开,通用分段打开)。

Now, I create TCP socket and the send buffer set to 128K.现在,我创建 TCP 套接字并将发送缓冲区设置为 128K。 But based on ifconfig data (TX bytes and TX packets), the average packet size is about 11 K.但根据 ifconfig 数据(TX 字节和 TX 数据包),平均数据包大小约为 11 K。

So my question is, where is my packet be segmented (from 128K to 11K)?所以我的问题是,我的数据包在哪里被分割(从 128K 到 11K)? How do I control/configure this in socket options or TCP options?如何在套接字选项或 TCP 选项中控制/配置它?

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;我有一个应用程序,它可以在具有 32 个 TCP 连接的 10G 网络中达到 8Gbps 的吞吐量——在这种情况下,平均数据包大小约为 20 KB,这是相当不错的; 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.但是当我将 TCP 连接数增加到 256 时,吞吐量只有大约 1Gbps,因为 NIC 上的数据包大小下降到大约 3 KB。

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.我知道数据包大小对性能至关重要,因为处理流量的成本是每个数据包,而不是每个字节,所以 NIC 上的数据包,如果更大更好。

SO, MY QUESTION IS: how do I increase the TCP packet size?所以,我的问题是:如何增加 TCP 数据包大小? Is there any TCP settings control this?是否有任何 TCP 设置控制这个?

Your question seems a little bit confusing, but there are a number of settings that you need to play with to get 10GigE to work right on Linux.您的问题似乎有点令人困惑,但是您需要进行许多设置才能使 10GigE 在 Linux 上正常工作。

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM