The exciting world of Rust + ARM processors
AWS has announced that they will be offering even faster and more capable Graviton 3 ARM-based instances, which means it's time for businesses to start planning their migration strategy. Running your applications on ARM systems improves efficiency by providing better performance at a lower price. We’ve taken optimizing our systems efficiency a step further by migrating our applications to Rust. Rust is a programming language that's becoming more and more popular because of its efficiency and safety. From a business perspective, this translates to lower cost of operation combined with lower cost of maintenance.
The screenshot shows the CPU usage for a Rust application migrating from X86-64 to ARM64. You can see in the graph the moment the containers started reporting CPU usage on the new ARM processors. This is a notable change. The workload is a high-concurrency Rust API Web Application that services millions of users.
What is an ARM processor?
Typically we think of processors such as AMD or Intel. An ARM processor is general purpose CPU that's used in many different devices, such as smartphones, tablets, Raspberry Pi, microcontrollers, development boards, and even some laptops. ARM processors are known for their energy efficiency and low power usage, which makes them an attractive option for businesses building embedded systems that want to save on their energy costs. AWS offers a lower hourly rate as a cost-following offer to incentivize you to use these new efficient processors.
Comparing the efficiency of ARM64 with X86-64 you can see a noticeable difference. If this isn’t enough, we can take it even further. By adding target CPU optimizers, we can build additional instructions into the binary that takes advantage of newer ARM architecture CPU instructions. We’ll save that for a later post. Meanwhile the results we are showing here are representative of general ARM64 targets.
Now, let's talk about Rust.
Rust is an open source programming language has a lively and engaged GitHub community committed to keeping Rust efficient and safe. This means that Rust code runs quickly and doesn't have as many bugs or security vulnerabilities as other languages. Programmers particularly like Rust as it’s well-suited for systems programming, which means it's great for building things like operating systems, device drivers, and other low-level software. Because of its strict stability memory safety checker, Rust is attractive for high scale application development as well. Lowering the cost of ownership with reduced bugs, although it can be said Rust is fairly difficult to debug. Microsoft analyzed the most common type of bugs. They say over 70% of bugs were directly related to memory management failures. Rust offers memory safety mechanics that catch these bugs at compile time.
So, why is Rust a good choice for migrating to ARM processors? Rust can be compiled to run on nearly any target platform, including ARM. ARM-based systems are different from traditional x86-based systems, which means that software that runs well on an x86 system might not run as well on an ARM system. Rust's efficiency and ability to run well on ARM processors make it a great choice for businesses that are looking to migrate their workloads to ARM-based systems. We’ve seen multiple successful migrations to Rust. By running the Rust application on ARM, we see 40% improvement in CPU performance.
CI/CD and Dual Architecture
To ensure a smooth migration process, it's important to follow best practices for deployment. We’ve decided to include a dual architecture pipeline in our CI/CD system. This allows us to specify both Linux AMD64 and Linux ARM64 in the Docker platforms. This is great since our orchestration layer is Kubernetes.
We use YAML configuration for node selectors to specify ARM nodes for deployment, and to include YAML tolerations in the deployment manifest. This isn’t automatic. Our SRE team successfully developed a dual architecture CI/CD pipeline that provides X86-64 and ARM64 images in tandem. Additionally we can target node groups when deploying our applications using an YAML annotation that the team implemented. The SRE team made deploying to ARM node groups seamless for our product development teams. This will allow us to migrate our workloads to ARM node groups through simple configurations. We are excited to take advantage of this.
Rust + ARM is the Industry Leading Technology Pair
Rust was originally developed by Mozilla for improving web browsing. ARM processors are more commonly known to be used in consumer device’s ecosystems, including smartwatches and even some cars, making them popular with teams doing embedded development. We can combine and leverage multiple technologies to gain noteworthy advantages. It's amazing how technology is advancing and changing the world around us.
Today, for the maximum efficiency and reliability when deploying high-scale applications, the combination of Rust + ARM is unbeatable in many real-time use cases. Migrating to ARM processors can provide significant cost savings and improved performance. By leveraging Rust and following best practices for deployment, businesses can ensure a smooth transition to this new technology. So, are you ready to take the leap and start exploring the exciting world of Rust and ARM processors?