Serverless RDS MySQL will not scale to 0

0

I am experimenting with a serverless RDS instance. It has the following configuration:

  • a minimum Aurora capacity unit (ACU) of 1 (there is no option for 0)
  • autoscaling timeout of 2 minutes
  • "scale to 0 ACUs when cluster is idle" is checked
  • amount of time that the cluster can be idle before scaling is 15 minutes

However, over the past 3 hours, with zero connections to the database, the "serverless database capacity (count)" graph remains at 1. It has brief moments when it dips to 0, but it does not stay at 0, despite no active connections for hours. How do I ensure that the database can scale to 0?

amoffat
asked 2 years ago3174 views
3 Answers
1
Accepted Answer

Hi there.

From Serverless documentation, if any "database connections are requested when an Aurora Serverless DB cluster is paused, the DB cluster automatically resumes and services the connection requests", so I'd recommend checking not only that the DatabaseConnections CW metric is zero (which indicates no persistent connections), but also that the ConnectionAttempts CW metric is zero for longer than the SecondsUntilAutoPause value (15 minutes in your setup). Any connection request/attempt within the SecondsUntilAutoPause time frame resets the AutoPause counter.

If ConnectionAttempts is greater than zero at any point in time and you're not sure where it comes from, I'd then recommend enabling audit for the CONNECT event on Aurora Advanced Audit settings for your cluster, and looking into the logged events in the CW Logs log group when it happens again after enabling audit.

I hope this helps. If you'd like or need a more detailed investigation into your cluster, I'd recommend opening a technical case with AWS Support, as they'll be able to work with you through it, step by step.

AWS
answered 2 years ago
  • You solved the mystery! The ConnectionAttempts metric was the key. It was keeping the ACUs from scaling down, and the source was an NLB's health check on the target group containing the database. Once I removed the target group from the NLB (it was just for debugging anyways), the ACUs scaled down to 0. Thank you!

0

Hello!

Good question. You're right on the configuration. You cannot have the minimum capacity set to less than 1.

Check out the option to "Pause compute capacity after consecutive minutes of inactivity". Default is 5 minutes, but you can configure this to your needs: https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/aurora-serverless.how-it-works.html#aurora-serverless.how-it-works.pause-resume.

For example, if you using CloudFormation - make sure the AutoPause is set to true.


 "ScalingConfiguration" : {
                  "AutoPause" : true,
                  "MinCapacity" : 4,
                  "MaxCapacity" : 32,
                  "SecondsUntilAutoPause" : 1000
}

Another thing to pay attention to: if autoscaling doesn't find a scaling point before timing out, Aurora will keep the cluster at the current capacity. To change this behavior, you can select the Force the capacity change option as well. Check that at the ForceApplyCapacityChange property. More information here: https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/aurora-serverless.how-it-works.html#aurora-serverless.how-it-works.timeout-action

jsonc
answered 2 years ago
  • Thanks for the response. In my original post, I noted that I have enabled "scale to 0 ACUs when cluster is idle", which is under the "pause after inactivity" section of my configuration. I shouldn't need to (nor want to) enable "force capacity change", since there are no db connections to my database. Here is the relevant section of my config, as retrieved from aws rds describe-db-clusters

                "Capacity": 1,
                "EngineMode": "serverless",
                "ScalingConfigurationInfo": {
                    "MinCapacity": 1,
                    "MaxCapacity": 64,
                    "AutoPause": true,
                    "SecondsUntilAutoPause": 900,
                    "TimeoutAction": "RollbackCapacityChange",
                    "SecondsBeforeTimeout": 120
                },
    

    The database doesn't seem to ever want to scale down past 1 though.

0

My recent billing statement for December 2021 shows that RDS is not scaling down at all over the course of the month:

Amazon Relational Database Service for Aurora MySQL $44.42
$0.06 per Aurora Capacity Unit hour running Amazon Aurora MySQL Serverless740.341 ACU-Hr $44.42
USD 0.021 per GB-month of backup storage exceeding free allocation for Aurora MySQL0.169 GB-Mo $0.00
amoffat
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.

Guidelines for Answering Questions