When multiple containers are launched simultaneously, the startup time for containers increases with the number of containers being launched. For example, if I try to launch 70 containers, it takes ~20 seconds for all containers to be running. After some performance debugging using pprof and perf, it was observed that docker spends majority its time connecting each container to the network (possibly spinning on iptable lock). If I disable the network (–network=none), the startup time for 70 containers is ~8 seconds.
Is this an expected behavior? Does docker not scale well due to network bottleneck? Is there a workaround?
OS Version: Ubuntu 16.04.1 LTS
Docker version: Docker version 17.07.0-dev, build
Steps to reproduce:
- Save the current time
- Start 70 containers simultaneously (container need not do any operation)
- Measure the startup time for each container using the docker inspect command and the saved time
- Repeat the steps by setting the network to “none” (–network=none)