sobota, 24 grudnia 2022

Docker's multi-platform images - some benchmarks - for M1/ARM and X86_64

Eenvironment

M1: 8 cores, 8 GB RAM, 4 cores for docker
X86_64 A: 4 cores, 8 GB RAM (AMD Ryzen 5 3600 6-Core Processor), VM with Ubuntu 22.04
X86_64 B: 16 cores, 64 GB RAM (AMD Ryzen 9 5950X 16-Core Processor), Ubuntu 22.04, bare metal
On all nodes
docker run --rm --platform linux/amd64 alpine nproc
docker run --rm --platform linux/arm64 alpine nproc

M1/X86_64 A
Resuilt: 4

X86_64 B
Resuilt: 32

Dockerfile

Base Dockerfile:
FROM ubuntu:22.04
ADD https://www.php.net/distributions/php-8.2.0.tar.gz /src/
WORKDIR src
RUN tar xzf php-8.2.0.tar.gz && rm php-8.2.0.tar.gz
ARG DEBIAN_FRONTEND noninteractive
ARG DEBCONF_NONINTERACTIVE_SEEN true
RUN apt-get update -qq && \
  apt-get dist-upgrade -qq && \
  apt-get install -qq \
  	build-essential \
  	libxml2-dev \
    pkg-config \
    libsqlite3-dev \
    libssl-dev \
    zlib1g-dev \
    libonig-dev \
    libsodium-dev \
    libzip-dev && \
  apt-get clean all && \
  find /var/lib/apt/lists/ -type f -delete
WORKDIR /src/php-8.2.0
RUN ./configure \
	--enable-mbstring \
    --with-openssl \
    --with-zlib \
    --enable-bcmath \
    --enable-intl \
    --with-sodium  \
    --with-zip

Prepare linux/arm64 environment on X86_64:
docker run --privileged --rm tonistiigi/binfmt --install arm64
docker run --rm --platform linux/arm64 alpine uname -a
Prepare images (on both nodes):

linux/amd64
export DOCKER_BUILDKIT=1
docker builder prune -a -f
docker build --platform linux/amd64 -t wyga/docker-benchmark-multi-arch:amd64 -f Dockerfile .

Results:
M1: 326 s
X86_64 A: 60 s


linux/arm64
export DOCKER_BUILDKIT=1
docker builder prune -a -f
docker build --platform linux/arm64 -t wyga/docker-benchmark-multi-arch:arm64 -f Dockerfile .

Results:
M1: 40 s
X86_64 A: 554 s


Images are also availlible from:
docker pull wyga/docker-benchmark-multi-arch:amd64
docker pull wyga/docker-benchmark-multi-arch:arm64

Benchmarks

export DOCKER_BUILDKIT=1

/usr/bin/time -p docker run --rm wyga/docker-benchmark-multi-arch:amd64 make

/usr/bin/time -p docker run --rm wyga/docker-benchmark-multi-arch:amd64 make -j4

/usr/bin/time -p docker run --rm wyga/docker-benchmark-multi-arch:arm64 make

/usr/bin/time -p docker run --rm wyga/docker-benchmark-multi-arch:arm64 make -j4

X86_64 A

Results:
AMD64 make:      537 s
AMD64 make -j4:  158 s 
ARM64 make:      7519 s
ARM64 make -j4:  2231 s

X86_64 B

Results:
AMD64 make:      368 s
AMD64 make -j4:  111 s 
ARM64 make:      4861 s
ARM64 make -j4:  1580 s

M1

Results:
AMD64 make: 4424 s AMD64 make -j4 1570 s ARM64 make 471 s ARM64 make -j4: 184 s

Brak komentarzy: