Performance Benchmarking and Tuning for Container ...

26
© 2020 Arm Limited (or its affiliates) Trevor Tao, Jianlin Lv, Jingzhao Ni, Song Zhu Sep/2020 Performance Benchmarking and Tuning for Container Networking on Arm

Transcript of Performance Benchmarking and Tuning for Container ...

Page 1: Performance Benchmarking and Tuning for Container ...

© 2020 Arm Limited (or its affiliates)

Trevor Tao,

Jianlin Lv, Jingzhao Ni, Song Zhu

Sep/2020

Performance Benchmarking and Tuning for Container Networking on Arm

Page 2: Performance Benchmarking and Tuning for Container ...

2 © 2020 Arm Limited (or its affiliates)

Agenda

• Introduction

• Container Networking Interfaces(CNIs) on arm

• Benchmarking metrics, environment and tools

• Benchmarking results

• Initial Performance Analysis with perf tools

• Future Work(Provisional)

Page 3: Performance Benchmarking and Tuning for Container ...

© 2020 Limited

Introduction

Page 4: Performance Benchmarking and Tuning for Container ...

4 © 2020 Arm Limited (or its affiliates)

Kubernetes Networking Model

• Kubernetes makes opinionated choices about how Pods are networked:

• all Pods can communicate with all other Pods without using network address translation (NAT).

• all Nodes can communicate with all Pods without NAT.

• The IP that a Pod sees itself as is the same IP that others see it as.

• Networking objects• Container-to-Container networking• Pod-to-Pod networking• Pod-to-Service networking• Internet-to-Service networking

IntroductionWhat is CNI?• CNI (Container Network Interface), a Cloud Native Computing

Foundation project, consists of a specification and libraries for writing plugins to configure network interfaces in Linux containers, along with a number of supported plugins.

• CNI concerns itself only with network connectivity of containers and removing allocated resources when the container is deleted.

• CNI has a wide range of support and the specification is simple to implement but not the implementation itself for its extensions.

• CNI are the de-facto Kubernetes networking support

• We need to know how they perform on arm platform

Page 5: Performance Benchmarking and Tuning for Container ...

© 2020 Limited

Container Networking Interfaces(CNIs) on arm

Page 6: Performance Benchmarking and Tuning for Container ...

6 © 2020 Arm Limited (or its affiliates)

High Performance CNIs available for Arm Edge Stack

Things now available in Akraino IEC Arm edge stack as a ref:

6

IEC Arm Edge Stack

Calico Cilium Contiv-VPP OVN-K8s FlannelSRIOV

• pure IP networking fabric

• high-level network policy management by iptables

• Good scalability

• Support direct(non-overlay) and overlay(IPINIP, VxLAN) network connection

• Easy deployment

• Calico-VPP appears

• Linux-Native, API-Aware Networking and Security for Containers

• Linux eBPF based network policy, load balance and security which is believed to be with incredible performance

• L3 networking between hosts

• Good scalability too

• uses FD.io VPP to provide network connectivity between PODs

• Native DPDK interface support for phy NIC

• Native VPP ACL/NAT based network policy and access

• Good performance but with rather complex configuration

• Hard to debug

• OVS/OVN-controller based K8s networking solution

• Rather good performance with OVS inherited

• Use OVN logical switches/routers to connect Pods and for outside access

• No OVS-DPDK support now

• Direct physical interfaces(PF/VFs) support for Pods

• High performance with direct Linux kernel eth driver or DPDK PMD driver

• Usually co-work with other CNIs, such as Flannel, Calico by Multus or other glue CNI

• Need resource description or annotation when do the configuration for CNI and Pod setup

• Widely used and almost easiest deployment for a simple K8s networking

• Linux network bridge for pod connection and overlay based communication for inter-hosts access

• Easy to be integrated into other container networking solution, e.g., Cilium

• No good network policy support

Repo: https://gerrit.akraino.org/r/admin/repos/iec

Page 7: Performance Benchmarking and Tuning for Container ...

7 © 2020 Arm Limited (or its affiliates)

CNI Networking Models

Flannel

7

Cilium

Backend:

IPIP, VXLANBackend:

VXLAN, Direct Routing(not tested now)

Tested version: v0.11.0 Tested version:

Master branch compiled at 2020-09-09

Quote from web source

Ref. and modifiedfrom web source

Page 8: Performance Benchmarking and Tuning for Container ...

8 © 2020 Arm Limited (or its affiliates)

CNI Networking Models

Calico Kubernetes Service

Implementation

Tested version: v3.13.2

Quote from web source

Page 9: Performance Benchmarking and Tuning for Container ...

© 2020 Limited

Benchmarking metrics, environment and tools

