Monitoring and Optimization · Topic 6 of 6
Storage and Database Performance
Pick the right EBS volume type, tune EFS and S3, and diagnose RDS and DynamoDB bottlenecks with Performance Insights, replicas, RDS Proxy and caching.
- 5 min
- gp3 is the usual general purpose SSD, and IOPS and throughput are set independently of size.
- io1 and io2 are for high, steady IOPS on databases.
- st1 and sc1 are HDD, cheaper and sequential, and they cannot boot an instance.
What it is
Storage and database tuning means finding which part of the data path is slow, then changing the volume type, caching layer or database design to fix it. The exam gives you symptoms and asks for the best change.
The usual questions are which EBS (Elastic Block Store) volume type fits, how to offload reads from a database, and which tool shows why a query is slow.
How it works
EBS volume types
| Type | Kind | Use for |
|---|---|---|
| gp3 | General purpose SSD | Default choice, IOPS and throughput can be set apart from size |
| gp2 | General purpose SSD | Older type, IOPS tied to volume size, burst credits |
| io1 and io2 | Provisioned IOPS SSD | Latency sensitive databases that need high, steady IOPS |
| st1 | Throughput optimized HDD | Large sequential reads and writes, such as logs and data warehouses |
| sc1 | Cold HDD | Infrequently accessed data at the lowest cost |
HDD types (st1 and sc1) cannot be boot volumes. For gp3, the baseline is the same for every size, so you can raise IOPS or throughput without buying more space.
With Elastic Volumes you can change a volume's size, type, IOPS and throughput while it is in use. After growing the volume, extend the file system inside the operating system.
Useful metrics are VolumeQueueLength (a long queue means the volume cannot keep up) and BurstBalance for burst based types. Remember that an instance type also has a limit on EBS bandwidth.
EFS and S3
Amazon EFS (Elastic File System) is a shared network file system. Throughput mode and performance mode settings let you trade latency for scale, and the Elastic throughput mode adjusts to the workload.
Amazon S3 scales request rates per prefix, so spreading keys across prefixes helps heavy workloads. Use multipart upload for large objects, byte range fetches for partial reads, and S3 Transfer Acceleration for long distance uploads. Put CloudFront in front for repeated downloads.
RDS monitoring
Amazon RDS (Relational Database Service) gives three views, and each answers a different question.
| Tool | What it shows |
|---|---|
| CloudWatch metrics | CPU, connections, free storage, IOPS, replica lag (hypervisor view) |
| Enhanced Monitoring | Operating system metrics at the instance level, down to one second |
| Performance Insights and Database Insights | Database load by wait event, SQL statement, host and user |
When CPU is high and you do not know why, the database load view points to the SQL statements that cause it. This view began as Performance Insights, and the console experience has moved into CloudWatch Database Insights, so expect either name.
Scaling RDS for performance
- Read replicas serve read traffic, so use them for reporting and read heavy applications. Replication is asynchronous, so replicas can lag.
- Caching with Amazon ElastiCache keeps hot results in memory and reduces database reads.
- RDS Proxy pools and shares connections. It helps when many short lived clients, such as Lambda functions, exhaust database connections.
- Larger instance class or storage change fixes a CPU, memory or IOPS limit that cannot be spread out.
- Storage autoscaling grows storage before it fills.
# AWS CLI: create a read replica
aws rds create-db-instance-read-replica \
--db-instance-identifier mydb-replica \
--source-db-instance-identifier mydb
DynamoDB
Amazon DynamoDB capacity is either on demand or provisioned. Watch for throttled requests, which mean a table or a hot partition key is out of capacity. Spread traffic over many partition key values.
DynamoDB Accelerator (DAX) is an in memory cache for DynamoDB reads, giving microsecond read times without application redesign beyond using the DAX client.
A read replica is not a high availability feature, and a classic Multi AZ standby is not a read scaling feature. Match the feature to the goal: read replicas for performance, Multi AZ for availability.
What to remember for the exam
- gp3 is the usual general purpose SSD, and IOPS and throughput are set independently of size.
- io1 and io2 are for high, steady IOPS on databases.
- st1 and sc1 are HDD, cheaper and sequential, and they cannot boot an instance.
- Elastic Volumes lets you modify a volume without detaching it, then you extend the file system.
- Performance Insights (now part of CloudWatch Database Insights) shows database load by SQL and wait event, and Enhanced Monitoring shows OS metrics.
- Read replicas offload reads, ElastiCache caches results, and RDS Proxy pools connections.
- DynamoDB throttling points to capacity limits or a hot partition key, and DAX caches reads.
- Replica lag is possible because replication is asynchronous.
Common mistakes
Choosing io2 when gp3 is enough. Provisioned IOPS cost more. Check whether gp3 settings meet the need first.
Sending writes to a read replica. Replicas serve reads only, so writes still go to the primary.
Forgetting to extend the file system. Growing an EBS volume does not grow the partition or file system inside the instance.
Blaming the database for a connection storm. Many Lambda functions can open too many connections. RDS Proxy is the fix, not a bigger instance.
Using HDD for random access. st1 suits large sequential work, not small random reads.
Modifying an EBS volume has a cool down before you can change the same volume again, so plan changes instead of repeated small adjustments.
Check yourself
Answer these three.
Which RDS tool shows the SQL statements that create the most load?
Performance Insights, whose database load view now lives in CloudWatch Database Insights.
An application using Lambda runs out of database connections. What helps most?
RDS Proxy, which pools and reuses connections.
Which EBS types can serve as boot volumes?
The SSD types such as gp2, gp3, io1 and io2, but not the HDD types st1 and sc1.
Topic 6 of 6 in Monitoring and Optimization
Test yourself on Monitoring and Optimization
The full AWS SOA-C03 question bank has 850 questions, with timed practice exams and an explanation for every answer.
This study guide is independent and is not affiliated with, endorsed by, or sponsored by AWS. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.