zoukankan      html  css  js  c++  java
  • Open vSwitch 给虚拟机网卡限流(QoS)

    这里我们简单描述下如何通过Open vSwitch给虚拟机限流(出流量),同时测试限流效果。测试环境继续复用《整合Open vSwitch与DNSmasq为虚拟机提供DHCP功能》一文中描述的。

    测试工具:假设两台虚拟机VM1、VM2都已经安装好 netperf

    1、事先在VM1中启动 netserver:

    2、由于VM2的虚拟网卡是tap1,这里先查看下当前tap1网卡的情况:

    ◄►  sudo ovs-vsctl list interface tap1
    _uuid               : aa4b7e2b-44b9-4701-ab02-909d66fc4333
    admin_state         : up
    bfd                 : {}
    bfd_status          : {}
    cfm_fault           : []
    cfm_fault_status    : []
    cfm_health          : []
    cfm_mpid            : []
    cfm_remote_mpids    : []
    cfm_remote_opstate  : []
    duplex              : full
    external_ids        : {attached-mac="52:54:00:f9:b6:b1", iface-id="0c9430f2-87ca-4ca2-92c8-2968ddfb2947", iface-status=active, vm-id="8d910a8b-726b-833d-3420-7da607486336"}
    ifindex             : 14
    ingress_policing_burst: 0
    ingress_policing_rate: 0
    lacp_current        : []
    link_resets         : 1
    link_speed          : 10000000
    link_state          : up
    mac                 : []
    mac_in_use          : "fe:54:00:f9:b6:b1"
    mtu                 : 1500
    name                : "tap1"
    ofport              : 8
    ofport_request      : []
    options             : {}
    other_config        : {}
    statistics          : {collisions=0, rx_bytes=39024162452, rx_crc_err=0, rx_dropped=0, rx_errors=0, rx_frame_err=0, rx_over_err=0, rx_packets=608632, tx_bytes=24416546, tx_dropped=0, tx_errors=0, tx_packets=369535}
    status              : {driver_name=tun, driver_version="1.6", firmware_version=""}
    type                : ""

    这里的 ingress_policing_rate 和 ingress_policing_burst 值全为0,则表示 不限流。

    3、在 不限流 的情况下,从VM2中通过 netperf 测试的情况如下:

    从上面的Throughput来看,出流量差不多打到了  11Gbps。

    4、此时,我们通过 ovs 将 tap1 的带宽限制在 1M:

    ◄►  sudo ovs-vsctl set interface tap1 ingress_policing_burst=100
    ◄►  sudo ovs-vsctl set interface tap1 ingress_policing_rate=1000
    ◄►  sudo ovs-vsctl list Interface tap1
    _uuid               : aa4b7e2b-44b9-4701-ab02-909d66fc4333
    admin_state         : up
    bfd                 : {}
    bfd_status          : {}
    cfm_fault           : []
    cfm_fault_status    : []
    cfm_health          : []
    cfm_mpid            : []
    cfm_remote_mpids    : []
    cfm_remote_opstate  : []
    duplex              : full
    external_ids        : {attached-mac="52:54:00:f9:b6:b1", iface-id="0c9430f2-87ca-4ca2-92c8-2968ddfb2947", iface-status=active, vm-id="8d910a8b-726b-833d-3420-7da607486336"}
    ifindex             : 14
    ingress_policing_burst: 100
    ingress_policing_rate: 1000
    lacp_current        : []
    link_resets         : 1
    link_speed          : 10000000
    link_state          : up
    mac                 : []
    mac_in_use          : "fe:54:00:f9:b6:b1"
    mtu                 : 1500
    name                : "tap1"
    ofport              : 8
    ofport_request      : []
    options             : {}
    other_config        : {}
    statistics          : {collisions=0, rx_bytes=24983931502, rx_crc_err=0, rx_dropped=0, rx_errors=0, rx_frame_err=0, rx_over_err=0, rx_packets=389089, tx_bytes=14487246, tx_dropped=0, tx_errors=0, tx_packets=219351}
    status              : {driver_name=tun, driver_version="1.6", firmware_version=""}
    type                : ""

    注意,ingress_policing_rate 和 ingress_policing_burst 的默认单位是 Kbps,这里我们将tap1的带宽限制在了1M。

    5、在 带宽为1M 的情况下,从VM2中通过 netperf 测试的情况如下:

    这次从上面的Throughput来看,出流量也就最大打到了  1Mbps。

    6、我们再次将带宽调增到10M,测试情况:

    这次从上面的Throughput来看,出流量最大打到了  10Mbps。

  • 相关阅读:
    GitHub 集成在Windows Azure Web Site中
    WebMatrix 2发布了!添加了新的Windows Azure 功能
    客户文章: 10gen和微软合作伙伴在云端提供NoSql数据库
    VC++实现IP与ARP信息获取,可以同理实现APR攻击
    现实世界中的 Windows Azure: 刚刚起步的LiquidSpace借助Windows Azure快速发展
    VC++实现遍历所有进程的TCP与UDP链接
    Node.js 体验存储服务和服务运行时
    客户文章:Windows Azure SendGrid入门
    2005年大学毕业生的求职新战略
    WinAPI: RoundRect 绘制圆角矩形
  • 原文地址:https://www.cnblogs.com/CasonChan/p/4610427.html
Copyright © 2011-2022 走看看