Skip to content

How do I troubleshoot scaling issues for Aurora Serverless v2?

4 minute read
0

I want to troubleshoot scaling issues for Amazon Aurora Serverless v2 for Amazon Aurora PostgreSQL-Compatible Edition.

Short description

If Aurora Serverless v2 doesn't scale down to the minimum capacity even with no load on the database, then you must update the parameters to their defaults. Aurora Serverless v2 uses Aurora capacity units (ACU) to measure compute capacity, each ACU represents approximately 2 gibibytes (GiB) of memory with corresponding CPU and networking resources.

If your resources have too many idle connections or you have high CPU utilization for extended periods, then you can't scale up to maximum capacity. If you configure a minimum capacity to 0.5 ACU and use the auto-pause feature, then you might have cold start issues that lead to connection or transaction timeout errors.

Resolution

Modify the minimum ACU

If you migrate from provisioned instances to serverless instances, then review the BufferCacheHitRatio metric of the provisioned instance to understand the DB instance's behavior. If the metric isn't stable and drops in Aurora serverless, then increase the minimum ACUs based on your DB buffer cache performance needs. The higher the minimum ACU, the more rapidly the database can scale up to meet the demand of the application. For more information, see Choosing the Aurora Serverless v2 capacity range for an Aurora cluster.

To configure the minimum ACU, complete the following steps:

  1. Open the Amazon Aurora and RDS console.
  2. In the navigation pane, choose Databases.
  3. Choose Create database for new clusters or select an existing cluster, and then choose Modify.
  4. In the Instance Configuration section, under Capacity range, set the minimum ACU value. For more information, see Capacity range in Creating a DB cluster that uses Aurora Serverless v2.
    Note: If you activated Database Insights, then it's a best practice to set the Minimum capacity (ACUs) to 2. If you use global databases, then set the Minimum capacity (ACUs) to 8. For more information, see Choosing the minimum Aurora Serverless v2 capacity setting for a cluster in Performance and scaling for Aurora Serverless v2.

Change the priority tier of the reader instance

Idle Aurora Serverless v2 writers and readers can scale down to the minimum ACU value that you specified for the cluster. Background processing and administrative tasks that run on the backend might cause serverless instances to not scale down to the minimum ACU.

For more information, see Troubleshooting Aurora Serverless v2 capacity issues.

Remove custom values

Database parameters, such as max_connections and max_locks_per_transaction, impact scaling behavior. Custom values don't support databases to scale to the minimum capacity. To remove custom values for max_connections and max_locks_per_transaction, set the parameters to the default value. Then, reboot the primary DB instance.

Reduce connection pressure on the database

To reduce connection pressure on the database, use Amazon RDS Proxy to configure connection pooling with retry logic and exponential backoff.

Review database queries

To reduce the load and improve the scaling performance, regularly review and optimize the database queries. To optimize queries, run the ANALYZE and VACUUM PostgreSQL commands. For more information, see ANALYZE and Routine Vacuuming on the PostgreSQL website.

Monitor CloudWatch metrics

To track actual ACU use, monitor ServerlessDatabaseCapacity, ACUUtilization, CPUUtilization, and FreeableMemory Amazon CloudWatch metrics for Aurora Serverless 2. To receive proactive alerts for scaling issues with Aurora Serverless v2, you must configure CloudWatch alarms. If ACUUtilization and CPUUtilization metrics approach 100%, then your Aurora Serverless v2 has insufficient maximum ACU capacity and extremely high-load conditions.

To set up alerts for scaling failures or extended high-capacity periods, see Creating CloudWatch alarms to monitor Amazon Aurora.

Set the value for auto-pause and timeout configurations

Set the automatic pause and resume values for Aurora Serverless v2. Stop and restart the database to reclaim memory fragments that might have built up over time.

Note: If you stop and restart your database, then your database experiences downtime.

Related information

Understanding how ACU minimum and maximum range impacts scaling in Amazon Aurora Serverless v2