我试图利用我的1GiB网卡提供的最大带宽,但它总是限于80MiB(真正的兆字节)。 可能是什么原因? 卡描述(lshw输出):
description: Ethernet interface product: DGE-530T Gigabit Ethernet Adapter (rev 11) vendor: D-Link System Inc physical id: 0 bus info: pci@0000:03:00.0 logical name: eth1 version: 11 serial: 00:22:b0:68:70:41 size: 1GB/s capacity: 1GB/s width: 32 bits clock: 66MHz capabilities: pm vpd bus_master cap_list rom ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt 1000bt-fd autonegotiation
该卡位于以下PCI插槽中:
*-pci:2 description: PCI bridge product: 82801 PCI Bridge vendor: Intel Corporation physical id: 1e bus info: pci@0000:00:1e.0 version: 92 width: 32 bits clock: 33MHz capabilities: pci subtractive_decode bus_master cap_list
PCI不是PCI Express的权利吗? 这是一个传统的PCI插槽? 所以也许这是原因?
操作系统是一个Linux。
80 MB /秒实际上是相当不错的! 这大约是640mbps,这相当于NIC的千兆容量。 如果考虑到TCPIP开销和磁盘速度,您可能会达到最高速度。
尝试把这个到你的/etc/sysctl.conf
# General 10gigabit/LFP tuning net.core.rmem_max=16777216 net.core.wmem_max=16777216 net.ipv4.tcp_rmem=4096 87380 16777216 net.ipv4.tcp_wmem=4096 65536 16777216 net.ipv4.tcp_syncookies=1 net.ipv4.tcp_max_orphans=1048576 net.ipv4.tcp_orphan_retries=2 # Removes some internal buffering net.ipv4.tcp_low_latency=1 # Time-wait sockets # Do not turn on unless you know what you are doing! #net.ipv4.tcp_tw_recycle=1 #net.ipv4.tcp_tw_reuse=1 # If PMTUD ICMP blackhole appears use # RFC 4821, Packetization Layer Path MTU Discovery net.ipv4.tcp_mtu_probing=1 # Netfilter's conntrack # NB! For high-performance concerns you probably don't want to use `--state` rules at all #net.ipv4.netfilter.ip_conntrack_max=1048576 #net.nf_conntrack_max=1048576 # SACKs are an optimization to TCP which in normal scenarios improves considerably performance. # In Gigabit networks with no traffic competition these have the opposite effect. # To improve performance they should be turned off with: #net.ipv4.tcp_sack=0 # Decrease the time default value for tcp_fin_timeout connection net.ipv4.tcp_fin_timeout=15 # Decrease the time default value for tcp_keepalive_time connection net.ipv4.tcp_keepalive_time=1800 # Increased backlog (default: 100/1000 depending on kernel) net.core.netdev_max_backlog=10000 net.core.somaxconn=10000 # Timestamps adds additional 12 bytes to header and uses CPU # NB! It caused massive problems for me under benchmark load # with a high count of concurrent connections. # ( http://redmine.lighttpd.net/wiki/1/Docs:Performance ) #net.ipv4.tcp_timestamps=0 # Portrange for outgoing connections # (increase the ephemeral port range) # NB! After that tuning you probably do not want to listen on port >= 1024 net.ipv4.ip_local_port_range=1024 65535 # Fixing 'Too many open files', Second useful on nginx+aio workloads fs.file-max=16777216 fs.aio-max-nr=65536 # If you are under DDoS you can kernel.panic=10 # Lower following values #net.ipv4.tcp_synack_retries=2 #net.ipv4.tcp_syn_retries=2 #net.ipv4.netfilter.ip_conntrack_tcp_timeout_fin_wait=15 #net.ipv4.netfilter.ip_conntrack_tcp_timeout_close_wait=15 # If you under ping flood #net.ipv4.icmp_echo_ignore_all=1
我们所做的每个连接都需要一个临时端口,因此需要一个文件描述符,默认情况下这个连接限制为1024.为了避免太多的打开文件问题,你需要修改你的shell的ulimit。 这可以在/etc/security/limits.conf中更改,但需要注销/login。 现在你可以直接sudo和修改当前的shell(如果你不想以root身份运行,在调用ulimit之后回到非priv'ed用户):
ulimit -n 999999
另一件可以尝试的事情可能有助于提高TCP吞吐量,即增加接口队列的大小。 为此,请执行以下操作:
ifconfig eth0 txqueuelen 1000
你可以玩拥塞控制:
sysctl net.ipv4.tcp_available_congestion_control sysctl net.ipv4.tcp_congestion_control=htcp
还有一些低级别的调整,例如内核模块参数
# /sbin/modinfo e1000 ..snip... parm: TxDescriptors:Number of transmit descriptors (array of int) parm: TxDescPower:Binary exponential size (2^X) of each transmit descriptor (array of int) parm: RxDescriptors:Number of receive descriptors (array of int) parm: Speed:Speed setting (array of int) parm: Duplex:Duplex setting (array of int) parm: AutoNeg:Advertised auto-negotiation setting (array of int) parm: FlowControl:Flow Control setting (array of int) parm: XsumRX:Disable or enable Receive Checksum offload (array of int) parm: TxIntDelay:Transmit Interrupt Delay (array of int) parm: TxAbsIntDelay:Transmit Absolute Interrupt Delay (array of int) parm: RxIntDelay:Receive Interrupt Delay (array of int) parm: RxAbsIntDelay:Receive Absolute Interrupt Delay (array of int) parm: InterruptThrottleRate:Interrupt Throttling Rate (array of int) parm: SmartPowerDownEnable:Enable PHY smart power down (array of int) parm: KumeranLockLoss:Enable Kumeran lock loss workaround (array of int) parm: copybreak:Maximum size of packet that is copied to a new buffer on receive
甚至可以通过ethtool(1)访问更低级别的硬件调音。
PS。 阅读内核的文档,特别是Documentation / networking / scaling.txt
PPS。 在调整TCP性能时,您可能需要咨询RFC6349
购买力平价。 D-Link不是最好的networking硬件。 尝试使用pci-x或pci-64的Intel硬件
您的32位33Mhz PCI总线可以传输最大1,067兆比特每秒(Mbps)或133.33兆字节每秒(MBps)。
千兆位以太网可以传输116兆字节每秒(MBps)。
所以,虽然你的卡应该能够完全饱和线,你实际上只能得到约90%的利用率,因为各种开销。
无论哪种方式,如果你得到每秒80兆(MBps),那么你不远处,现在我会相当高兴。
千兆以太网每秒仅超过10亿比特 。 使用8/10编码,每秒最多可以达到100MB左右。 一个32位的PCI总线应该能够达到133MB / sec的速度,你应该能够饱和它(我可以用一个光纤通道卡来certificatePCI总线饱和,并得到一个接近总线理论带宽的数字),除非有其他公交车stream量,否则不太可能成为瓶颈的原因。
除非在总线上使用另一个使用带宽的卡,否则瓶颈可能在其他地方。
GigE速度瓶颈可能来自许多地方。
你是多么确定这是卡的瓶颈? 这可能是它可以在另一端与设备进行协商的最佳速度,所以它一直在等待。 另一个设备可能会卡在10/100的速度运行,所以80会是正确的一点点的开销。
经过长期的研究,我发表了自己的结论:
根据我的经验,80 MiB / s是相当不错的。 无论使用什么样的NIC和交换机组合,我都没有看到更高的速度。 我记得100 Mbps显示了很多相同的行为。 尽pipe我看到千兆位设备在100 Mbps模式下运行在90%以上,但是这个数据库的利用率几乎可以满足您的70-80%的要求。
相比之下,基于SMC交换机和Broadcom集成网卡的家中第一个千兆位configuration几乎不能pipe理400 Mbps。 现在,多年以后,使用Netgearpipe理交换机以及英特尔和Marlin网卡,我通常会发现自己处于70-80 MiB / s的持续传输范围内。
如果您需要更多,请考虑绑定多个接口。