During Pre:Invent season, AWS announced that Aurora Serverless v2 now scales down to zero, leaving no cost (except storage costs) to the customer.
Last week, I tuned one of my demo databases to use that feature... and it is so satisfying to actually see the "ServerlessDatabaseCapacity" metric go down to zero!
How fast does it resume?
Now, a database that scales to zero and takes 5min to wake up is a great opportunity to save money for a test environment, but certainly not for production. However, Aurora Serverless does much better, with an announced 15s time-to-full-capacity!!
I wanted to measure how fast this process does.. so I used my demo application, a Lambda-based PHP app (read this post!), an triggered a single HTTP call.
Here are the results:
First, the Lambda took 12 seconds to proceed (see the red dot in the top right corner in the previous screenshot). This is consistent with the information I got from the RDS DescribeEvents API:
<DescribeEventsResponse xmlns="http://rds.amazonaws.com/doc/2014-10-31/">
<DescribeEventsResult>
<Events>
<Event>
<Date>2024-12-06T14:05:43.121Z</Date>
<SourceArn>arn:aws:rds:eu-west-1:REDACTED_FOR_SECURITY:cluster:aurora-cluster-demo</SourceArn>
<SourceIdentifier>aurora-cluster-demo</SourceIdentifier>
<SourceType>db-cluster</SourceType>
<EventCategories>
<EventCategory>serverless</EventCategory>
<EventCategory>notification</EventCategory>
</EventCategories>
<Message>Initiated resume for the DB instance: DB_REDACTED_FOR_SECURITY due to user activity</Message>
</Event>
<Event>
<Date>2024-12-06T14:05:56.374Z</Date>
<SourceArn>arn:aws:rds:eu-west-1:REDACTED_FOR_SECURITY:cluster:aurora-cluster-demo</SourceArn>
<SourceIdentifier>aurora-cluster-demo</SourceIdentifier>
<SourceType>db-cluster</SourceType>
<EventCategories>
<EventCategory>serverless</EventCategory>
<EventCategory>notification</EventCategory>
</EventCategories>
<Message>Successfully resumed the DB instance: DB_REDACTED_FOR_SECURITY</Message>
</Event>
</Events>
</DescribeEventsResult>
<ResponseMetadata>
<RequestId>5cd9cbef-REDACTED_FOR_SECURITY-4ee987b34cb4</RequestId>
</ResponseMetadata>
</DescribeEventsResponse>
So, in that 12 seconds period, Aurora Serverless v2 was able to resume my DB instance and perform a query listing all the blog posts!!! Quite amazing!
This makes Aurora Serverless v2 scale-to-zero a suitable option, not only for your test environments, but also for all production workloads that have periods with no usage, and can sustain a "not-so-fast" response to first query. That includes a wide range of corporate apps (who uses your HR app at midnight??)
Pro-tip : to profit from this, make sure your app healthcheck don't perform any SQL queries!
Top comments (0)