Weitere ähnliche Inhalte Ähnlich wie [D20] 高速Software Switch/Router 開発から得られた高性能ソフトウェアルータ・スイッチ活用の知見 (July Tech Festa 2018) (20) Mehr von Tomoya Hibi (10) [D20] 高速Software Switch/Router 開発から得られた高性能ソフトウェアルータ・スイッチ活用の知見 (July Tech Festa 2018)1. Copyright©2018 NTT corp. All Rights Reserved.
高性能ソフトウェアルータ・スイッチ
活用の知見
日比 智也
城倉 弘樹(@slankdev)
NTT未来ねっと研究所
NTT communications
2. Copyright©2018 NTT corp. All Rights Reserved.
アジェンダ
自己&プロジェクト紹介
Lagopus
Kamuee
汎用サーバのアーキテクチャとソフトウェアスイッチ・
ルータへの影響
フロー検索のアルゴリズムと性能特性への影響
100Gbpsを達成するために
1
3. Copyright©2018 NTT corp. All Rights Reserved.
自己紹介(その1)
日比 智也
NTT未来ねっと研究所研究員(2012.4 - )
Lagopus project 開発メンバ (2013.4 - )
2
4. Copyright©2018 NTT corp. All Rights Reserved.
Lagopus project
Develops SDN/NFV software node for carrier networks to
realize
Differentiate services / Time-to-Market / Cost-efficiency
Supported by
The Ministry of Internal Affairs and Communications of Japan (April,
2013 - March, 2016)
NTT (April, 2013 -)
Release
Lagopus software OpenFlow 1.3 switch (July, 2014 - )
• https://github.com/lagopus/lagopus
Lagopus software router (Aug., 2017 - )
• https://github.com/lagopus/lagopus-router (alpha version)
3
5. Copyright©2018 NTT corp. All Rights Reserved.
Lagopus Router
4
Loose coupled modular-based design
(like a microservice architecture)
Unified configuration datastore
Configuration defined by yang
Pub/Sub-like APIs, config datastore as a
broker
Using existing routing agents
Slightly modified for APIs
High performance/extensibility
dataplane
Fast path written in C + DPDK
Slow path written in go
Lagopus Router
Routing
agent
VRRP
agent
IKE agent MAT agent
Dataplane
Dataplane framework
Network
Interface
L2
(Bridging)
L3
(Routing)
IPsec
(crypto)
Config datastore
SDN controller/Orchestrator CLI
gRPC
gRPC or NETLINK
6. 自己紹介 (その2)
● 城倉 弘樹 (SHIROKURA Hiroki)
○ Twitter: @slankdev
○ E-mail: slankdev@nttv6.jp
○ 2017 IPA未踏スーパークリエータ
○ セキュリティキャンプ講師
● パケット処理関連のソフトウェア開発をしている. パケットが好き
● Hackのようなものも好き. (解析ツールとかを組み合わせて色々遊ぶのもすき)
7. NTT Com 技術開発部 Kamuee
6
これまで
➔ NTT Comでソフトウェアルータを作った
➔ インターネットのフルルートを持ちつつも,
ショートパケットで高性能な転送が可能なソフトウェアルータを作る.
➔ しかもそれをIAアーキテクチャのみで実現している
➔ 今後のSDN/NFVの課題である性能問題を解決する
➔ 社のサービスや製品化して, 貢献したい <- いまここ
関連研究
➔ H. Asai, Y. Ohara "Poptrie: A Compressed Trie with Population Count for Fast and Scalable Software IP Routing
Table Lookup", ACM SIGCOMM ‘15 ルーティングルックアップアルゴリズム
➔ Y. Ohara, Y. Yamagishi “Kamuee Zero: the Design and Implementation of Route Table for High-Performance
Software Router”, IC ’16 高速なソフトウェアL3スイッチ設計実装
➔ Interop 2018 shownet コアルータとして動かしていただいた.
8. Copyright©2018 NTT corp. All Rights Reserved.
なぜ汎用x86サーバなのか?
汎用サーバはかなり速くなっている
ほぼ毎年性能が改善される
コア数もどんどん増えている
どこでも入手可能かつ実行可能
秋葉原や近くの電気屋で買える
仮想環境上でも動作可能
安い
10万以下で8 core CPU, 6 port 1GbEの構成
予算にあわせて様々な構成で買える
エンジニアはいっぱいいる
開発環境・コンパイラ・ライブラリは充実
7
9. Copyright©2018 NTT corp. All Rights Reserved.
10Gbps達成のために必要なパケット処理数
0
5,000,000
10,000,000
15,000,000
20,000,000
0 256 512 768 1024 1280
#ofpacketsperseconds
Packet size (Byte)
Short packet 64Byte
14.88 MPPS, 67.2 ns
Computer packet 1KByte
1.2MPPS, 835 ns
10. Copyright©2018 NTT corp. All Rights Reserved.
汎用サーバの構成
NIC
CPU CPUMemory
Memory
NIC
NICNIC
QPI
PCI-Exp PCI-Exp
Reference: supermicro X9DAi
11. Copyright©2018 NTT corp. All Rights Reserved.
CPUのキャッシュとメモリの構成
階層化されたキャッシュを持っている
キャッシュに入っているデータ・アクセスはとても速い
メインメモリのデータを見る場合はとても遅い
連続するデータについてはプリフェッチ機構が
利用可能 Size
(Byte)
Bandwidth
(GB/s)
Latency - random
L1 $ 32K 699 4 clock
L2 $ 256K 228 12 clock
L3 $ 6M 112 44 clock
Memory G class 20 300 cycles
(91 ns)
12. Copyright©2018 NTT corp. All Rights Reserved.
パケット処理の流れ
受信処理
packet
フレーム処理
フロー検索
・ヘッダ書換え
QoS・Queue
送信処理
packet
NICのドライバ処理
パケットのパージング
Lookup,
Header書き換え
Policer, Shaper
Marking
カウンタ処理
13. Copyright©2018 NTT corp. All Rights Reserved.
パケット処理の流れ
受信処理
packet
フレーム処理
フロー検索
・ヘッダ書換え
QoS・Queue
送信処理
packet
NICのドライバ処理
パケットのパージング
Lookup,
Header書き換え
Policer, Shaper
Marking
カウンタ処理
14. Copyright©2018 NTT corp. All Rights Reserved.
パケット処理アプリ on Linux/PC
13
NIC
skb_buf
Ethernet Driver API
Socket API
vswitch
packet buffer
Data plane
ユーザ空間でのパケット処理アプリ
(イベントベースの処理)
1. Interrupt
& DMA
2. system call (read)
User
space
Kernel space
Driver
4. DMA
3. system call (write)
カーネル空間でのパケット処理
(イベントベースの処理)
NIC
skb_buf
Ethernet Driver API
Socket API
vswitch
packet buffer
1. Interrupt
& DMA
vswitch
Data plane
agentagent
2. DMA
15. Copyright©2018 NTT corp. All Rights Reserved.
パケット処理アプリ on Linux/PC
14
NIC
skb_buf
Ethernet Driver API
Socket API
vswitch
packet buffer
Data plane
ユーザ空間でのパケット処理アプリ
(イベントベースの処理)
1. Interrupt
& DMA
2. system call (read)
User
space
Kernel space
Driver
4. DMA
3. system call (write)
カーネル空間でのパケット処理
(イベントベースの処理)
NIC
skb_buf
Ethernet Driver API
Socket API
vswitch
packet buffer
1. Interrupt
& DMA
vswitch
Data plane
agentagent
2. DMA
Contexts switch
Interrupt-based
Many memory copy / read
16. Copyright©2018 NTT corp. All Rights Reserved.
DPDK パケット処理アプリ
15
DPDKアプリ
(ポーリングベースの処理)
NIC
Ethernet Driver API
Socket API
vswitch
packet buffer
agent
1. DMA
Write
2. DMA
READ
DPDK
Data plane
NIC
skb_buf
Ethernet Driver API
Socket API
vswitch
packet buffer
Data plane
ユーザ空間でのパケット処理アプリ
(イベントベースの処理)
1. Interrupt
& DMA
2. system call (read)
User
space
Kernel space
Driver
4. DMA
3. system call (write)
1. Interrupt
& DMA
agent Contexts switch
Interrupt-based
Many memory copy / read
17. Copyright©2018 NTT corp. All Rights Reserved.
参考:XDP
KernelのNetworkStackに入る前に安全にいろいろできる
16
16
NIC
skb_buf
Ethernet Driver API
Socket API
packet buffer
vswitch
Data plane
agent
https://www.iovisor.org/technology/xdp
18. Copyright©2018 NTT corp. All Rights Reserved.
高速化のための実装の工夫
処理のバイパス
受信時パケットデータをNICのバッファから直接CPUキャッシュへ転送
(Intel Data Direct I/O)
カーネルにおける処理のバイパス
フロー検索$活用によるフロー検索処理の軽量化
メモリアクセスの削減と局所化
コンパクトな検索木の作成
Thread local storageの活用
パケット処理の部分化とそのCPUへの明示的な割当て
パケット処理のCPUコアへの明示的な割り当て
CPUやバスの内部接続を考慮したスレッドのCPUへの
割り当て
19. Copyright©2018 NTT corp. All Rights Reserved.
汎用サーバの構成
NIC
CPU CPUMemory
Memory
NIC
NICNIC
QPI
PCI-Exp PCI-Exp
Reference: supermicro X9DAi
20. Copyright©2018 NTT corp. All Rights Reserved.
Interop Tokyo 2016
vNIC between DPDK-enabled Lagopus and
DPDK-enabled VNF (Virnos)
Many vNICs and flow director (loadbalancing)
8 VNFs and total 18 vNICs
HV VirNOS VirNOS VirNOS VirNOS
lagopus
lagopus
port2
port4 port6 port8 port10
port9port7port5port3
port1
Eth0
Eth1
Eth0
Eth1
Eth0
Eth1
Eth0
Eth1
21. Copyright©2018 NTT corp. All Rights Reserved.
Explicit resource assignment for
performance
Packet processing workload aware assignment is
required for Lagopus and VNF
Memory
Memory
NIC
core
core
core
core
core
core
core
core
core
core
core
core
core
core
core
core
CPU0 CPU1
Traffic
22. Copyright©2018 NTT corp. All Rights Reserved.
Resource assign impacts in packet
processing performance
Memory Memory
NIC
core
core
core
core
core
core
core
core
core
core
core
core
core
core
core
core
CPU0 CPU1
Traffic
Lagopus 8 VNFs
Memory Memory
NIC
core
core
core
core
core
core
core
core
core
core
core
core
core
core
core
core
CPU0 CPU1
Traffic
Lagopus8 VNFs
4.4Gbps
10Gbps
23. Copyright©2018 NTT corp. All Rights Reserved.
パケット処理の流れ
受信処理
packet
フレーム処理
フロー検索
・ヘッダ書換え
QoS・Queue
送信処理
packet
NICのドライバ処理
パケットのパージング
Lookup,
Header書き換え
Policer, Shaper
Marking
カウンタ処理
24. Copyright©2018 NTT corp. All Rights Reserved.
フロー検索
Open vSwitch
OpenFlow
VPP
MAC & IP & L4 など
Kamuee
IPのみ
23
25. Copyright©2018 NTT corp. All Rights Reserved.
Open vSwtichのフロー検索
2段階のキャッシュを利用する構造
24
- Ben Pfaff et al., The Design and Implementation of Open vSwitch , NSDI 2015
- Thomas F Herbert, FD.io/VPP OVS DPDK, DPDK User Space Summit 2015 Dublin
26. Copyright©2018 NTT corp. All Rights Reserved.
VPP
VPPはネットワークスタックを処理するフレームワーク
各ノードそれぞれのアルゴリズムで検索し,木をたどる
Not OpenFlow
25
27. Copyright©2018 NTT corp. All Rights Reserved.
VPP vs OVS Performance
OpenFlow用の検索とMAC用の検索で勝負しても差があるのは当たり前.
ユースケースに合わせたソフトウェアの採用が重要
http://dpdksummit.com/Archive/pdf/2016USA/Day02-Session04-ThomasHerbert-DPDKUSASummit2016.pdf
28. Poptrie
27
検索性能(1コア)
- 240.52 Mlps (Tier 1 backbone フルルート531,489経路,ランダムアドレス)
Radix Treeを多分木にして, 子ノード部分を配列とする. -> データ空間が非常に圧縮可能
CPUのLLC(Last Level Cacheに圧縮することができる)
参考: https://ja.tech.jar.jp/network/algorithms/poptrie/intro.html
ACM SIGCOMM’15再録. 東大浅井 特任助教(当時) 発明. NTT Com特許持ち
29. Copyright©2018 NTT corp. All Rights Reserved.
アジェンダ
自己&プロジェクト紹介
Lagopus
Kamuee
汎用サーバのアーキテクチャとソフトウェアスイッチ・
ルータへの影響
フロー検索のアルゴリズムと性能特性への影響
100Gbpsを達成するために
28
37. Run to Completion Model & Pipeline Model
36
簡略化のために 10GbE x 2port 版
で説明
KamueeはRun to Completion
LagopusはPipeline
39. Copyright©2018 NTT corp. All Rights Reserved.
まとめ
アーキテクチャ,アルゴリズムによって性能は大きく変わ
る
目的とするユースケースによってアーキテクチャ,アルゴ
リズムも変わるので,性能特性も変わる
アーキテクチャ,アルゴリズムを理解し,あたりをつけて
性能を実際に測りながら構築するのがよい
38