Code Monkey home page Code Monkey logo

apoorvanand / aws-graviton-getting-started Goto Github PK

View Code? Open in Web Editor NEW

This project forked from aws/aws-graviton-getting-started

0.0 0.0 0.0 1.56 MB

This document is meant to help new users start using the Arm-based AWS Graviton2 and Graviton3 processors which power the 6th and 7th generation of Amazon EC2 instances (C6g[d], M6g[d], R6g[d], T4g, X2gd, C6gn, Im4gn, Is4gen, G5g, C7g).

Home Page: https://aws.amazon.com/ec2/graviton/

License: Other

Shell 18.73% JavaScript 0.94% Python 78.46% C 1.68% Dockerfile 0.20%

aws-graviton-getting-started's Introduction

AWS Graviton Technical Guide

This repository provides technical guidance for users and developers using Amazon EC2 instances powered by AWS Graviton processors (including the latest generation Graviton3 processors). While it calls out specific features of the Graviton processors themselves, this repository is also generally useful for anyone running code on Arm-based systems.

Contents

Transitioning to Graviton

If you are new to Graviton and want to understand how to identify target workloads, how to plan a transition project, how to test your workloads on AWS Graviton and finally how deploy in production, please read the key considerations to take into account when transitioning workloads to AWS Graviton based Amazon EC2 instances.

Building for Graviton2, Graviton3 and Graviton3E

Processor Graviton2 Graviton3(E)
Instances M6g/M6gd, C6g/C6gd/C6gn, R6g/R6gd, T4g, X2gd, G5g, and Im4gn/Is4gen C7g/C7gn, M7g, R7g, and HPC7g
Core Neoverse-N1 Neoverse-V1
Frequency 2500MHz 2600MHz
Turbo supported No No
Instruction latencies Instruction Latencies Instruction Latencies
Interconnect CMN-600 CMN-700
Architecture revision ARMv8.2-a ARMv8.4-a
Additional features fp16, rcpc, dotprod, crypto sve, rng, bf16, int8, crypto
Recommended -mcpu flag neoverse-n1 neoverse-512tvb
RNG Instructions No Yes
SIMD instructions 2x Neon 128bit vectors 4x Neon 128bit vectors / 2x SVE 256bit
LSE (atomic mem operations) yes yes
Pointer Authentication no yes
Cores 64 64
L1 cache (per core) 64KB inst / 64KB data 64KB inst / 64KB data
L2 cache (per core) 1MB 1MB
LLC (shared) 32MB 32MB
DRAM 8x DDR4 8x DDR5
DDR Encryption yes yes

Optimizing for Graviton

Please refer to optimizing for general debugging and profiling information. For detailed checklists on optimizing and debugging performance on Graviton, see our performance runbook.

Different architectures and systems have differing capabilities, which means some tools you might be familiar with on one architecture don't have equivalent on AWS Graviton. Documented Monitoring Tools with some of these utilities.

Recent software updates relevant to Graviton

There is a huge amount of activity in the Arm software ecosystem and improvements are being made on a daily basis. As a general rule later versions of compilers and language runtimes should be used whenever possible. The table below includes known recent changes to popular packages that improve performance (if you know of others please let us know).

Package Version Improvements
bazel 3.4.1+ Pre-built bazel binary for Graviton/Arm64. See below for installation.
FFmpeg 5.1+ Improved performance of libswscale by 50% with better NEON vectorization which improves the performance and scalability of FFmpeg multi-thread encoders. The changes are available in FFmpeg version 4.3, with further improvements to scaling and motion estimation available in 5.1. Additional improvements to both will be available in 5.2, which has not yet been released as of November 2022. For more information about FFmpeg on Graviton, read the blog post on AWS Open Source Blog, Optimized Video Encoding with FFmpeg on AWS Graviton Processors.
HAProxy 2.4+ A serious bug was fixed. Additionally, building with CPU=armv81 improves HAProxy performance by 4x so please rebuild your code with this flag.
mongodb 4.2.15+ / 4.4.7+ / 5.0.0+ Improved performance on graviton, especially for internal JS engine. LSE support added in SERVER-56347.
MySQL 8.0.23+ Improved spinlock behavior, compiled with -moutline-atomics if compiler supports it.
.NET 5+ .NET 5 significantly improved performance for ARM64. Here's an associated AWS Blog with some performance results.
OpenH264 2.1.1+ Pre-built Cisco OpenH264 binary for Graviton/Arm64.
PCRE2 10.34+ Added NEON vectorization to PCRE's JIT to match first and pairs of characters. This may improve performance of matching by up to 8x. This fixed version of the library now is shipping with Ubuntu 20.04 and PHP 8.
PHP 7.4+ PHP 7.4 includes a number of performance improvements that increase perf by up to 30%
pip 19.3+ Enable installation of python wheel binaries on Graviton
PyTorch 2.0+ Optimize Inference latency and throughput on Graviton. AWS DLCs and python wheels are available.
ruby 3.0+ Enable arm64 optimizations that improve performance by as much as 40%. These changes have also been back-ported to the Ruby shipping with AmazonLinux2, Fedora, and Ubuntu 20.04.
zlib 1.2.8+ For the best performance on Graviton please use zlib-cloudflare.

