lagopus & nfv with vhost (tremaday#9)
TRANSCRIPT
Copyright©2015 NTT corp. All Rights Reserved.
Birds in Cloud
SDN/NFV: Lagopus & VNF with Vhost
2016/07/02
hibitomo
1
Copyright©2015 NTT corp. All Rights Reserved.
Agenda
- Lagopus?
- Birds in ShowNet
- FPGA + Lagopus + VNF
- Lagopus設定のポイント
- コアアサイン
- Flow設計
- 簡易性能評価
Copyright©2015 NTT corp. All Rights Reserved.
Lagopus
OpenFlowスイッチのソフトウェア実装 汎用x86サーバで動作可能
高速なパケット処理と幅広いプロトコルに対応 > 10Gbps
OpenFlow1.3仕様に幅広く対応
各種トンネリングプロトコル
OpenFlow コントローラ
コントロールプレーン
OpenFlow プロトコル
OpenFlow スイッチ データプレーン
Flow Table フローパターン アクション
フローパターン アクション カウンター
カウンター
Flow Table #2
Flow Table #3
Flow Table #4
Copyright©2015 NTT corp. All Rights Reserved.
What is Lagopus (雷鳥属)?
Lagopus is a small genus of birds in the grouse subfamily, commonly known as ptarmigans. All living in tundra or cold upland areas.
http://en.wikipedia.org/wiki/Lagopus
http://en.wikipedia.org/wiki/Lagopus#mediaviewer/File:Rock_Ptarmigan_(Lagopus_Muta).jpg
Copyright©2015 NTT corp. All Rights Reserved.
What is Lagopus (雷鳥属)?
5
Copyright©2015 NTT corp. All Rights Reserved.
Birds in ShowNet
- 今年はここに居ました.
引用:https://www.facebook.com/interop.shownet
Copyright©2015 NTT corp. All Rights Reserved.
VNF(VirNOS) + Lagopus + FPGA
- 処理はFPGA、転送はLagopus
- NetFPGA-SUME
- IPアドレスからハッシュを計算
- ハッシュ値にもとづいて転送先のVMの目印をSrc MACに書き込む(256種類)
- LagopusはSrc MAC値に応じてVMへ転送
7
HV VNF VNF VNF
lagopus
lagopus
uplink
downlink
hash計算とMACへの埋め込み
MACにもとづいてVMへ送信(staticな
flow entry)
Copyright©2015 NTT corp. All Rights Reserved.
今回接続したVNF
• VirNOS
• IP infusion のコントリビュート
• vRouter/vCPE solutionのVNF
• DPDKが利用可能.
• High performanceモードとTinyモード等の動作モード
• 今回はTinyモードのVirNOSをDPDKでLagopusと接続
8
Copyright©2015 NTT corp. All Rights Reserved. 9
Copyright©2015 NTT corp. All Rights Reserved.
Challenges
- ホストのLagopus(DPDK)とゲストのVirnos(DPDK)の接続
- 多ポート設定と負荷分散(ShowNetでは8台に分散.ポート数は計18)
10
HV VirNOS VirNOS VirNOS VirNOS
lagopus
lagopus
port2
port4 port6 port8 port10
port9 port7 port5 port3
port1
Eth0
Eth1
Eth0
Eth1
Eth0
Eth1
Eth0
Eth1
Copyright©2015 NTT corp. All Rights Reserved.
Agenda
- Lagopus?
- Birds in ShowNet
- FPGA + Lagopus + VNF
- Lagopus設定のポイント
- コアアサイン
- Flow設計
- 簡易性能評価
Copyright©2015 NTT corp. All Rights Reserved.
設定のポイント: コアアサイン
- NUMAを意識したLagopusとVNFでコアアサインを設計する.
- パケット・処理の流れを考える
NIC
CPU CPU Memory Memory
NIC
NIC NIC
QPI
PCI-Exp PCI-Exp
Reference: supermicro X9DAi
Copyright©2015 NTT corp. All Rights Reserved.
設定のポイント: コアアサイン(LagopusとVNF)
- NUMAを意識したLagopusとVNFでコアアサインを設計する.
- パケット・処理の流れを考える
メモリ メモリ
NIC
core
core
core
core
core
core
core
core
core
core
core
core
core
core
core
core
CPU0 CPU1
トラフィック
Copyright©2015 NTT corp. All Rights Reserved.
設定のポイント: コアアサイン(LagopusとVNF)
- NUMAを意識したLagopusとVNFでコアアサインを設計する.
- パケット・処理の流れを考える
メモリ メモリ
NIC
core
core
core
core
core
core
core
core
core
core
core
core
core
core
core
core
CPU0 CPU1
トラフィック
Lagopus VirNOS
(tiny mode) × 8
Copyright©2015 NTT corp. All Rights Reserved.
設定のポイント: コアアサイン(LagopusとVNF)
- NUMAを意識したLagopusとVNFでコアアサインを設計する.
- パケット・処理の流れを考える
メモリ メモリ
NIC
core
core
core
core
core
core
core
core
core
core
core
core
core
core
core
core
CPU0 CPU1
トラフィック
Lagopus VirNOS
(tiny mode) × 8
Copyright©2015 NTT corp. All Rights Reserved.
設定のポイント: コアアサイン(LagopusとVNF)
- コアアサインを間違えると性能は半減する
- 横須賀で測定を実施.1500byte, Lagopusはデフォルトのコアアサイン
18
メモリメモリ
NIC
core
core
core
core
core
core
core
core
core
core
core
core
core
core
core
core
CPU0 CPU1
トラフィック
LagopusVNF × 8
メモリメモリ
NIC
core
core
core
core
core
core
core
core
core
core
core
core
core
core
core
core
CPU0 CPU1
トラフィック
Lagopus VNF× 8約4.4Gbps
約10Gbps
2倍以上の差
Copyright©2015 NTT corp. All Rights Reserved.
HV VirNOS VirNOS VirNOS VirNOS
lagopus
lagopus
port2
port4 port6 port8 port10
port9 port7 port5 port3
port1
Eth0
Eth1
Eth0
Eth1
Eth0
Eth1
Eth0
Eth1
設定のポイント: コアアサイン(LagopusのI/O)
- Pollingでパケットの監視,転送を行うため,ポートが増えるほど性能が落ちる.
- 今回のアーキテクチャでは物理NICへのトラフィックの偏りが顕著
19
10/4 Gbps 10Gbps
Copyright©2015 NTT corp. All Rights Reserved.
HV VirNOS VirNOS VirNOS VirNOS
lagopus
lagopus
port2
port4 port6 port8 port10
port9 port7 port5 port3
port1
Eth0
Eth1
Eth0
Eth1
Eth0
Eth1
Eth0
Eth1
設定のポイント: コアアサイン(LagopusのI/O)
- トラフィックの偏りを考慮したコアアサインを行う
- ShowNetでは4コアをI/Oに利用.下図の様に割り当てた
20
10Gbps
10Gbps
5Gbps 5Gbps
Copyright©2015 NTT corp. All Rights Reserved.
Lagopus設定のポイント(フロールール)
- 256種類のsrc MACをマッチする必要がある.uplinkとdownlinkがあるため,srcMACのExact matchのルールが512種類必要.
- Hash値は下位1byteに埋め込まれ,平等に分散されていることが期待できるので,Maskを用いて下位3bitだけ見るルールに変更することができる.するとルール数は16種類に削減できる.
21
in_port dl_src action
1 52:54:00:00:00:01 1
1 52:54:00:00:00:02 2
… … …
1 52:54:00:00:00:FF X
in_port dl_src action
1 **:**:**:**:**:*0 1
1 **:**:**:**:**:*1 2
… … …
1 **:**:**:**:**:*7 7
Copyright©2015 NTT corp. All Rights Reserved.
性能評価(参考情報)
- いろいろな機器を通っているため,参考情報です.
- トラフィックのボトルネックがLagopusであることは確認済
- 東京テクニカさんにご協力頂きました
22
Copyright©2015 NTT corp. All Rights Reserved.
性能評価(参考情報)
- テスターの値をグラフ化.
- Lagopusには物理->VNFとVNF ->物理NICでトラフィックが2倍かかっている
23
[byte]
[Mbps]
0
1000
2000
3000
4000
5000
6000
7000
8000
9000
10000
0 200 400 600 800 1000 1200 1400
wire rate
lagopus
パケットサイズ
トラフィック量
Copyright©2015 NTT corp. All Rights Reserved.
デモ
24
ごめんなさい,
いろんな時間が足りなかったのでありません><
Copyright©2015 NTT corp. All Rights Reserved.
達成できなかったデモ
25
Lagopus
ShowNet FPGA
Emulator
NIC
port port port port port
VNF VNF VNF VNF
Copyright©2015 NTT corp. All Rights Reserved.
Ansible playbook
- v0.2.4から旧playbookが使えなくなっていたのでいろいろ更新
- 突貫で作ったコードなので,とりあえずfork先しか更新しておりません
- fork先: https://github.com/hibitomo/lagopus-tools
- ついでに機能が追加されています
- 新機能
- DSLの自動生成
- 実行スクリプト自動生成 (vhost, pcap, pipeのvdevにも対応)
- 新ansibleサンプル
- Lagopus - VMを接続するサンプル(qemuの起動スクリプトも生成)
Copyright©2015 NTT corp. All Rights Reserved.
Lagopus slack
- Facebookに「Lagopus Users Community」というグループがあります!
28
Copyright©2015 NTT corp. All Rights Reserved.
時間があれば
29
Copyright©2015 NTT corp. All Rights Reserved.
Agenda
- Bird in ShowNet
- FPGA + Lagopus + VNF
- Lagopus設定のポイント
- コアアサイン
- Flow設計
- 簡易性能評価
- 副産物 lagopus-tools
- ansible
- lago-dsl
- lago-mon
Copyright©2015 NTT corp. All Rights Reserved.
副産物:lagopus-tools
• 元々はインターン生に作らせたAnsibleとRyuのサンプル置き場
• Lagopusが関連するトラブルがほぼなかったため,待ち時間でツールを作成
• 突貫で作ったコードなので,とりあえずfork先しか更新しておりません
• fork先: https://github.com/hibitomo/lagopus-tools
~/lagopus-tools$ ls ansible examples lago-dsl lago-mon LICENSE README.md
Copyright©2015 NTT corp. All Rights Reserved.
副産物:ansible
- v0.2.4から旧playbookが使えなくなっていた
- 今回,最新のLagopus用に更新.ついでに機能追加.
- 新機能
- DSLの自動生成
- 実行スクリプト自動生成 (vhost, pcap, pipeのvdevにも対応)
- 新ansibleサンプル
- Lagopus - VMを接続するサンプル(qemuの起動スクリプトも生成)
Copyright©2015 NTT corp. All Rights Reserved.
副産物:lago-dsl
• lagopusのDSLを直接叩くスクリプト.
• デバッグ用途以外の使用は推奨しない.
• 直接,flow,interface等の編集をすることができる.
• 実行
$ ./lago-dsl.py [lagopus DSL]
$ ./lago-dsl.py < [lagopus DSL file]
Copyright©2015 NTT corp. All Rights Reserved.
副産物:lago-mon
- Lagopus用モニタリングツール
- 動作確認の為に`lagosh -c show xxx` を連打してカウンタの差分を目grepするのは辛い.
- logを取る為に`lagosh -c show xxx`を定期的に実行して,整形済みjsonを一行に戻すのは手間.
- 16 x 16ドットのロゴ
- プロトタイプのファイル名がlagomon.pyだった.作るしか無いと思った.後悔はしていない.
ラゴモン(成長期)
Copyright©2015 NTT corp. All Rights Reserved.
副産物:lago-mon
- Lagopus用モニタリングツール
- 動作確認の為に`lagosh -c show xxx` を連打してカウンタの差分を目grepするのは辛い.
- logを取る為に`lagosh -c show xxx`を定期的に実行して,整形済みjsonを一行に戻すのは手間.
- 16 x 16ドットのロゴ
- プロトタイプのファイル名がlagomon.pyだった.作るしか無いと思った.後悔はしていない.
- AA版もあります.( 15 x 36 )
######## ## ;;;; ## ## #### ## #### ## ## ## #### ##### ######## ## ############## ## ## ### ######## ## ## #### ## ## ## #### ## #### ## ## ## ## ## ###### #### #### #### #### ########## #################### mmmm ## ##########
ラゴモン(成長期)
Copyright©2015 NTT corp. All Rights Reserved.
副産物:lago-mon/ifstats-monitor.py
- 実行(指定間隔でJSONを出力するだけ)
- 出力例
{"timestamp": "2016-06-08T14:13:04.253669", "interfaces": {"interface1": {"name": "interface1", "rx-dropped": 0, "tx-errors": 0, "rx-bytes": 0, "tx-packets": 0, "rx-packets": 0, "tx-bytes": 0, "rx-errors": 0, "tx-dropped": 0}, "interface0": {"name": "interface0", "rx-dropped": 0, "tx-errors": 0, "rx-bytes": 0, "tx-packets": 0, "rx-packets": 0, "tx-bytes": 0, "rx-errors": 0, "tx-dropped": 0}}}
$ ./ifstats_monitor.py -l 10 間隔 [sec]
Copyright©2015 NTT corp. All Rights Reserved.
副産物:lago-mon/ifstats-monitor.py
- 実行(moniter.強いリクエストにより,bpsとppsを表示)
- 出力例
2016/06/08 14:22:49 +------------+------------------+--------------+------------------+--------------+ | name | rx-bps | rx-pps | tx-bps | tx-pps | +------------+------------------+--------------+------------------+--------------+ | interface0 | 0 | 0 | 0 | 0 | | interface1 | 0 | 0 | 0 | 0 | +------------+------------------+--------------+------------------+--------------+
$ ./ifstats_monitor.py -m 10 更新間隔 [sec]
Copyright©2015 NTT corp. All Rights Reserved.
副産物:lago-mon/flowstats-monitor.py
- 実行(moniter.同一フローの識別が不可能な為,bps, ppsは無い.)
- 出力例
2016/06/08 14:27:45 bridge01, table: 0 +----------+--------+--------------+------------+----------------+--------------------------------------+--------------+--------------+ | priority | cookie | packet_count | byte_count | data | actions | hard_timeout | idle_timeout | +----------+--------+--------------+------------+----------------+--------------------------------------+--------------+--------------+ | 100 | 0 | 0 | 0 | {"in_port": 2} | [{"apply_actions": [{"output": 1}]}] | 0 | 0 | | 100 | 0 | 0 | 0 | {"in_port": 1} | [{"apply_actions": [{"output": 2}]}] | 0 | 0 | +----------+--------+--------------+------------+----------------+--------------------------------------+--------------+--------------+
$ ./flowstats_monitor.py -m 10 更新間隔 [sec]
Copyright©2015 NTT corp. All Rights Reserved.
副産物:lago-mon/flowstats-monitor.py
- 実行(指定間隔でJSONを出力するだけ)
- 出力例
{"timestamp": "2016-06-08T14:25:44.853720", "flows": {"bridge01": {"tables": [{"table": 0, "flows": [{"stats": {"packet_count": 0, "byte_count": 0}, "hard_timeout": 0, "actions": [{"apply_actions": [{"output": 2}]}], "priority": 100, "idle_timeout": 0, "cookie": 0, "in_port": 1}, {"stats": {"packet_count": 0, "byte_count": 0}, "hard_timeout": 0, "actions": [{"apply_actions": [{"output": 1}]}], "priority": 100, "idle_timeout": 0, "cookie": 0, "in_port": 2}]}], "name": "bridge01"}}}
$ ./flowstats_monitor.py -l 10 間隔 [sec]
Copyright©2015 NTT corp. All Rights Reserved.
lago-monを利用したツール連携
40
Lagopus DSL
log file
Lagopus Server Log/Display Server
REST
Copyright©2015 NTT corp. All Rights Reserved.
lago-monを利用したツール連携
• 出力例(Ryu-certification動作中のログ)
41
Copyright©2015 NTT corp. All Rights Reserved.
まとめ
- Bird in ShowNet
- LagopusとDPDKでVMに接続
- LagopusとFPGAでVMにロードバランス
- 副産物(lagopus-tools)
- ansible
- lago-dsl.py
- lago-mon
Copyright©2015 NTT corp. All Rights Reserved.
ご清聴ありがとうございました
43
########## ;;;; #### #### ##
#### #### ## ####
##### ######## ################ ## ##
### ######## ## ###### ## ## ## #### ###### ## ## ## ## ##
###### #### ######## #### ##########
####################mmmm ############