Data points you need to know about ARM for your application code migration.
Tags: aws, awscloud, cloud, serverless
Published: 2022-05-03 09:26:01

**1. Introduction**
**Advanced RISC Machines or ARM** architecture has wide adoption on the compute filed since last one decade. Due to ARM’s architectural built-in capabilities, first time adoptions were more in mobile phones, tablets, setup boxes, smart TVs, electronic wearable’s and Special hardware devices such as IOT devices as their Micro Controllers or minicomputer. The low power consumption and reduced heat generation made a great fitment later in the compute field as well. 

**How are ARM different from X86_64**
The existing X86_64, widely adopted in desktops, laptops, Servers and other general-purpose compute infrastrcture are evolved from traditional Microprocessors 8085 and 8086. The basic difference between X86 (Intel) and ARM is, x86 is CISC (Complex Instruction Set Computing) and ARM is Arm is RISC (Reduced Instruction Set Computing) based.

**ARM on AWS**
AWS is one of the early adopters of ARM architecture in their compute offering stream (AWS EC2). AWS has developed own processor family Gravition, based on ARM architecture. AWS Graviton processors are designed to deliver the best price performance. AWS made further enhancement by introducing Graviton-2 with 40% performance improvement in contrast to X86 processor family. Graviton2 processors are custom built by AWS using 64-bit Arm Neoverse cores. All Graviton processors include dedicated cores & caches for each vCPU, along with additional security features courtesy of AWS Nitro System; the Graviton2 processors add support for always-on memory encryption.

**Latest ARM based technology in AWS**

Graviton-3 based instance family (g7) are in preview mode which is expected to give 25% performance improvement of their Gravition (g6) family. The performance improvement will be varied based on the workload characters, higher improvements are expected in Machine Learning (ML) and cryptographic workload due to the larger floating point. DDR5 memory in Graviton-3 will compliment the performance improvement. 
Read details on https://aws.amazon.com/blogs/aws/join-the-preview-amazon-ec2-c7g-instances-powered-by-new-aws-graviton3-processors/

**AWS services use ARM (Graviton) behind the hood**
There are plenty of AWS Managed services uses Graviton processor behind the scenes including Amazon Aurora, <u>Amazon ElastiCache, Amazon EMR, AWS Lambda, and AWS Fargate.</u>

**ARM options in AWS EC2**
AWS added Gravition processor based “g” series in their AWS EC2 family to extend the choice of instance models by Year 2019. This had given flexibility for many customers to explore the ARM capabilities and benchmark performance improvement. Graviton instances are available in most of the common set of instance families such as “tg” for burstable general purpose, “mg” for general purpose workloads, “cg” for compute-intensive workloads, “rg” for memory-intensive workloads, “ig” for storage-intensive workloads. 


**Software programs available in ARM**
There are plenty of programing language with ARM support to enhance the adoption of your application platform. The latest edition of these languages has the ARM support packages/libraries available, below list provides the supported version of some of those programing language. 
 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9e23g0ymz5mmhiejuwv7.jpg)

Reference: - https://segmentfault.com/a/1190000041272174/en

The application already complied for X86_64 may not be exactly ported to ARM, you would need to upgrade the packages for the same, ideally need to re-compile the source code either for multi-architecture or for ARM alone. If your application code is developed recently using latest version of the language, it might be already having the capabilities which can go directly to a test bed proceeded with sanity checks.

There are also third-party solutions available for recompiling jobs, 

AWS has Graviton Ready program which validates software products built by its Partners that integrate with specific services such as AWS Graviton.
Details on:- https://aws.amazon.com/blogs/apn/introducing-the-aws-graviton-ready-program-for-graviton-enabled-software-products/

