Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Comparing the time it takes to launch containers concurrently for docker and podman runtimes
set -e
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
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