danny

http://dannykim.me/danny/57771

2014.02.11 14:34:58 (*.193.128.184)

592

>>> Purpose
This document helps us understand how QoS works in OpenVSwitch.
This document can be used as a warming up before a good tutorial(URL is shown below at References)
to create a floodlight module to handle QoS.
>>> Reference
- How to create QoS Service Module
- man ovs-vsctl (Quality of Service (QoS) section)
>>> Outline
QoS is the service to differentiate delivery service.
In some packets, it is delivered at high speed, but others can be delivered at lower speed.
Based on my understanding, key essence of QoS at OpenVSwitch is to create queues with different speed, and put packets into different queues depending on QoS policy.
This document does not handle all of them, but just taste how to configure OpenVSwitch for QoS.
In detail. we just create a queue with low speed, and QoS use the queue.
We expect transfer rate is reduced (2Mbps) as a result.
Though this does not show all deployment of QoS, it can be a starting point of QoS.
For more detail, please refer to a Reference URL (above).
>>> Steps
- IPerf test (check speed)
- Create a qos with a low-speed queue
- IPerf test (check speed)
*** Appendix
- Some useful commands for qos.
>>> Environment
- SDN network (I do not use mininet)
  host1 - OVS - ... - OVS - host2
- OS: Ubuntu 12.04
>>> IPerf test
- receiver
[root@host2 ~]# iperf -s
------------------------------------------------------------
Server listening on TCP port 5001
TCP window size: 85.3 KByte (default)
------------------------------------------------------------
[  4] local 192.168.2.15 port 5001 connected with 192.168.2.11 port 49038
[ ID] Interval       Transfer     Bandwidth
[  4]  0.0-10.3 sec   116 MBytes  94.1 Mbits/sec
*** To open 5001 port, use following commands in Receiver
(if you see "no connection..." message)
[root@host2 ~]# iptables -I INPUT -p tcp -j ACCEPT --dport=5001
[root@host2 ~]# iptables -L INPUT
Chain INPUT (policy ACCEPT)
target     prot opt source               destination        
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:commplex-link // <-- 5001 port
:
- sender
[root@host1 ~]# iperf -c host2 -p 5001
------------------------------------------------------------
Client connecting to host2, TCP port 5001
TCP window size: 22.9 KByte (default)
------------------------------------------------------------
[  3] local 192.168.2.11 port 49038 connected with 192.168.2.15 port 5001
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-10.0 sec   116 MBytes  96.5 Mbits/sec       // <-- current maxium speed

>>> Choose a port in any switch on path

root@ovs-edge-app1:~# ovs-vsctl show
b03d92f0-bd5d-4a32-bc37-3542873b2e79
    Bridge "br0"
        Controller "tcp:192.168.1.1:6633"
            is_connected: true
        fail_mode: secure
Port "eth1"
            Interface "eth1"

        Port "vnet1"
            Interface "vnet1"
        Port "br0"
            Interface "br0"
                type: internal

*** Here, I choose eth1 that are on data path from host1 to host2. You can use any port that is on data path.

