DEV Community

Cover image for AWS Graviton Processors
Jason Andrews for AWS Community Builders

Posted on

AWS Graviton Processors

AWS currently offers EC2 instances powered by Graviton processors. These processors are custom built by Amazon Web Services and feature 64-bit Neoverse cores and deliver the best price performance for running workloads in AWS. Many companies are experimenting with EC2 instances powered by Graviton, getting great results, and making the switch. If you have not tried Graviton or had a chance to learn what makes it different compared to other EC2 instances, read on. I will provide some details about getting started with Graviton processors and why they are important to the future of computing.

Graviton EC2 Instance Types

There are two generations of Graviton EC2 instances. The first instance type is A1, and was announced at re:Invent 2018. A1 instances range from 1 to 16 vCPUs. The memory sizes range from 2 GB to 32 GB. A1 instances provide cost savings and are good for web servers, containerized microservices, and other tasks that fit well with the core count and memory size of A1. In addition to being a useful instance type, A1 delivered a significant contribution in terms of paving the way for the software ecosystem needed for the next generation, Graviton2.

Announced at re:Invent 2019, Graviton2 processors provide a significant performance uplift from A1. The Graviton2 instance types are M6g, C6g, and R6g. AWS advertises 40% better price performance over current generation x86 instances. Graviton2 instances range from 1 to 64 vCPUs and memory sizes from 2 GB to 512 GB.

In many ways Graviton instances are the same as any other instance types you use regularly in AWS. They have vCPUs, memory, storage, and are built on the AWS Nitro system. The key difference, which users may or may not notice, is Graviton processors use the Arm architecture, a completely different instruction set from x86.

What is the Arm Architecture?

The Arm architecture is the basis for the world’s largest compute ecosystem. Arm does not create any silicon or systems, but instead licenses the architecture and designs to partners who create all of the silicon and systems. To date, approximately 160 billion devices containing Arm-based chips have been shipped. A significant number of the Arm devices are in the mobile and embedded markets. If we greatly simplify where computing happens, we can list four general types of computing.

Computing type Description
Servers and cloud instances Computing in the cloud, EC2 instances and other cloud and on-prem servers
Laptops and desktops Computing on your desk, typically running Windows, macOS, or Linux
Mobile phones and tablets Computing in your pocket, typically running Android or iOS
All other embedded computing including IoT Everything else which performs specific functions (many invisibly) using hardware and software

The Arm ecosystem has been strong in mobile and embedded, which is why it is somewhat new to the AWS audience, but this changes with Graviton processors.

Low power was a key factor propelling Arm to success in mobile. The diversity of the silicon ecosystem paved the way to wide adoption in embedded and IoT. Today, the transition is underway to raise performance and efficiency in the datacenter and on the desktop. There is also a transition from traditional embedded to IoT which is based on containers for application deployment.

The CPU architecture defines the instruction set, register file, exception model, memory model, and other things that an operating system relies on. There are many CPU architectures which rise and fall in popularity over time, but today Arm and x86 are the two most popular. Before Graviton, x86 was the only choice in AWS.

This year Arm celebrates its 30-year anniversary. If you are interested in the history of computing and want to see the genesis of Arm, check out the movie Micro Men.

Getting back to Graviton, there are two main cases for considering Graviton versus x86 EC2 instances. The first case is instance replacement.

EC2 Instance Replacement

Many of the AWS success stories for Graviton summarize the process of taking an existing workload in EC2, moving it from x86 to Graviton, and comparing the price performance. Graviton looks and feels nearly identical to x86, which was the goal of making the transition easy. If all the needed AWS services are supported on Graviton and the needed runtime environments are available, then the process is seamless.

Compiled code needs to be recompiled for the Arm architecture. There is a helpful Getting started with AWS Graviton repository with additional details.

The underlying processor architecture is irrelevant for many users and price performance is the key metric. The 40% better price performance is made possible by the work AWS has done to create a custom chip based on the Arm architecture and making the software transition as easy as possible.

Where things really get interesting is when the processor architecture starts to provide benefits to software developers because Arm is the common architecture across computing.

In addition to Graviton, there is momentum for the Arm architecture in laptops and desktops. Windows 10 on Arm laptops and other upcoming silicon changes in the market mean that the future could be different than it is today.

Arm Everywhere

For the last 25 years software engineers targeting embedded and mobile have been using x86 laptops, desktops, and servers to develop software that eventually lands on Arm. Graviton is exciting for all of those software developers who want to move to developing software in the cloud using the same architecture as the embedded product it lands on. As containers continue to gain popularity, efficiencies will be gained by seamlessly creating and deploying containers across all types of computing. As edge computing starts to grow and interact with the cloud, a common architecture can be used. Graviton is likely to have a bigger impact on software developers all across computing than many realize.

As a fun exercise, let’s use the build once, deploy anywhere concept on Arm.

Getting Started

A hands-on example is always helpful to learn new things. I have created some examples using different programming languages which can be run on all kinds of Arm hardware, including EC2 instances with Graviton processors. The examples build and run containers which print the underlying platform information provided by the uname command.

It would be fun if we can gather up the output from anybody who runs these images to see the diversity of the Arm ecosystem. Many distributions of Linux are supported on AWS Graviton EC2 instances, and there are many other Arm-based systems running Linux, including the Raspberry Pi.

Visit GitHub to get started:
$ git clone https://github.com/jasonrandrews/hello-arm.git

Pick a language to run, each example has a README to follow, but all are very simple with just a build and run script.

There is also a useful setup script to setup docker on an AWS Graviton EC2 instance.

Use an account on Docker Hub to save the images and run on another Arm computer to demonstrate the build once, run anywhere benefit. AWS users can use Amazon Elastic Container Registry.

The Dockerfiles for each image are very simplistic on purpose to show they are the exact same as x86 images. The examples also show that Arm computing can be used for everything from cloud to laptop to IoT.

To get things started here is my output from c-hello-world on an M6g, on my Pinebook Pro laptop, and on my Samsung Galaxy Book S running WSL 2 with Windows on Arm. If you are curious, I wrote an article about what’s on my desk.

AWS m6g.medium running SUSE Linux Enterprise Server

Hello, architecture from uname is Linux buildkitsandbox 5.3.18-22-default #1 SMP Wed Jun 3 12:16:43 UTC 2020 (720aeba) aarch64 Linux
64-bit userspace
Enter fullscreen mode Exit fullscreen mode

Galaxy Book S running Ubuntu in WSL 2

Hello, architecture from uname is Linux buildkitsandbox 4.19.104-microsoft-standard #1 SMP Wed Feb 19 06:45:06 UTC 2020 aarch64 Linux
64-bit userspace
Enter fullscreen mode Exit fullscreen mode

Pinebook Pro running Manjaro Linux

Hello, architecture from uname is Linux buildkitsandbox 5.7.0-3-MANJARO-ARM #1 SMP Sun Jul 5 18:30:55 UTC 2020 aarch64 Linux
64-bit userspace
Enter fullscreen mode Exit fullscreen mode

Feel free to send a GitHub pull request if you want to add additional languages to further demonstrate the strength of the Arm software ecosystem.

Visit Arm Developer for more information about software development for the Arm architecture.

Try the examples on Graviton processors or any other Arm system and share your output below.

Top comments (0)