Labels

Aws (32) MySQL (20) Aurora (12) Rds (7) DynamoDB (6) Cloudformation (4) Python3 (4) Unix (3) MongoDB (1)

Friday, 5 March 2021

AWS Aurora MySQL comparing the db.r4 and db.r5 instances

Why is mandatory to upgrade our Aurora clusters to the newer instance family? Let's figure out together why!

The R4 and R5 instances are optimized for memory-intensive database workloads and offer better price per GiB.

R4
2.3 GHz Intel Xeon E5-2686 v4 Processor
Intel AVX, Intel AVX2, Intel Turbo
EBS Optimized
Enhanced Networking
DDR4 Memory

R5
Up to 768GiB of memory per instance
Intel Xeon Platinum 800 series speed up to 3.1 GHz
Powered by the AWS Nitro System
Uo to 3.1GHz Intel Xeon Patinum 8000 Processor
Intel AVX, Intel AVX2, Intel Turbo

Running the benchmark tests

Benchmark EC2 
I used the IAM AuroraBenchmark to create three EC2 r4.4xlarge instances to use to execute the sysbench commands.
Ireland: ami-f45d1983
3 EC2 instances r4.4xlarge

Aurora cluster 
2 nodes
5.6.mysql_aurora.1.22.2 db.r4.large
5.6.mysql_aurora.1.22.2 db.r5.large

Sysbench installation
sudo yum -y install bzr automake mysql-devel libtool
cd /opt/benchmark_tests/test_suits/sysbench
export W='database-1.cluster-cfjc3gydmz8d.eu-west-1.rds.amazonaws.com'
export R='database-1.cluster-ro-cfjc3gydmz8d.eu-west-1.rds.amazonaws.com'

Sysbench test-data
./sysbench --test=tests/db/oltp.lua --mysql-host=$W --mysql-port=3306 --mysql-user=admin --mysql-password=******** --mysql-db=sbtest --mysql-table-engine=innodb --oltp-table-size=25000 --oltp-tables-count=250 --db-driver=mysql prepare

Sysbench read-heavy test
./sysbench --test=tests/db/oltp.lua --mysql-host=$W --oltp-tables-count=250 --mysql-user=admin --mysql-password=******* --mysql-port=3306 --db-driver=mysql --oltp-table-size=25000 --mysql-db=sbtest --max-requests=0 --oltp_simple_ranges=0 --oltp-distinct-ranges=0 --oltp-sum-ranges=0 --oltp-order-ranges=0 --max-time=600 --oltp-read-only=on --num-threads=32 run

Sysbench write-heavy test
./sysbench --test=tests/db/oltp.lua --mysql-host=$W --oltp-tables-count=250 --mysql-user=admin --mysql-password=******** --mysql-port=3306 --db-driver=mysql --oltp-table-size=25000 --mysql-db=sbtest --max-requests=0 --max-time=600 --oltp_simple_ranges=0 --oltp-distinct-ranges=0 --oltp-sum-ranges=0 --oltp-order-ranges=0 --oltp-point-selects=0 --num-threads=64 --rand-type=uniform run

Results

Only the most performance results of each of the three nodes are reported
Number of threads: 64 for each of the three EC2 instances (total 192)

Summary

R4.largeR5.largeR4.largeR5.large
ReadReadWriteWrite
read/write22,17639,5675,93710,140
Latency avg34.824.610375.4
95thPercenti45.432.1145107.7


R4 family

---- ONLY READ (second execution)

read/write requests:                  22,176 per sec
response time:
     min:                                  8.73ms
     avg:                                 86.57ms
     max:                                275.38ms
     approx.  95 percentile:             117.06ms

---- ONLY WRITE (fitfh execution)
read/write requests:                  5,937 per sec
response time:
     min:                                 28.47ms
     avg:                                129.33ms
     max:                                443.73ms
     approx.  95 percentile:             189.94ms

R5 family

---- ONLY READ (third execution)

read/write requests:                  39,567 per sec
response time:
     min:                                  6.73ms
     avg:                                 48.52ms
     max:                                420.96ms
     approx.  95 percentile:              60.88ms


---- ONLY WRITE (fourth execution)
read/write requests:                 10,140 per sec.)
response time:
     min:                                 15.39ms
     avg:                                 75.72ms
     max:                                244.90ms
     approx.  95 percentile:             107.13ms









Conclusion

The R5 instances deliver a 10% price per GiB improvement and a ~20% increased CPU performance over R4. 
The read and write workloads gain a lot of benefits of from the newer hardware and the increased CPU perf, the writer cluster is able to almost double the load. As well as the statements return quicker to the clients.