Page 10: Performance Benchmarking and Tuning for Container ...

10 © 2020 Arm Limited (or its affiliates)

10

Benchmarking Metrics• Protocols: TCP, UDP, HTTP(s)• TCP, UDP Metrics: bandwidth in Mbits/sec, Gbits/sec, round-trip delay in ms• HTTP(s): Bandwidth in Mbits/sec, Gbits/sec, CPS(Connection per Second),

RPS(Request per Second)

Tools:• IPerf, WRK

Benchmarking metrics, topology and tools

Server PlatformArchitecture: aarch64Byte Order: Little EndianCPU(s): xxxOn-line CPU(s) list: 0-xxxThread(s) per core: 4

CPU max MHz: 2500.0000CPU min MHz: 1000.0000BogoMIPS: 400.00L1d cache: xxKL1i cache: xxKL2 cache: xxxKL3 cache: xxxxK

NUMA node0 CPU(s): 0-xxxNUMA node1 CPU(s): xxx-yyy

Network connection: 10Gbps connection byEthernet Controller XXV710----→82599ES 10-Gigabit SFI/SFP+ Network Connection 10fb

Page 11: Performance Benchmarking and Tuning for Container ...

11 © 2020 Arm Limited (or its affiliates)

Benchmarking metrics, environment and tools

11

IPerf(v2) test topology: Wrk (http performance) test topology:

Test Command:Client: iperf -c ${SERVER_IP} -t ${time} -i 1 -w 100K -P 4

Server: Iperf -s

Test command:wrk -t12 -c1000 -d30s http://$IP/files/$file

Nginx

Page 12: Performance Benchmarking and Tuning for Container ...

© 2020 Limited

Benchmarking Results

Page 13: Performance Benchmarking and Tuning for Container ...

13 © 2020 Arm Limited (or its affiliates)

Benchmarking Results of TCP Throughput for CNIs with Different Backends

0

2

4

6

8

10

12

1500 2000 3000 4000 5000 6000 7000 8000 9000

BW(Gbps)

MTU size (Byte)

Node to Pod TCP Performance for IPIP(Calico), IPIP(Flannel), VXLAN(Flannel), VXLAN(Cilium) and Direct Routing(no Tunnel, Calico)

Inter-Hosts 10Gb/s ether connection

Calico IPIP Tunnel Flannel IPIP Tunnel Flannel VXLAN Tunnel Cilium VXLAN Tunnel Calico Direct Routing(no tunnel)

Observation for TCP performance over CNIs

• The performance gap between CNIs are not so explicit when overlay tunnel is used;

• Calico and Flannel show a little bit better performance than Cilium for most MTUs here

• With IPIP/VXLAN overlay tunnel enabled, the larger MTU size, the throughput(BW) performance is better.

• When use direct routing(here by Calico, Cilium also support this mode), the throughput performance is not significantly affected by MTU size.

• The performance of direct routing here by Calico, Cilium also support this mode) is better than IPIP enabled.

• The IPIP tunnel is a little better than VXLAN tunnel

• In general, the node to pod TCP performance is better than that of pod 2 pod which flows one more step ( of veth connection to the Linux kernel) .

Finally, compared with different scenarios, it proves that IPIP/VXLAN overlay tunnel which are now implemented in the Linux kernel is the key factor which affects the performance of CNIs on arm

0

2

4

6

8

10

12

1500 2000 3000 4000 5000 6000 7000 8000 9000

BW(Gbps)

MTU (Byte)

Pod to Pod Performance for IPIP(Calico), IPIP(Flannel), VXLAN(Flannel), VXLAN(Cilium) and Direct Routing(no Tunnel, Calico)

Inter Hosts 10Gb/s ether connection

Calico IPIP Tunnel Flannel IPIP Tunnel Flannel VXLAN Tunnel Cilium VXLAN Tunnel Calico Native Routing

Question:

Why the node to pod performance is no better than that of pod to pod case for Cilium?

Page 14: Performance Benchmarking and Tuning for Container ...

14 © 2020 Arm Limited (or its affiliates)

9.09

100.82

369.53

510.09

767.05 775.54 760.33

0

100

200

300

400

500

600

700

800

900

1000

600B 10KB 100KB 1MB 10MB 100MB 500MB

BW(MB/s)

File size to be accessed by Wrk

Pod2Pod HTTP Performance with Calico IPIP Overlay for Cross-Host Communication

1480 2000 3000 4000 5000 6000 7000 8000 8980MTU:

Initial observation:

• MTU has a rather bigger effect on the performance when accessing large files, but when the accessed file size is small, it has little effect

• The accessed file size is a major factor to the HTTP performance when there is only a small number of parallel threads

• When the file sizeis big enough, theperformance can’tbe improved mucheven with biggerMTUs

