weaveworks / ignite

Ignite a Firecracker microVM
https://ignite.readthedocs.org
Apache License 2.0
3.49k stars 228 forks source link

CNI adds significant startup time #436

Open stealthybox opened 5 years ago

stealthybox commented 5 years ago

In v0.6.0, containerd+cni measures faster than docker+cni. However, using both with cni is notably slower than docker+docker-bridge. (0.5s - 0.85s)

There appears to be no notable perf regression between v0.5.2 and v0.6.0 for docker+docker-bridge.

# 1.605s  0.6.0  docker + docker-bridge
time sudo ignite-0.6.0 vm run weaveworks/ignite-ubuntu \
  --runtime docker --network-plugin docker-bridge
INFO[0000] Created VM with ID "254905928beda06d" and name "morning-field" 
INFO[0001] Networking is handled by "docker-bridge"     
INFO[0001] Started Firecracker VM "254905928beda06d" in a container with ID "5dfb55347a77e43600ac4482df8193a3295cab698fcfac0d6d8b1e9d65f48b22" 
sudo ignite-0.6.0 vm run weaveworks/ignite-ubuntu --runtime docker    0.14s user 0.11s system 15% cpu 1.605 total

# 2.484s  0.6.0  docker + cni
time sudo ignite-0.6.0 vm run weaveworks/ignite-ubuntu \
  --runtime docker --network-plugin cni
INFO[0000] Created VM with ID "c13bc4ad744741c5" and name "winter-haze" 
INFO[0001] Networking is handled by "cni"               
INFO[0001] Started Firecracker VM "c13bc4ad744741c5" in a container with ID "0792a8d068b8246c6c032696ad1311e05503d9bd5658382ad81c629bd67c9ec0" 
sudo ignite-0.6.0 vm run weaveworks/ignite-ubuntu --runtime docker  cni  0.19s user 0.16s system 13% cpu 2.484 total

# 2.103s  0.6.0  containerd + cni
time sudo ignite-0.6.0 vm run weaveworks/ignite-ubuntu \
  --runtime containerd --network-plugin cni
INFO[0000] Created VM with ID "59aa6ab66ec19993" and name "rough-firefly" 
INFO[0001] Networking is handled by "cni"               
INFO[0001] Started Firecracker VM "59aa6ab66ec19993" in a container with ID "ignite-59aa6ab66ec19993" 
sudo ignite-0.6.0 vm run weaveworks/ignite-ubuntu --runtime containerd  cni  0.16s user 0.15s system 14% cpu 2.103 total
# 1.625s  0.5.2  docker + docker-bridge
time sudo ignite-0.5.2 vm run weaveworks/ignite-ubuntu
INFO[0000] Created VM with ID "1a7cec5bff2a59d9" and name "ancient-frost" 
INFO[0001] Networking is handled by "docker-bridge"     
INFO[0001] Started Firecracker VM "1a7cec5bff2a59d9" in a container with ID "068280ebd13cb7d236028dd0bb887965e4a70d7ef32a8b3ec827f3b2999da6f1" 
sudo ignite-0.5.2 vm run weaveworks/ignite-ubuntu  0.14s user 0.12s system 16% cpu 1.625 total

I suspect this is because we start the containerd task and setup CNI in a serial, blocking manner. Maybe it could be improved by making these two tasks concurrent. Ideally, we should try to be faster than the docker+docker-bridge setup.

Followup to #423

mprey commented 5 years ago

Hello, I would be interested in working on this issue. Do you have any initial pointers for profiling the time lost?