AWS Made Easy

Tip #46: AWS RDS: top five relational database cost questions

Follow these AWS RDS best practices to improve your relational database costs and performance

Amazon Relational Database Service (RDS) is a managed SQL database service provided by AWS. It supports these databases: AWS Aurora MySQL/PostgreSQL, MySQL, MariaDB, PostgreSQL, Oracle, Microsoft MS SQL Server.

In general, for new applications we recommend using only AWS Aurora because of price, performance and functionality. 

Question 1 – How do you decide on the right AWS database instance size?

AWS Database Instance costs are doubled with each one larger size, e.g. from L to XL, the price doubles.

Finding the right instance size is an iterative process:

  1. Stabilize your database architecture – the tables, indices, etc.
  2. Start with a guess of how much RAM your solution needs – approximately, the amount of storage your database needs to answer most of your queries.
  3. Run the usual workloads on the database for a few days
  4. Review the AWS RDS Performance Insights dashboard and verify whether the bars in the Database Load chart are largely below the max vCPU dashed line.
    1. If so, the AWS database is either right-sized or overprovisioned.

      If it’s overprovisioned then the max bars are below 50% of the max vCPU dashed line. In this case, you may try one instance size lower and repeat steps 3 and 4 until you find the right fit.
       
    2. If not, you need a higher sized instance until the max bars are below the max vCPU dashed line.The steady state is when neither one instance higher or lower would be optimal.

      AWS RDS Performance Insights

Question 2 – How do you decide whether you should use AWS Aurora Serverless?

A non-serverless Aurora instance is designed for consistent, 24/7, database traffic. You should cover its costs with an RDS Reserved Instance.

If your application requires consistent database traffic just for a few hours, then you should use AWS Instance Scheduler and let the Instance Scheduler stop the database instance when not used. On-Demand pricing may be in this case cheaper than any RDS Reserved Instance.

AWS Aurora Serverless V2 is ideal for unpredictable, inconsistent workloads. It is cost effective for workloads of up to several hours per day. 

Question 3 – Do you need to provision Read Replicas?

Amazon RDS Read Replicas are suitable for situations where the single database instance server is strained with read-heavy workloads and you require the database instance to scale up without increasing the database instance size. 

Introducing one or more Read Replicas into such an architecture relieves the primary database server of read-heavy traffic and thus can increase aggregate read throughput. Read Replicas can reside in other AWS regions.

Cost-wise, it’s identical if you introduce a Read Replica of the same size as the primary database instance or if you increase the instance size of the primary database instance. However, for read-heavy workloads, introducing a Read Replica is strongly preferred.

In addition, Read Replicas can replace the primary database instance in case of a failure.

Data on the main AWS database instance is replicated to Read Replicas asynchronously – i.e. with a small delay.

Note

  • Each read replica is charged at the same price as a standard database instance
  • A read replica instance size/type can be different from the primary database instance

Question 4 – Do you need to provision Multi-AZ replication?

The main purpose of Multi-AZ replication is to make your solution instantly available in case of a single-zone disaster (disaster recovery). You cannot use the Multi-AZ instances as read replicas.

AWS Aurora has Multi-AZ replication built-in. For other databases, you can enable it at creation time or later. Enable it only when an availability zone failure (which is very rare) would cause a negative major business impact.

Data on the main database instance is replicated to Multi-AZ Replicas synchronously – i.e. without any delay. When RDS detects a failure, RDS automatically fails over to a standby instance.

Note

  • Each read replica is charged at the same price as a standard database instance.

Question 5 – What is the optimal setup for AWS database backup?

AWS RDS allows you to backup the database data in 2 ways:

  1. Manual database snapshots.
  2. Automatic Backups with Point-In-Time recovery of the database which can be configured up to 35 days.

You are charged for the storage used by both manual database snapshots and the automatic point-in-time backups/recovery.

We recommend:

  • Reducing the retention period of the automatic backups to the number of days your business requires the recovery for – usually 7 days
  • Rarely using the manual snapshots
Email
Twitter
Facebook
LinkedIn

Leave a Reply

Your email address will not be published.

Related Tips & Tricks