DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

Cover image for Get Started with Amazon RDS on Graviton2 for better price performance

Get Started with Amazon RDS on Graviton2 for better price performance

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

  1. What's Amazon RDS
  2. What's Amazon Graviton2
  3. Amazon RDS type and version that Support Graviton2
  4. How to change Instance type to Graviton2 based
  5. Performance testing
  6. CloudFormation for testing
  7. Conclusion
  8. 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
Amazon RDS Graviton2 instance Type 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
    1. Open RDS service console https://console.aws.amazon.com/rds RDS Console
    2. Choose​ RDS database that you would like to change instance type and click Modify Modify RDS database
    3. Choose DB instance Class, For this example is db.m6g.large DB instance Class
    4. scroll down and click Continue Continue
    5. Choose Apply immediately for change RDS instance type immediately, then click Modify DB instance Apply immediate After that RDS instance will show status: Modifying Modifying it takes time around 10 minutes RDS instance will change to db.m6g.large which is Graviton2 instance type successfully Complete
  • 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.html

    After 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

  1. 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
    
  2. 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
    
  3. Check sysbench version
    sysbench --version
    
  4. Create MySQL database sbtest for testing
    mysql -u admin -pAWSpassword \
      -hrdsgraviton.c2lep43gswjd.ap-southeast-1.rds.amazonaws.com \
      -P3306 -e 'create database sbtest;'
    
  5. 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
    sysbench-db.m5.large

    This below picture is the result from command sysbench on RDS for MySQL db.m6g.large
    sysbench-db.m6g.large

    Compare the result
    Compare

    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 environment

    Changing 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%
    Compare cost

    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

Architecture diagram
Architecture diagram

Step to Deploy

  • Deploy CloudFormation by click here
  • ΰΈ„ΰΈ₯ิก Next CloudFormation
  • 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
    • CloudFormation
  • Scroll down and click Next CloudFormation
  • Review CloudFormation and click Next CloudFormation
  • After that CloudFormation will provision resources in this Architecture Diagram and after complete will show status: CREATE_COMPLETE
    CloudFormation

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.

Top comments (0)

🌚 Life is too short to browse without dark mode