>>> Create a qos with a low-speed queue (at any switch on path)
Following command does ..
1) create a queue(q0)
q0 (2 Mbps): --id=@q0 create queue other-config:min-rate=2000000 other-config:max-rate=2000000
2) create a qos (newqos) and connect a queue into the qos
--id=@newqos create qos type=linux-htb queues=0=@q0
3) connect a created qos (newqos) to a existing port (eth1)
set port eth1 qos=@newqos
Thus, port(eth1) -- qos(newqos) -- queue(q1)
root@switch:~# ovs-vsctl set port eth1 qos=@newqos -- --id=@newqos create qos type=linux-htb queues=0=@q0 -- --id=@q0 create queue other-config:min-rate=2000000 other-config:max-rate=2000000
ea9aa386-8558-4df6-84dc-55b50eb795a1
340c74b1-7dc4-4959-b8c5-4d25c463556c
root@switch:~# ovs-vsctl list port eth1
_uuid               : 0fb256d5-df68-4d1a-8b56-74bdd0b4482a
bond_downdelay      : 0
bond_fake_iface     : false
bond_mode           : []
bond_updelay        : 0
external_ids        : {}
fake_bridge         : false
interfaces          : [737c5011-97cc-4c11-9370-07b845e94294]
lacp                : []
mac                 : []
name                : "eth1"
other_config        : {}
qos                 : ea9aa386-8558-4df6-84dc-55b50eb795a1    // added qos
statistics          : {}
status              : {}
tag                 : []
trunks              : []
vlan_mode           : []
root@switch:~# ovs-vsctl list qos
_uuid               : ea9aa386-8558-4df6-84dc-55b50eb795a1
external_ids        : {}
other_config        : {}
queues              : {0=340c74b1-7dc4-4959-b8c5-4d25c463556c}  // added queue
type                : linux-htb
root@switch:~# ovs-vsctl list queue
_uuid               : 340c74b1-7dc4-4959-b8c5-4d25c463556c
dscp                : []
external_ids        : {}
other_config        : {max-rate="2000000", min-rate="2000000"} // 2 Mbps
root@switch:~#
>>> IPerf test (check speed) again
- receiver
[root@host2 ~]# iperf -s
------------------------------------------------------------
Server listening on TCP port 5001
TCP window size: 85.3 KByte (default)
------------------------------------------------------------
[  4] local 192.168.2.15 port 5001 connected with 192.168.2.11 port 49039
[ ID] Interval       Transfer     Bandwidth
[  4]  0.0-14.2 sec  3.25 MBytes  1.91 Mbits/sec    // <-- now, reduced to about 2 Mbps
- sender
[root@host1 ~]# iperf -c host2 -p 5001
------------------------------------------------------------
Client connecting to host2, TCP port 5001
TCP window size: 22.9 KByte (default)
------------------------------------------------------------
[  3] local 192.168.2.11 port 49039 connected with 192.168.2.15 port 5001
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-10.3 sec  3.25 MBytes  2.65 Mbits/sec    // <-- now, reduced to about 2 Mbps
>>> Discussion
Here, we used just a queue. With multiple queues in a qos, we can handle packets for different services. 
That is, high-serviced packets are forwared to high-speed queue.
For more information, again you may want to refer a Reference URL (above at reference section)

Now, you may want to disconnect qos from a port and remove queue and qos, then want to test speed again. For commands to remove, please see following appendix.