HTTP Performance Benchmarking for Calico CNI

Page 15: Performance Benchmarking and Tuning for Container ...

15 © 2020 Arm Limited (or its affiliates)

9.78

114.96

596.93

1000

1120 1120 1120

0

200

400

600

800

1000

1200

600B 10KB 100KB 1MB 10MB 100MB 500MB

BW(MB/s)

File size to be accessed by Wrk

Pod2Pod HTTP Performance with Calico non-IPIP Overlay for Cross-Host Communication

1500 2000 3000 4000 5000 6000 7000 8000 9000MTU:

Initial observation:

• Almost the same as that of IPIP

• The file size has much more significant performance impact than the MTU

• For file size > =10MB, the MTU has little effect to the final performance

• The performance is much higher than those of IPIP when file size >= 100KB(See next page)

Wrk: thread 5, connections: 10

HTTP Performance Benchmarking for Calico CNI

Question:

Why for small file size, the performance of smaller MTU is even better than those of large MTUs?

Page 16: Performance Benchmarking and Tuning for Container ...

16 © 2020 Arm Limited (or its affiliates)

10.28

107.6

580.31

1020

1130 1130 1130

0

200

400

600

800

1000

1200

600B 10KB 100KB 1MB 10MB 100MB 500MB

BW(MB/s)

File size to be accessed by Wrk

Pod2Pod HTTP Performance with Calico IPIP vs non-IPIP for Cross-Host Communication

IPIP-MTU-1480 non-IPIP-MTU-1500 IPIP-MTU-5000

non-IPIP-MTU-5000 IPIP-MTU-8980 non-IPIP-MTU-9000MTU:

Initial observation:

• For file size > =10MB, the MTU has little effect to the final performance

• The performance is much higher than those of IPIP when file size >= 100KB

• When MTU is small, the performance gap between IPIP and non-IPIP is higher

Wrk: thread 5, connections: 10

HTTP Performance Benchmarking for Calico CNI

Page 17: Performance Benchmarking and Tuning for Container ...

17 © 2020 Arm Limited (or its affiliates)

9.12

102.9

559

1010

1090 1090 1090

0

200

400

600

800

1000

1200

600B 10KB 100KB 1MB 10MB 100MB 500MB

BW(MB/s)

File size to be accessed by Wrk

Host2Pod vs Host2Service HTTP Performance with Calico IPIP and non-IPIP for Cross-Host Communication

IPIP-MTU1480-Host2Svc non-IPIP-MTU1500-Host2Svc IPIP-MTU1480-Host2Pod

non-IPIP-MTU1500-Host2Pod IPIP-MTU3000-Host2Svc non-IPIP-MTU3000-Host2Svc

IPIP-MTU3000-Host2Pod non-IPIP-MTU3000-Host2Pod

Observation:

• The performance gap is minor when accessing small files

• For small file size, the host2pod and host2service performance is almost the same, which means the service access(by iptables configured by kube-proxy) is not the bottleneck for HTTP service

• The performance of non-IPIP is much higher than those of IPIP when file size >= 100KB

• For large MTU and large file size, the host2pod performance is better than host2svc.

• For non-IPIP, the performance gap between different MTU is not so explicit, so it’s believed the IPIP is actually thebottleneck, which is the same as previous

Wrk: thread 5, connections: 10

HTTP Performance Benchmarking for Calico CNI

Page 18: Performance Benchmarking and Tuning for Container ...

18 © 2020 Arm Limited (or its affiliates)

8.63

76.34 99.01 95.26 94.03 95.28 93.1

0

200

400

600

800

1000

1200

600B 10KB 100KB 1MB 10MB 100MB 500MB

BW(MB/s)

File size to be accessed by Wrk

Pod2Pod HTTP Performance of CNIs for inter-hosts communication

Calico IPIP-MTU-1480 Cilium VXLAN MTU 1500 Flannel VXLAN MTU 1450 Flannel IPIP MTU 1480

Calico non-IPIP-MTU-1500 Calico IPIP-MTU-5000 Cilium VXLAN MTU 5000 Flannel VXLAN MTU 4950

Flannel IPIP MTU 4980 Calico non-IPIP-MTU-5000 Calico IPIP-MTU-8980 Cilium VXLAN MTU 9000

Flannel VXLAN MTU 8950 Flannel IPIP MTU 8980 Calico non-IPIP-MTU-9000

Initial observation:

• For file size > =10MB, the MTU has little effect to the final performance for different CNIs

• When the file size is small, different CNIs has little performance gap

• When the file size islarge (>=100KB), it shows Calico and Cilium performance much better than Flannel, especially for large MTUs.

• The performance is much higher than those of IPIP when file size >= 100KB

