Amazon Aurora is Now 60 Times Faster than RDS for MySQL. Really.
Renato Losio đź’đź’Ą
Posted on July 26, 2023
Today I will perform a simple test a proper benchmark, comparing Aurora MySQL and RDS for MySQL.
Unlike traditional benchmarks that are lengthy and complex, this evaluation will be concise, comprising only about 200 words and taking just a couple of minutes to review the results.
First, let’s create two instances, using the AWS CLI. To ensure a fair comparison, we will create two instances using default values. Both instances will have the same class and size, db.t4g.medium, and will be located in the same AWS region, Frankfurt.
# Aurora
$ aws rds create-db-cluster --db-cluster-identifier benchmark --engine aurora-mysql --engine-version 8.0 --master-username renato --master-user-password ******** --db-subnet-group-name renato --vpc-security-group-ids sg-030c9f25422a13fea
$ aws rds create-db-instance --db-instance-identifier benchmark --db-cluster-identifier benchmark --engine aurora-mysql --db-instance-class db.t4g.medium
# RDS
$ aws rds create-db-instance --db-instance-identifier benchmark-rds --engine mysql --db-instance-class db.t4g.medium --master-username renato --master-user-password ******** --allocated-storage 100 --vpc-security-group-ids sg-030c9f25422a13fea
The benchmark process will involve creating a database, a table, and a MySQL procedure on both endpoints. This procedure will simply insert 100K records into the table, generating random values to introduce some data variety.
CREATE DATABASE renato;
USE renato;
CREATE TABLE renato
(id bigint(20) NOT NULL AUTO_INCREMENT,
datetime TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
value float DEFAULT NULL,
PRIMARY KEY (id));
DELIMITER $$
CREATE PROCEDURE load_renato()
BEGIN
DECLARE i INT DEFAULT 0;
WHILE i < 100000 DO
INSERT INTO renato (datetime,value) VALUES (
FROM_UNIXTIME(UNIX_TIMESTAMP('2023-07-01 01:00:00')+FLOOR(RAND()*31536000)),
ROUND(RAND()*100,2));
SET i = i + 1;
END WHILE;
END$$
DELIMITER ;
Finally, we will call the procedure on both databases, Remember: default configuration, same region, same class, same size. No networking is involved. No magic. No tricks.
# Aurora
mysql> call load_renato;
Query OK, 1 row affected (5,41 sec)
mysql> select count(*) from renato;
+----------+
| count(*) |
+----------+
| 100000 |
+----------+
# RDS
mysql> call load_renato;
Query OK, 1 row affected (5 min 20,41 sec)
mysql> select count(*) from renato;
+----------+
| count(*) |
+----------+
| 100000 |
+----------+
The results are striking: Amazon Aurora outperforms RDS significantly, completing the task in just 5.4 seconds compared to RDS’s 5 minutes and 20 seconds. This remarkable 60x difference clearly demonstrates the superiority of Aurora in this specific scenario.
WOW, you are kidding me!
Just remember this simple test every time you read “50% faster”, “47% faster and costing up to 43% less” or “127% better IOPS”. This benchmark serves just as a reminder that real-world tests are crucial in understanding the true capabilities of a database.
As they used to say, there are three kinds of lies: lies, damned lies, and statistics database benchmarks.
Posted on July 26, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.