>>> Appendix: Some useful commands for qos.
Here, I show just screen captures related to qos.
- create a qos
root@switch:~# ovs-vsctl create qos type=linux-htb
26477113-cad7-4ba6-8210-a2e71d808134
root@switch:~# ovs-vsctl list qos
_uuid               : 26477113-cad7-4ba6-8210-a2e71d808134
external_ids        : {}
other_config        : {}
queues              : {}
type                : linux-htb
*** To remove qos, use following commands.
root@switch:~# ovs-vsctl --all destroy qos
- create a qos (specifying max-rate)
root@switch:~# ovs-vsctl create qos type=linux-htb other-config:max-rate=1000000000
e9187f85-333f-49db-bd15-183f76745f4d
root@switch:~# ovs-vsctl list qos
_uuid               : e9187f85-333f-49db-bd15-183f76745f4d
external_ids        : {}
other_config        : {max-rate="1000000000"}
queues              : {}
type                : linux-htb
root@switch:~# ovs-vsctl --all destroy qos
root@switch:~# ovs-vsctl list qos
- create a qos and a queue (for the qos)
root@switch:~# ovs-vsctl create qos type=linux-htb other-config:max-rate=1000000000 queues=0=@q0 -- --id=@q0 create queue other-config:min-rate=5000000 other-config:max-rate=5000000
0d6a738e-0597-4290-8c98-4c5593b1ca1f
8453ca2d-4931-4d55-b0f5-51b30c825d63
root@switch:~# ovs-vsctl list qos
_uuid               : 0d6a738e-0597-4290-8c98-4c5593b1ca1f
external_ids        : {}
other_config        : {max-rate="1000000000"}
queues              : {0=8453ca2d-4931-4d55-b0f5-51b30c825d63}
type                : linux-htb
root@switch:~# ovs-vsctl list queue
_uuid               : 8453ca2d-4931-4d55-b0f5-51b30c825d63
dscp                : []
external_ids        : {}
other_config        : {max-rate="5000000", min-rate="5000000"}
root@switch:~# ovs-vsctl destroy qos 0d6a738e-0597-4290-8c98-4c5593b1ca1f    // <-- UUID
root@switch:~# ovs-vsctl list qos
root@switch:~# ovs-vsctl list queue
_uuid               : 8453ca2d-4931-4d55-b0f5-51b30c825d63
dscp                : []
external_ids        : {}
other_config        : {max-rate="5000000", min-rate="5000000"}
root@switch:~# ovs-vsctl destroy queue 8453ca2d-4931-4d55-b0f5-51b30c825d63    // <-- UUID
root@switch:~# ovs-vsctl list queue
*** or
> ovs-vsctl --all destroy qos
> ovs-vsctl --all destroy queue
- create a qos and two queues(for the qos)
root@switch:~# ovs-vsctl create qos type=linux-htb other-config:max-rate=1000000000 queues=0=@q0,1=@q1 -- --id=@q0 create queue other-config:min-rate=1000000000 other-config:max-rate=1000000000 -- --id=@q1 create queue other-config:min-rate=2000000 other-config:max-rate=2000000
5e4d4e8e-5ed8-41c6-845d-c177cc443daf
511a5c4e-ee79-4af7-a911-a43b18a79bbb
13350643-4441-4bd4-9a64-b6e9f62310cb
root@switch:~# ovs-vsctl list qos
_uuid               : 5e4d4e8e-5ed8-41c6-845d-c177cc443daf
external_ids        : {}
other_config        : {max-rate="1000000000"}
queues              : {0=511a5c4e-ee79-4af7-a911-a43b18a79bbb, 1=13350643-4441-4bd4-9a64-b6e9f62310cb}
type                : linux-htb
root@switch:~# ovs-vsctl list queue
_uuid               : 511a5c4e-ee79-4af7-a911-a43b18a79bbb
dscp                : []
external_ids        : {}
other_config        : {max-rate="1000000000", min-rate="1000000000"}
_uuid               : 13350643-4441-4bd4-9a64-b6e9f62310cb
dscp                : []
external_ids        : {}
other_config        : {max-rate="2000000", min-rate="2000000"}
- create a qos and connect to a port
root@switch:~# ovs-vsctl set port eth1 qos=@newqos -- --id=@newqos create qos type=linux-htb
9c776df4-6113-44d2-853d-c2791fb180ac
root@switch:~# ovs-vsctl list port eth1
_uuid               : 0fb256d5-df68-4d1a-8b56-74bdd0b4482a
bond_downdelay      : 0
bond_fake_iface     : false
bond_mode           : []
bond_updelay        : 0
external_ids        : {}
fake_bridge         : false
interfaces          : [737c5011-97cc-4c11-9370-07b845e94294]
lacp                : []
mac                 : []
name                : "eth1"
other_config        : {}
qos                 : 9c776df4-6113-44d2-853d-c2791fb180ac   // <-- qos
statistics          : {}
status              : {}
tag                 : []
trunks              : []
vlan_mode           : []
root@switch:~# ovs-vsctl list qos
_uuid               : 9c776df4-6113-44d2-853d-c2791fb180ac
external_ids        : {}
other_config        : {}
queues              : {}
type                : linux-htb
root@switch:~# ovs-vsctl clear port eth1 qos
root@switch:~# ovs-vsctl list port eth1
_uuid               : 0fb256d5-df68-4d1a-8b56-74bdd0b4482a
bond_downdelay      : 0
bond_fake_iface     : false
bond_mode           : []
bond_updelay        : 0
external_ids        : {}
fake_bridge         : false
interfaces          : [737c5011-97cc-4c11-9370-07b845e94294]
lacp                : []
mac                 : []
name                : "eth1"
other_config        : {}
qos                 : []              // <-- clear qos
statistics          : {}
status              : {}
tag                 : []
trunks              : []
vlan_mode           : []
root@switch:~# ovs-vsctl list qos
_uuid               : 9c776df4-6113-44d2-853d-c2791fb180ac
external_ids        : {}
other_config        : {}
queues              : {}
type                : linux-htb
root@switch:~# ovs-vsctl --all destroy qos
root@switch:~# ovs-vsctl list qos
- create a qos and two queues(for the qos) and connect the qos into a port
Following command does ..
1) create two queues (q1, q2)
q1 (1000 Mbps): --id=@q0 create queue other-config:min-rate=1000000000 other-config:max-rate=100000000
q2 (2 Mbps): --id=@q1 create queue other-config:min-rate=2000000 other-config:max-rate=2000000
2) create a qos (newqos) and connect two queues into the qos
--id=@newqos create qos type=linux-htb queues=0=@q0,1=@q1
3) connect a created qos (newqos) to a existing port (eth1)
set port eth1 qos=@newqos
Thus, port(eth1) -- qos(newqos) -- queues(q1,q2)
root@switch:~# ovs-vsctl set port eth1 qos=@newqos -- --id=@newqos create qos type=linux-htb queues=0=@q0,1=@q1 -- --id=@q0 create queue other-config:min-rate=1000000000 other-config:max-rate=100000000 -- --id=@q1 create queue other-config:min-rate=2000000 other-config:max-rate=2000000
cad117b3-7ef8-4884-b946-1360b510ebbc
ec0ccbcd-c772-49e8-a970-3b1f67e564d4
4b9ad7d3-a171-4abb-96e1-92bc7634d444
root@switch:~# ovs-vsctl list port eth1
_uuid               : 0fb256d5-df68-4d1a-8b56-74bdd0b4482a
bond_downdelay      : 0
bond_fake_iface     : false
bond_mode           : []
bond_updelay        : 0
external_ids        : {}
fake_bridge         : false
interfaces          : [737c5011-97cc-4c11-9370-07b845e94294]
lacp                : []
mac                 : []
name                : "eth1"
other_config        : {}
qos                 : cad117b3-7ef8-4884-b946-1360b510ebbc
statistics          : {}
status              : {}
tag                 : []
trunks              : []
vlan_mode           : []
root@switch:~# ovs-vsctl list qos
_uuid               : cad117b3-7ef8-4884-b946-1360b510ebbc
external_ids        : {}
other_config        : {}
queues              : {0=ec0ccbcd-c772-49e8-a970-3b1f67e564d4, 1=4b9ad7d3-a171-4abb-96e1-92bc7634d444}
type                : linux-htb
root@switch:~# ovs-vsctl list queue
_uuid               : ec0ccbcd-c772-49e8-a970-3b1f67e564d4
dscp                : []
external_ids        : {}
other_config        : {max-rate="100000000", min-rate="1000000000"}
_uuid               : 4b9ad7d3-a171-4abb-96e1-92bc7634d444
dscp                : []
external_ids        : {}
other_config        : {max-rate="2000000", min-rate="2000000"}