• When MTU is small, the performance gap between overlay and non-overlay is higher

HTTP Performance Benchmarking for CNIs with various backends

Page 19: Performance Benchmarking and Tuning for Container ...

19 © 2020 Arm Limited (or its affiliates)

0

200

400

600

800

1000

1200

600B 10KB 100KB 1MB 10MB 100MB 500MB

Host2Service HTTP Performance for CNIs for Cross-Host Communication

Calico IPIP-MTU-1480 Cilium VXLAN MTU 1500 Flannel VXLAN MTU 1450 Flannel IPIP MTU 1480

Calico non-IPIP-MTU-1500 Calico IPIP-MTU-5000 Cilium VXLAN MTU 5000 Flannel VXLAN MTU 4950

Flannel IPIP MTU 4980 Calico non-IPIP-MTU-5000 Calico IPIP-MTU-8980 Cilium VXLAN MTU 9000

Flannel VXLAN MTU 8950 Flannel IPIP MTU 8980 Calico non-IPIP-MTU-9000

HTTP Performance Benchmarking for CNIs with various backendsObservation:

• For the 3 CNIs, the performance gap is minor when accessing small files

• As previous, the direct routing (no tunnel)mode shows the best performance compared with any other overlay basedapproaches;

• For file size >= 100KB, the Calico shows explicitly the best performance over other 2 CNIs

• Flannel shows the worst host2service performance over other 2 CNIs,even with larget MTUs, for either IPIP tunnel or VXLAN tunnel

• For large MTU and large file size, Cilium shows similar performance with the Calico CNI

• For non-IPIP, the performance gap between different MTU is not so explicit, so it’s believed that the tunnelcommunication is actually thebottleneck, which is the same as previous

Page 20: Performance Benchmarking and Tuning for Container ...

© 2020 Limited

Initial Performance Analysis with perf tools

Page 21: Performance Benchmarking and Tuning for Container ...

21 © 2020 Arm Limited (or its affiliates)

Initial Performance Analysis with perf tools

Possible performance analysis tools:

• Ftrace

• Perf

• DTrace

The Flamegraphs are got by the following commands:• #perf record -e cpu-clock -F 1000 -a -g -C 2 -- sleep 20• #perf script | FlameGraph/stackcollapse-perf.pl > out.perf-folded• #cat out.perf-folded | FlameGraph/flamegraph.pl > perf-kernel.svg

The Flamegraph script package is got by:• git clone https://github.com/brendangregg/FlameGraph.git

Page 22: Performance Benchmarking and Tuning for Container ...

22 © 2020 Arm Limited (or its affiliates)

Issues: Performance Analysis for IPerf with Flame Graph

22

IPIP Tunnel No tunnel

2 flame graphs for w/wo IPIP tunnel of performance test

Page 23: Performance Benchmarking and Tuning for Container ...

© 2020 Limited

Summary and Future Work

Page 24: Performance Benchmarking and Tuning for Container ...

24 © 2020 Arm Limited (or its affiliates)

Brief Summary

With the performance tests for CNIs over arm64 platform, initially we got:

• All 3 CNIs (Calico, Cilium, Flannel) utilize the Linux kernel overlay tunnel implementation to enable its cross-host pod and service communication

• The TCP throughput performance gap between CNIs are not so explicit when overlay tunnel is used;

• For TCP throughput, Calico and Flannel show a little bit better performance than Cilium for most MTUs here

• With IPIP/VXLAN overlay tunnel enabled, the larger MTU size, the throughput(BW) performance is better.

• The overlay tunnel approaches (IPIP, VXLAN) actually affects the performance either TCP or HTTP performance much compared with direct routing;

• For HTTP performance, the Calico and Cilium shows much better performance over Flannel CNI

Page 25: Performance Benchmarking and Tuning for Container ...

25 © 2020 Arm Limited (or its affiliates)

Future Work(Provisional)

• Performance testing for supported senior features of CNIs• Kube-proxy replacement with eBPF for Cilium CNI• Encryption added for pod2pod communication of Cilium CNI• eBPF introduced for Calico CNI

• HTTP performance testing with network policy configured (Cilium, Calico)

• Further performance trace, analysis and optimization for known performance issues

• Performance testing for other CNIs on arm: Ovn-Kubernetes, Contiv/VPP

• More backend types testing for Cilium, Calico or other CNIs

• Compare with other platform (x86_64, …)

• Investigation on the performance differences between CNIs

• …

Page 26: Performance Benchmarking and Tuning for Container ...

© 2020 Arm Limited (or its affiliates)

Thank YouDankeMerci谢谢

ありがとうGracias

Kiitos감사합니다

धन्यवाद

شكرًاধন্যবাদתודה