Get Started with Amazon RDS on Graviton2 for better price performance
Chatcharoen Chivakanit
Posted on July 6, 2022
AWS is developing new innovations to meet the needs of users at all times both in terms of efficiency, ease of use, increased features, as well as taking into account the cost optimization as well.
In this post, I will explain how to change Amazon RDS Instance type to use Amazon Graviton2 and provide CloudFormation template for create environment for testing.
Table of Contents
- What's Amazon RDS
- What's Amazon Graviton2
- Amazon RDS type and version that Support Graviton2
- How to change Instance type to Graviton2 based
- Performance testing
- CloudFormation for testing
- Conclusion
- References
What's Amazon RDS
Amazon Relational Database Service (Amazon RDS) is Relational database service which store data in Table based consists of row and column. Some tables have relationship using Primary key, Foreign Key and apply ACID for data consistency.
Amazon RDS help customers to reduce effort in database operations such as provision, backup, patch, encryption, disaster recovery and allow user to enable features easily. So, users can focus on database design, optimize to fulfill business goals.
Amazon RDS provides 6 relational database engines:
Amazon Aurora, PostgreSQL, MySQL, MariaDB, Oracle, Microsoft SQL Server
What's Amazon Graviton2
Amazon Graviton2 is Processor which AWS create by using 64-bit Arm Neoverse architecture. Amazon Graviton2 provides better performance in lower price.
There're RDS Instance type that Graviton2
- t4g : For dev/test workload
- m6g : For general purpose workload
- r6g : For memory optimized workload
In other Services such as EC2, EKS, ECS you can provision Instance type that support Graviton2.
You can see more details about supported instance here
Amazon RDS type and version that Support Graviton2
-
Amazon Aurora
- Aurora (MySQL 5.7) version 2.09.1 and higher
- Aurora PostgreSQL version 11.9 and higher
-
Amazon RDS for MySQL
- MySQL version 8.0.17 and higher
- Amazon RDS for PostgreSQL
- PostgreSQL version 12.5 and higher
-
Amazon RDS for MariaDB
- MariaDB version 10.4.13 and higher
Amazon RDS Graviton2 instance provides configurations for use as table below
you can find all RDS Instance type information here
How to change Instance type to Graviton2 based
⚠️ There's Downtime ~10-15 minutes and might higher depend on your data size.
-
Use AWS Console
- Open RDS service console https://console.aws.amazon.com/rds
- Choose RDS database that you would like to change instance type and click Modify
- Choose DB instance Class, For this example is db.m6g.large
- scroll down and click Continue
- Choose Apply immediately for change RDS instance type immediately, then click Modify DB instance After that RDS instance will show status: Modifying it takes time around 10 minutes RDS instance will change to db.m6g.large which is Graviton2 instance type successfully
-
Use AWS Command Line Interface (CLI)
Prepare Access key และ Secret key for access and grant privileges to build RDS instance https://docs.aws.amazon.com/general/latest/gr/aws-sec-cred-types.html#access-keys-and-secret-access-keys
Then, install AWS CLI version 2
https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.htmlAfter configure AWS CLI in Notebook or PC, you can change RDS instance type by using command as below. In this example I'll change RDS instance : rdsgraviton to db.m6g.large
aws rds modify-db-instance --db-instance-identifier rdsgraviton --db-instance-class db.m6g.large --apply-immediately
Performance testing
I'll use sysbench which is popular benchmark tool to test performance of RDS MySQL
In this example, I'll use Amazon Linux2 bastion host on EC2 then, install sysbench and connect to RDS
- Run this command on bastion host for prepare environment to install sysbench
sudo yum -y install git gcc make automake libtool openssl-devel ncurses-compat-libs wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm sudo rpm -ivh mysql-community-release-el7-5.noarch.rpm sudo yum -y install mysql-community-devel mysql-community-client mysql-community-common
- Clone sysbench git repository และ install
git clone https://github.com/akopytov/sysbench.git cd sysbench sudo ./autogen.sh sudo ./configure sudo make sudo make install
- Check sysbench version
sysbench --version
- Create MySQL database sbtest for testing
mysql -u admin -pAWSpassword \ -hrdsgraviton.c2lep43gswjd.ap-southeast-1.rds.amazonaws.com \ -P3306 -e 'create database sbtest;'
- Prepare and run sysbench
sysbench oltp_read_write --db-driver=mysql --mysql-user=admin --mysql-password=AWSpassword --mysql-host=rdsgraviton.c2lep43gswjd.ap-southeast-1.rds.amazonaws.com prepare sysbench oltp_read_write --db-driver=mysql --mysql-user=admin --mysql-password=AWSpassword --mysql-host=rdsgraviton.c2lep43gswjd.ap-southeast-1.rds.amazonaws.com run
This below picture is the result from command sysbench on RDS for MySQL db.m5.large
This below picture is the result from command sysbench on RDS for MySQL db.m6g.large
RDS Graviton2 can perform better performance ~10% in this testing environment
So, you can test on your RDS in environment dev/test before apply on production environmentChanging RDS instance type to Graviton2 you can gain benefit that no need to change application that using database because there's no change on database engine, version. Only infrastructure hardware that changed.
Regarding cost when compare the result. You can see Graviton2 instance type (db.m6g.large) is lower cost than Intel instance type (db.m5.large) ~10%
Example cost calculation
https://calculator.aws/#/estimate?id=ed9f868fac8a92e62642455ed394868fecab382f
CloudFormation for testing
If you would like to deploy environment for provision RDS for MySQL and change Instance Type. And using EC2 as a Bastion host.
You can deploy CloudFormation in Singapore region (ap-southeast-1)
⚠️ There're cost of Resources ~$0.27 per hour.
You can see more details about EC2 cost
- EC2 : https://aws.amazon.com/ec2/pricing
- RDS for MySQL : https://aws.amazon.com/rds/mysql/pricing
Step to Deploy
- Deploy CloudFormation by click here
- คลิก Next
- In this page you can input parameters as below
- Change Stack name in this example will use RDSGraviton2Workshop
- Change Database password in example will use AWSpassword
- Choose EC2 KeyPair for SSH into bastion host
- For Network component such as VPC, Subnet will leave Default. Then, click Next
- Scroll down and click Next
- Review CloudFormation and click Next
After that CloudFormation will provision resources in this Architecture Diagram and after complete will show status: CREATE_COMPLETE
Conclusion
You can see RDS Graviton2 instance type will help increase better performance and reduce cost without changing Application.
I recommend to test in dev/test database before apply in production environment.
References
I hope this post can be informative for you to show step-by-step to use Amazon RDS on Graviton2 instance type.
Thank you.
Posted on July 6, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
September 22, 2021