Overview
This article discusses Uber's journey in adopting arm64 architecture using the Zig programming language for their infrastructure. It details the challenges faced, the solutions implemented, and the future plans for expanding arm64 support within Uber's services.
What You'll Learn
1
How to compile arm64 binaries using Zig
2
Why adopting arm64 architecture can reduce compute costs
3
When to use cross-compilation versus native compilation
Prerequisites & Requirements
- Understanding of C/C++ compilation processes
- Familiarity with Zig and Bazel(optional)
Key Questions Answered
How did Uber transition to using arm64 architecture?
Uber began evaluating arm64 in November 2021, transitioning from an exclusively Linux/x86_64 infrastructure to a dual architecture system by January 2023. They developed a C++ toolchain using Zig, enabling the compilation of binaries for both x86_64 and arm64, and began running core infrastructure services on arm64 hardware.
What are the benefits of using Zig for cross-compilation?
Zig provides a unified toolchain that supports all target architectures, allowing Uber to compile binaries without needing multiple toolchains for different platforms. This reduces complexity and storage requirements, as only one toolchain is needed per host platform, unlike other compilers that require separate toolchains for each target.
What challenges did Uber face while implementing arm64 support?
Uber faced challenges related to their existing build systems, which were primarily designed for x86_64. They needed to ensure that all core infrastructure understood multiple architectures and that their build tools could compile for arm64 without disrupting existing workflows.
Key Statistics & Figures
Timeframe for transition to arm64
From November 2021 to January 2023
This period marks Uber's evaluation and implementation of arm64 support.
Number of architectures supported
Two
x86_64 and arm64
Technologies & Tools
Some links below are affiliate links. We may earn a commission if you make a purchase.
Programming Language
Zig
Used for building a unified toolchain for compiling C/C++ code across multiple architectures.
Build System
Bazel
Used in conjunction with Zig to manage builds for Uber's Go Monorepo.
Key Actionable Insights
1To effectively transition to arm64 architecture, consider developing a unified toolchain that can handle multiple target architectures.This approach minimizes the overhead of maintaining separate toolchains and simplifies the build process, as demonstrated by Uber's use of Zig.
2Evaluate the potential cost savings of running workloads on arm64 compared to x86_64.Uber's exploration of arm64 was driven by the need for cost efficiency and performance improvements, which can be crucial for scaling infrastructure.
3Ensure that your CI/CD pipelines are capable of compiling for both architectures to maintain compatibility.Uber implemented CI checks that require successful compilation for both x86_64 and arm64, ensuring that new code does not break compatibility.
Common Pitfalls
1
Underestimating the complexity of transitioning to a new architecture can lead to significant delays.
Uber initially faced challenges with their existing build systems, which were not designed for arm64, highlighting the importance of thorough planning and testing.
Related Concepts
Cross-compilation Techniques
Zig Programming Language Features
Bazel Build System Integration