[转]Understand QoS at OpenSwitch的更多相关文章

  1. [转]Microsoft Solutions Framework (MSF) Overview

    本文转自:http://msdn.microsoft.com/zh-CN/library/jj161047(v=vs.120).aspx [This documentation is for prev ...

  2. Quality of Service (QoS) in LTE

    Background: Why we need QoS ? There are premium subscribers who always want to have better user expe ...

  3. 提升网速的路由器优化方法(UPnP、QoS、MTU、交换机模式、无线中继)

    在上一篇<为什么房间的 Wi-Fi 信号这么差>中,猫哥从微波炉.相对论.人存原理出发,介绍了影响 Wi-Fi 信号强弱的几大因素,接下来猫哥再给大家介绍几种不用升级带宽套餐也能提升网速的 ...

  4. Utility3:Understand Dashboard Report

    To see data in the SQL Server Utility dashboard, select the top node in the Utility Explorer tree - ...

  5. 代码阅读分析工具Understand 2.0试用

    Understand 2.0是一款源代码阅读分析软件,功能强大.试用过一段时间后,感觉相当不错,确实可以大大提高代码阅读效率.由于Understand功能十分强大,本文不可能详尽地介绍它的所有功能,所 ...

  6. java.lang.ClassCastException: org.slf4j.impl.Log4jLoggerFactory cannot be cast to ch.qos.logback.classic.LoggerContext问题原因及解决方法

    一.错误信息 java.lang.ClassCastException: org.slf4j.impl.Log4jLoggerFactory cannot be cast to ch.qos.logb ...

  7. 【转载】Understand the serialVersionUID

    If you have ever implemented Serializable interface, you must encounter this warning message The ser ...

  8. H3C qos 简单配置

    qos 有三种服务模型 Best-Effort service(尽力而为服务模型) Integrated service(综合服务模型,简称Int-Serv) Differentiated servi ...

  9. rabbitmq qos prefetch count的设置与作用

    因为原来使用了MQ作为rpc机制,随着客户交易量越来越大,很多服务器推送行情的压力很大,最近打算重写为批量模式,又重新看了下qos和prefetch设置的作用以确定优化的具体细节. 消费者在开启ack ...

