美文网首页
【开发总结】Linux下获取物理网卡带宽最大值

【开发总结】Linux下获取物理网卡带宽最大值

作者: blue_smile | 来源:发表于2017-05-17 21:20 被阅读0次

背景:

现阶段手头的一个自研的流式计算平台在完善监控体系,对机器资源负载、机器上任务资源消耗进行统计和上报,这里对Linux下获取网卡上限的方法进行梳理。

说明:这里的网卡最大带宽指的是物理网卡的带宽最大值
现阶段是使用系统提供的命令ethtool获取网卡最大值,具体命令如下:
ethtool eth1 | grep Speed

//1000M网卡机器中,ethtool命令的执行结果:
[root@WSC-155-91 ~]# ethtool eth1
Settings for eth1:
        Supported ports: [ TP ]
        Supported link modes:   10baseT/Half 10baseT/Full 
                                100baseT/Half 100baseT/Full 
                                1000baseT/Full 
        Supports auto-negotiation: Yes
        Advertised link modes:  10baseT/Half 10baseT/Full 
                                100baseT/Half 100baseT/Full 
                                1000baseT/Full 
        Advertised pause frame use: Symmetric
        Advertised auto-negotiation: Yes
        Speed: 1000Mb/s  // 网卡流速上限
        Duplex: Full
        Port: Twisted Pair
        PHYAD: 1
        Transceiver: internal
        Auto-negotiation: on
        MDI-X: off
        Supports Wake-on: pumbg
        Wake-on: g
        Current message level: 0x00000007 (7)
        Link detected: yes
[root@WSC-155-91 ~]# ethtool eth1 | grep Speed
        Speed: 1000Mb/s

-------------------------------------------------------------------------------------

//10000M网卡机器中,ethtool命令的执行结果:
[root@WSC-32-134 ~]# ethtool eth1      
Settings for eth1:
        Supported ports: [ TP ]
        Supported link modes:   100baseT/Full 
                                1000baseT/Full 
                                10000baseT/Full 
        Supported pause frame use: No
        Supports auto-negotiation: Yes
        Advertised link modes:  100baseT/Full 
                                1000baseT/Full 
                                10000baseT/Full 
        Advertised pause frame use: Symmetric
        Advertised auto-negotiation: Yes
        Speed: 10000Mb/s  // 网卡流速上限
        Duplex: Full
        Port: Twisted Pair
        PHYAD: 0
        Transceiver: external
        Auto-negotiation: on
        MDI-X: Unknown
        Supports Wake-on: umbg
        Wake-on: g
        Current message level: 0x00000007 (7)
                               drv probe link
        Link detected: yes
[root@WSC-32-134 ~]# ethtool eth1 | grep Speed
        Speed: 10000Mb/s

相关文章

网友评论

      本文标题:【开发总结】Linux下获取物理网卡带宽最大值

      本文链接:https://www.haomeiwen.com/subject/ubkjxxtx.html