-
-
Save 4383/99d1f0cc2162dcc1f4d16d73c933f7b5 to your computer and use it in GitHub Desktop.
Comparing the time it takes to launch containers concurrently for docker and podman runtimes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
containers_total=${1:-100} | |
containers_concur=${2:-10} | |
container_image=${3:-docker.io/library/busybox} | |
podman pull $container_image | |
docker pull $container_image | |
rm -f bench-jobs.txt | |
podman rm -f $(sudo podman ps -qa --filter name=cbench)||: | |
docker rm -f $(sudo docker ps -qa --filter name=cbench)||: | |
for i in $(seq 1 $containers_total); do | |
cmd="run -d --name cbench$i -v /sys/fs/cgroup:/sys/fs/cgroup -m 100M --cpus=1 --cpu-shares=100 $container_image sleep $(( containers_concur * 2 ))" | |
echo "$cmd" >> bench-jobs.txt | |
done | |
set -x | |
exec 3>&1 | |
{ time cat bench-jobs.txt | xargs -r -n1 -P $containers_concur -I{} bash -c "echo docker {}; { time docker {} 1>&3; } 2>&1" 1>&3; } 2>&1 | |
{ time cat bench-jobs.txt | xargs -r -n1 -P $containers_concur -I{} bash -c "echo podman {}; { time podman {} 1>&3; } 2>&1" 1>&3; } 2>&1 | |
exec 3>&- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment