Kubernetes version 1.13.2
I have talked about setting up pod network in Kubernetes cluster using Calico
network add-on in this post <<Set Up K8s Cluster by Kubeadm>>
. Recently I was involved in one issue from performance team, they complained that the network has bottleneck in calico, let’s see what happened and learn new things!
Description
The performance team set up a 6 nodes cluster with 1 master and 5 workers. Each machine has 48 cpu cores, 128GB memory, 2T+ disk and 10000Mb/s network speed.
These are the test cases:
1 | 10 jobs for each user(8 small jobs, 1 middle job and 1 large job) |
They ran concurrent users with N compute pods and found that the bottleneck is in calico network:
BTY, there are still enough resources(CPU, Memory and Disk I/O) to support DataStage scale up for DS concurrent users to run jobs on nodes and pods. But the network bandwidth between pods is not enough to support it.
iperf3 Command
They use iperf3
, a TCP, UDP, and SCTP network throughput measurement tool, measure memory-to-memory performance access a network, server-client mode.
To install, for example in Centos:
1 | sudo yum install iperf3 -y |
The Usage is simple. More simple demos
Node to Node
For command options and flags see user guide.
This will transfer /large_file in client to /large_file in server, time interval is 40 seconds.
1 | ## server |
UDP traffic benchmark:
1 | ## server |
Pod to Pod
The same as Node to Node
, but wget and build iperf3
inside pod container and use the container’s IP (in container run hostname -I
), for example, I flood data from is-en-conductor-0
pod to is-engine-compute-12
pod, they reside in different host machine.
Thinking
After I reproducing the tests, I was thinking Calico
is a widely used add-on that shouldn’t have such obvious bottleneck, otherwise many people will complain and improve it.
Is there any improper configuration?
-
Configuring IP-in-IP By default, the manifests enable
IP-in-IP
encapsulation across subnets (additional overhead compare to nonIP-in-IP
), if don’t need it (when? I am not very clear), disable it in calico manifest yaml file:1
2
3# Enable IPIP
- name: CALICO_IPV4POOL_IPIP
value: "off"See this
IP-in-IP
issue I am usingCalico
version 3.3, document aboutIP-in-IP
-
Which Network Interface is Used Another question I have is which network interface is used for
node-to-node
andpod-to-pod
test?There are several network interfaces in host machine, one is for public IP with
MTU 9000
and in K8s we use private IP interface withMTU 1500
. This will have impact oniperf3
testing.It shows that
pod-to-pod
test usesMTU 1500
butnode-to-node
usesMTU 9000
.Need to test after enlarging MTU size to see if that change improves network throughput, also remember to update
Calico
manifest yaml, refer this document1
2# Configure the MTU to use
veth_mtu: "9000"
ethtool Command
The ethtool
can display speed property of the network interface, for example:
1 | # ethtool eno1 |
The output depends on the what the network driver can provide, you may get nothing if the virtual machine does not have much data available (for example, in IBM softlayer cluster), refer to this question
In a virtual machine the link speed or duplex mode is usually meaningless, as the network interface is most often just a virtual link to the host system, with no actual physical Ethernet layer. The speed is as high as the CPU and memory can handle (or as low, as the connection rate limit is configured), cabling type does no exist, as there is no cable, etc. This virtual interface is bridged or routed to the actual physical network by the host system and only on the host system the physical port parameters can be obtained.
you can check if the network interface is virtual or not:
1 | ls -l /sys/class/net |
Summary
- Performance test big picture
- iperf3, node-to-node, pod-to-pod tests
- ethtool
- Calico configutation: IP-in-IP, MTU
- calicoctl, haven’t got time to learn
Other Blogs
k8s calico flannel cilium 网络性能测试 Benchmark results of Kubernetes network plugins (CNI) over 10Gbit/s network