Skip to content

RDS MySQL not using NVMe instance storage - no benefit of "Optimised Reads"

0

I am load testing various RDS instances trying to optimise db price/performance

I had seen this doc https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/rds-optimized-reads.html and it sounded like a r6gd instance with local SSD storage would likely improve performance

The r6gd.2xlarge that I tested has 1x474GB NVMe, which is big enough to fit the whole dataset (EBS volume is only 400GB).

However when I check the metrics in Performance Insights the stats for ReadIOPSLocalStorage and ReadThroughputLocalStorage are basically zero. I do see a big chunk of WriteThroughputLocalStorage but it doesn't seem to be reading anything.

And if I test an r6g instance without the NVMe the performance is basically the same.

So it doesn't seem to be doing anything.

The AWS doc says it will automatically do "Optimised Reads" if you deploy one of the __d instances. But I am wondering if some manual config changes are needed to make best use of it?

There is this note in the doc:

Set the internal_tmp_mem_storage_engine parameter to TempTable, and set the temptable_max_mmap parameter to match the size of the available storage on the instance store.

Currently by default the latter value was 1073741824 i.e. 1 GiB, well short of the NVMe size

I tried bumping this up to 246960619520 but didn't see any more usage or very different performance, and FreeLocalStorage stat shows it's basically all free still.

How do I get benefit from local SSD storage and "Optimised Reads" on my RDS MySQL instance?

(It's recently deployed, on MySQL 8.0.35)

The workload of the db is mostly read-only, leaning towards 'analytical' queries. The queries all benefit from indexes but I believe the complete set of indexes are too big to fit in RAM.

  • I don't know where the info is sourced from but, assuming it's accurate, Google search AI summary gave a much better description of what Optimised Reads actually does than I could find in the AWS docs above:

    "Amazon RDS Optimized Reads for MySQL makes the best use of NVMe local storage by moving temporary tables to local NVMe-based SSD storage. This feature can improve query processing speed by up to two times for complex queries that use temporary tables." "Optimized Reads can improve the speed of queries that use temporary tables, such as queries that require sorts, hash aggregations, high-load joins, and Common Table Expressions (CTEs)."

    So if it's only used for queries involving temporary tables that could explain why it's so under-utilised.

    Quite a disappointing feature, but on plus side I can save money by using a cheaper instance type.

asked 2 years ago582 views

1 Answer
0

Hello,



I can understand that you have tested the RDS Optimised IOPS feature on the r6gd.2xlarge instance and are unable to see any changes in your CloudWatch metrics.

Kindly allow me to inform you that RDS Optimised Reads feature achieves faster query performance through the use of an instance store. An instance store is a temporary-level block storage which is located on Non-Volatile Memory Express (NVMe) solid state drives (SSDs).
This storage is specifically optimized for low latency, high random I/O performance, and high sequential read throughput.

MySQL workloads that generate temporary objects during query processing can leverage the instance store for faster query execution. Such workloads include queries involving sorts, hash aggregations, high-load joins, Common Table Expressions (CTEs), and queries on unindexed columns. The instance store offers higher IOPS (Input/Output Operations Per Second) and better performance compared to persistent Amazon EBS (Elastic Block Store) storage configurations.

In this scenario, RDS Optimized Reads redirects operations on temporary tables to the instance store, allowing input/output operations on EBS volumes to proceed uninterrupted. By diverting temporary table operations to the instance store, RDS Optimized Reads ensures that query processing can take advantage of the higher performance offered by the instance store without impacting the persistent storage operations on EBS volumes.



If you have workloads that rely heavily on temporary objects, such as internal tables or files, for their query execution, then you can benefit from turning on RDS Optimized Reads.

Below are some use cases:
 -> Applications that run analytical queries with complex common table expressions (CTEs), derived tables, and grouping operations.

-> Workloads that use internal temporary tables for query processing. You can monitor the engine status variable created_tmp_disk_tables to determine the number of disk-based temporary tables created on your DB instance.

-> Applications that create large temporary tables, either directly or in procedures, to store intermediate results.

-> Database queries that perform grouping or ordering on non-indexed columns.


Kindly note that, you can monitor the MySQL status variable created_tmp_disk_tables to observe the rate of creation for temporary tables.

However, you could use the following best practices for RDS Optimised Reads:
 -> Utilize the default MIXED setting for the binlog_format parameter. Depending on the transaction size, setting binlog_format to ROW can lead to large binlog cache files on the instance storage.

-> Keep the binlog_error_action parameter at its default ABORT_SERVER value. This avoids binary logging issues on DB instances with enabled backups.

-> Set the internal_tmp_mem_storage_engine parameter to TempTable, and configure the temptable_max_mmap parameter to match the available instance storage size.

-> Avoid performing bulk changes within a single transaction. Such transactions can generate large binlog cache files on the instance storage and cause issues when the storage is full. Instead, consider splitting writes into multiple smaller transactions to minimize storage usage for binlog cache files.

-> If your DB instance or Multi-AZ DB cluster has sufficient memory but still reaches the instance storage limit, increase the binlog_cache_size value to maintain session-specific binlog entries in memory. This configuration prevents writing binlog entries to temporary cache files on disk. The binlog_cache_size parameter is session-specific, and its value can be changed for each new session. However, increasing this parameter's value can increase memory utilization on the DB instance during peak workloads. Therefore, consider adjusting the parameter value based on your application's workload pattern and the available memory on the DB instance.



For detailed information, you can refer to the below documentation: [+] https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/rds-optimized-reads.html [+] https://aws.amazon.com/blogs/aws/new-amazon-rds-optimized-reads-and-optimized-writes/

I would like to inform you that since I do not have access to your resources or environment, I will not be able to validate or confirm the process you have tested. Additionally, the performance benefits of the approach you mentioned may vary depending on the nature of your database workload. If your workload is heavily I/O-bound, involving operations such as sorts, hash aggregations, or other similar operations, you may observe significant performance improvements. However, if your workload does not fall into these categories, the performance benefits may not be as substantial.

However, if you require specific troubleshooting assistance or have any further concerns, I recommend raising a support case by creating a ticket with our support team. Our support team will have access to the necessary resources and information to provide you with more accurate and tailored guidance based on your specific environment and requirements.

AWS

answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.