Containers on Graviton

You can run Docker, Kubernetes, Amazon ECS, and Amazon EKS on Graviton. Amazon ECR supports multi-arch containers. Please refer to containers for information about running container-based workloads on Graviton.

AWS Lambda now allows you to configure new and existing functions to run on Arm-based AWS Graviton2 processors in addition to x86-based functions. Using this processor architecture option allows you to get up to 34% better price performance. Duration charges are 20 percent lower than the current pricing for x86 with millisecond granularity. This also applies to duration charges when using Provisioned Concurrency. Compute Savings Plans supports Lambda functions powered by Graviton2.

The Lambda page highlights some of the migration considerations and also provides some simple to deploy demos you can use to explore how to build and migrate to Lambda functions using Arm/Graviton2.

Operating Systems

Please check os.md for more information about which operating system to run on Graviton based instances.

Known issues and workarounds

Postgres

Postgres performance can be heavily impacted by not using LSE. Today, postgres binaries from distributions (e.g. Ubuntu) are not built with -moutline-atomics or -march=armv8.2-a which would enable LSE. Note: Amazon RDS for PostgreSQL isn't impacted by this.

In November 2021 PostgreSQL started to distribute Ubuntu 20.04 packages optimized with -moutline-atomics. For Ubuntu 20.04, we recommend using the PostgreSQL PPA instead of the packages distributed by Ubuntu Focal. Please follow the instructions to set up the PostgreSQL PPA.

Python installation on some Linux distros

The default installation of pip on some Linux distributions is old (<19.3) to install binary wheel packages released for Graviton. To work around this, it is recommended to upgrade your pip installation using:

sudo python3 -m pip install --upgrade pip

Bazel on Linux

The Bazel build tool now releases a pre-built binary for arm64. As of October 2020, this is not available in their custom Debian repo, and Bazel does not officially provide an RPM. Instead, we recommend using the Bazelisk installer, which will replace your bazel command and keep bazel up to date.

Below is an example using the latest Arm binary release of Bazelisk as of October 2020:

wget https://github.com/bazelbuild/bazelisk/releases/download/v1.7.1/bazelisk-linux-arm64
chmod +x bazelisk-linux-arm64
sudo mv bazelisk-linux-arm64 /usr/local/bin/bazel
bazel

Bazelisk itself should not require further updates, as its only purpose is to keep Bazel updated.

zlib on Linux

Linux distributions, in general, use the original zlib without any optimizations. zlib-cloudflare has been updated to provide better and faster compression on Arm and x86. To use zlib-cloudflare:

git clone https://github.com/cloudflare/zlib.git
cd zlib
./configure --prefix=$HOME
make
make install

Make sure to have the full path to your lib at $HOME/lib in /etc/ld.so.conf and run ldconfig.

For users of OpenJDK, which is dynamically linked to the system zlib, you can set LD_LIBRARY_PATH to point to the directory where your newly built version of zlib-cloudflare is located or load that library with LD_PRELOAD.

You can check the libz that JDK is dynamically linked against with:

$ ldd /Java/jdk-11.0.8/lib/libzip.so | grep libz
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007ffff7783000)

Currently, users of Amazon Corretto cannot link against zlib-cloudflare.

Additional resources

Feedback? [email protected]

aws-graviton-getting-started's People

Contributors

adamtylerlynch avatar agsaidi avatar arthurpetitpierre avatar awsjswinney avatar awsnb avatar csoma avatar geoffreyblake avatar janaknat avatar jeffunderhill avatar julianmarcusschroeder1 avatar lizthegrey avatar marioswa avatar massimosporchia avatar matlaver avatar mattsplats avatar nluckenbill avatar otterley avatar prekageo avatar ramamalladiaws avatar scottefein avatar scottmalkie avatar sebpop avatar sethfox avatar snadampal avatar srini-ram avatar syl-taylor-aws avatar tohwsw avatar tsahee avatar wash-amzn avatar zlim avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.