Build Arm Docker images five times faster on native hardware
Tags: arm, docker, cloud, devops
Published: 2023-10-31 19:24:44

The ARMv8 (a.k.a. ARM64) CPU architecture, [announced](https://web.archive.org/web/20190101024118/https://www.arm.com/about/newsroom/arm-discloses-technical-details-of-the-next-version-of-the-arm-architecture.php) 12 years ago, was the first [Arm](https://www.arm.com/) architecture to support a 64-bit instruction set. Apple famously introduced its ARM64-based M1 chip in November of 2020. In June of this year, Apple completed its transition away from Intel-based CPUs by [launching](https://finance.yahoo.com/news/apple-refreshes-the-mac-pro-with-its-new-m2-ultra-chip-173145016.html) a new Mac Pro model powered by the M2 revision of the chip. In the PC market, Arm notebooks are expected to increase to [27% market share by 2027](https://www.counterpointresearch.com/insights/arm-based-pcs-to-nearly-double-market-share-by-2027/). In the cloud computing space, all major service providers [offer Arm solutions](https://www.arm.com/campaigns/cloud-computing).

We have entered a world where Arm can’t be ignored. If your company isn’t adapting your applications and running infrastructure on Arm, chances are your competition is.

## Cost and Energy Savings with Arm

The Arm architecture offers significant potential cost and energy savings. A recent study showed that moving to Arm-based cloud infrastructure can achieve up to [40% better performance per dollar](https://www.anandtech.com/show/15578/cloud-clash-amazon-graviton2-arm-against-intel-and-amd/9) over comparable Intel-based infrastructure.

Companies like Squeaky [reduced their cloud spending by 35%](https://squeaky.ai/blog/development/how-switching-to-aws-graviton-slashed-our-infrastructure-bill-by-35-percent) by switching to Arm. When analyzing CPU, memory, and latency metrics after the migration, Squeaky reports "no performance degradation" on the new hardware.

Database company Aerospike saw [annual costs decrease by an estimated 27%](https://pages.aerospike.com/rs/229-XUE-318/images/Aerospike-White-Paper-AWS-Graviton-Benchmark.pdf) after switching to Graviton2 processors on AWS EC2. They also cut carbon emissions by an estimated 49% while achieving aggressive targets for transaction throughput and data access latency.

## Docker and Arm

The [2022 StackOverflow Developer Survey](https://survey.stackoverflow.co/2022/#most-popular-technologies-tools-tech-prof) found that [Docker](https://www.docker.com/) is becoming a "fundamental tool for Professional Developers, increasing from 55% to 69%." According to the [CNCF 2022 annual survey](https://www.cncf.io/reports/cncf-annual-survey-2022/), 44% of respondents use containers for nearly all applications and business segments, and another 35% say they use containers for at least a few production applications.

This means that **the first challenge many companies face when adopting Arm is how to build their application containers for this different architecture**. While Docker supports building images for other CPU architectures under emulation, this can significantly impact performance.

## Native Builds vs. Emulation

To visualize the difference in performance, we built base Docker images for [Python](https://github.com/docker-library/python/tree/master/3.8/alpine3.18), [Ruby](https://github.com/docker-library/ruby/tree/master/3.2/alpine3.18), [HAProxy](https://github.com/docker-library/haproxy/tree/master/2.9/alpine) and [Redis](https://github.com/docker-library/redis/tree/master/7.2/alpine3.18) using both emulation and native ARM64 hardware.

This graph shows build time in minutes for native Arm hardware compared to emulation [^1].

![Docker image build times](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q1suxxg3hwbb5uo6okws.png)

These results show **builds completed five times faster on average with native Arm hardware**. This is valuable time your developers could be using for _development_, rather than waiting for pipelines.

While Arm clearly has incredible momentum, some companies in the continuous integration space have been [slow to provide hosted resources](https://github.com/actions/runner-images/issues/5631). 

{% embed https://github.com/actions/runner-images/issues/5631#issuecomment-1517045800 %}

Here at [Harness](https://www.harness.io/), Arm infrastructure has been available in [Harness CI Cloud](https://www.harness.io/products/continuous-integration) since the beginning.

To sign up for Harness Cloud and get 2,000 free monthly build credits for your pipelines, see the [original blog post for this article](https://www.harness.io/blog/arm-harness-ci-cloud).

[^1]: Tested with minimum 4 vCPUs and 16GB memory