**Operating System for ARM,**
To run your code, you also need the Operating System (Platform) to support the ARM. The existing X86_64-bit Operating System would not be able to run the ARM version of the code hence you need the relevant ARM version of the Operating System as well. Most of the Linux distribution have ARM support on their latest version, some of them are <u>Ubuntu 20.04, Red Hat Enterprise Linux 7.4 for ARM, Debian GNU/Linux 9 supports , Fedora, Linaro, OpenSUSE</u>

**Database Engines available in ARM**
Most of the popular open-source Database technologies like MySQL, PostGreSQL and MariaDB has the ARM version available already, ARM already proved for higher performance compared to its X86_64 architecture, Database is one of the technologies will enjoy the benefit. Performance benchmarking done with Intel and ARM for Database workload had shown significant performance advantage when high-concurrency activities. 

Database Performance benchmarking report is available in https://mysqlonarm.github.io/MySQL-on-x86-vs-ARM/

**MySQL**:- MySQL 8.0 supports ARM on Oracle Linux 8 / Red Hat Enterprise Linux 8 / CentOS 8 Operating System. MySQL 8.0 also has Docker image supported on OracleLinux in ARM Architecture. 

**PostGreSQL**:- 13, 12.3 & higher supports ARM based processor in multiple Operating System platforms. 
There are multiple PostGreSQL docker images are available in the given repo:-https://hub.docker.com/_/postgres?tab=tags

**MariaDB**: MariaDB Enterprise Server (10.2-10.6) support ARM64 .
https://mysqlonarm.github.io/

**AWS Managed Database in ARM.**
While deploying respective supported Database engines in AWS RDS, Graviton-2 based DB instances are available along with the Intel based instances.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6wdbpzuyf3a4vg0wv9tc.jpg)
 
In the above diagram, db.m5.16xlarge is the DB instance with X86 Architecture and db.m6g.large is with ARM (Graviton-2) based architecture. Although the instance selection is just a matter of choice, but there are fundamental differences between the way both Architecture works.

**Migrating X86 Architecture to Graviton-2**
Migrating the DB instances to Graviton-2 is quite simple task considering zero eco system changes needed at the application, connector side to the database layer. 
Please go through the given link for the DB migration steps.
https://aws.amazon.com/blogs/database/key-considerations-in-moving-to-graviton2-for-amazon-rds-and-amazon-aurora-databases/

**Container platform in ARM**
As most of the Linux distributions have ARM available, container platform has greater flexibility on ARM adoption. As captured above, the serverless model of AWS container services, Fargate uses ARM based EC2 instances behind the scene to spin up compute resources for your tasks. 
In both AWS Managed Container Services (ECS and EKS), you can use Graviton-2 based instances on your container cluster.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qq1j9qcxkyrscjv3slfe.jpg)
 
The above diagram is while creating ECS cluster where you can select the instance type from “g”. On the similar line, while creating NodeGroup in EKS cluster, you can select Amazon Linux 2 ARM or Bottlerocket ARM 64 for Graviton-2 based systems.
  
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ccty0usrnxjfb8osg8jh.jpg)

**Running Mix of X86 and Graviton on ECS cluster**

https://aws.amazon.com/blogs/compute/supporting-aws-graviton2-and-x86-instance-types-in-the-same-auto-scaling-group/
https://aws.amazon.com/blogs/compute/how-to-quickly-setup-an-experimental-environment-to-run-containers-on-x86-and-aws-graviton2-based-amazon-ec2-instances-effort-to-port-a-container-based-application-from-x86-to-graviton2/

**Approach to Move to ARM**

To benefit the performance improvement, most of the application codes can be re-ported/re-complied in ARM from their existing code base, there are no hard and thumb rules on migrating/porting the application code, these are totally to the customer’s priority. Some of those adoption approaches are as below

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vnih6qw7ggomzqfj2ix8.jpg)


**Conclusion**

The compute space is overwhelmed with the ARM based architecture performance benefits and cost efficiencies. The software application space is also adopting this change in large scale, it is the time for the end customer and their business applications to adopt these performant compute infrastrcture.