Multi-Arch Images
Public cloud providers actively promote migrating to ARM instances, offering potential cost savings of up to ~20%. For instance, AWS suggests their m7g ARM instances priced at $8.617 per hour, compared to $10.644 per hour for equivalent AMD instances. While the performance of ARM instances may vary depending on the application's loading profile, many benchmarks indicate quite positive outcomes:
- ARM vs Intel on Amazon’s cloud
- Faster and Cheaper: ARM Graviton vs Intel and AMD x86 AWS EC2
- Performance Analysis for Arm vs x86 CPUs
As pragmatic engineers who love cost-effective solutions, we see the value in exploring instances with different architectures to optimize both cost and performance.
The concept sounds promising, but what technical preparations are needed for that?
Let's delve into some theory.
By default, when building containers, they are targeted for the same architecture as the local CPU. As a result, running AMD-built containers on ARM nodes, and vice versa, causes errors. This is where multi-arch images come into play.
A multi-arch image looks like a single image with a single tag, but it has a collection of images designed for multiple architectures. How does this function? Each Docker image is defined by a manifest—a JSON file containing all the information about the image. It includes references to each of its layers, their corresponding sizes, the hash of the image, its size and also the platform it's intended for.
For multi-arch images the manifest contains a list of manifest, enforcing the container runtime to select the appropriate image based on the underlying platform architecture.
Presently, two primary manifest standards exist: the Docker manifest version 2 and the OCI Image Index Specification.
Personally, I prefer the OCI standard as it presents a more generic approach to work with multi-arch images.
Many articles explain how to create these images, so I won't cover that here. Just remember, making multi-arch images requires adoption from the build process and a bit more storage in the registry.
In conclusion, using multi-arch images can lower operational costs in public clouds, but it requires making extra changes to integrate them into CI/CD processes. Do you need that in your project? It depends 😉
#engineering
Post #15
203