Why Serverless
In a Cloud Native era, an application shall be dynamic and respond closer to user demand in term of pricing, resources allocation, and responsiveness.
That's why i think Serverless is trending. It allows application to allocate the resources required while minimizing the price when there is no need to. It's pretty common for computation (Lambada, Azure Function, OpenFaaS), but it was uncommon (at least to me) for database.
I discovered that SQL Azure Database provides a Serverless compute model for their database with an interesting feature: auto pausing. This features promises to de-allocate resources if there is no request during an amount of minutes (at least 60). The database will be resumed when used. Based on our tests, we need at least 2 minutes to be resumed. It makes too long for our production usage sadly, but we can still leverage it for our tests servers.
How to use it
Even if the autoresume is still too long to be used without care, we found a way to leverage Serverless compute model to reduce the price of our tests environment. The pricing involves the size of data used by the database more than the previous pricing model (where you can have between 1 Go and 250 Go of data without a noticeable cost per month difference). And your database is pretty small.
Generally a developer requires a full fresh environment to conduct his tests. Even if the auto pause feature annoy him, we can leverage it to switch it between working hours. Even if the developer uses it beyond the working hours, the database will remain available without delay at least for an hour, and available with the auto resume beyond.
All we need is to 2 scripts using Automation:
Enable Autopause (at the end of working hours):
az sql db update -n [YOUR_DATABASE_NAME] -s [YOUR_SERVER_NAME] -g [YOUR_RESOURCE_GROUP_NAME] --auto-pause-delay 60 --compute-model Serverless --edition GeneralPurpose --capacity 2 --family Gen5 --max-size 10GB
Disable Autopause (at the start of working hours):
az sql db update -n [YOUR_DATABASE_NAME] -s [YOUR_SERVER_NAME] -g [YOUR_RESOURCE_GROUP_NAME] --auto-pause-delay -1 --compute-model Serverless --edition GeneralPurpose --capacity 2 --family Gen5 --max-size 10GB
Top comments (2)
At must say that, at this moment, Serverless Sql Database has serious issues related to cold start that may impact business.
When paused, i agree the cold start can be too long. That's why i 'm using it only in Dev environment. But if your business usage is at predetermined hours (each day at midnight for example), it can be used, i think.