随机推荐

  1. [leetcode]92. Reverse Linked List II反转链表2

    Reverse a linked list from position m to n. Do it in one-pass. Note: 1 ≤ m ≤ n ≤ length of list. Exa ...

  2. Mariadb主从复制

    前戏: mysql的基本命令复习 .启动mysql systemctl start mariadb .linux客户端连接自己 mysql -uroot -p -h 127.0.0.1 .远程链接my ...

  3. SpringCloud微服务基础

    1.传统项目架构  传统项目分为三层架构,将业务逻辑层.数据库访问层.控制层放入在一个项目中.适合于个人或者小团队开发,不适合大团队开发. 2.分布式项目架构(解耦方案) 根据业务需求进行拆分成N个子 ...

  4. git master 回滚代码

    回退到指定版本 f6a3d430 (为commit id 前8位) git reset --hard f6a3d430 强制推送到远程分支 git push origin HEAD --force 但 ...

  5. 怎么清理Linux系统磁盘空间占用大:/dev/xvda1

    1.首先查看磁盘占用情况 df -h Filesystem      Size  Used Avail Use% Mounted on/dev/xvda1       20G   18G  621M  ...

  6. Linux服务器上监控网络带宽的18个常用命令 zz

    Linux服务器上监控网络带宽的18个常用命令 本文介绍了一些可以用来监控网络使用情况的Linux命令行工具.这些工具可以监控通过网络接口传输的数据,并测量目前哪些数据所传输的速度.入站流量和出站流量 ...

  7. 团队Scrum冲刺阶段-Day 6

    选择困难症的福音--团队Scrum冲刺阶段-Day 6 今日进展 编写提问部分 游戏分类的界面全部写完了!!!! 临时大家决定没有BGM的app不是一个完整的app,所以在大家共同学习的努力下,听完四 ...

  8. JS require and import

    作者:寸志链接:https://www.zhihu.com/question/56820346/answer/150724784来源:知乎著作权归作者所有.商业转载请联系作者获得授权,非商业转载请注明 ...

  9. 密码与安全新技术专题之AI与密码

    20189217 2018-2019-2 <密码与安全新技术专题>第五周作业 课程:<密码与安全新技术专题> 班级: 1892 姓名: 李熹桥 学号:20189214 上课教师 ...

  10. C#中一些关联名词的含义归纳

    形参/实参:定义一个方法,方法中需要传输的参数为形参,实际调用方法时候传入的参数为实参. 方法/函数:两个没有本质上的区别,都是指类中的一些操作. 委托/事件:委托(delegate)是存有对某个方法 ...