Search code examples
azureazure-sql-database

Serverless SQL Database and significant lag?


Long story short: I switched to Azure last month to use their SQL Database for a mobile app I'm testing (I'm the only tester). The iphone app is simple: I tap on the app in my iphone and it displays a list of rows that come from the Azure SQL database.

The initial list loaded incredibly fast (less than 2 seconds). Unfortunately, I had mistakenly selected the "Provisioned" Compute Tier at $350+/month.

So I went back to Azure and changed it to "Serverless", which starts at $4.78/month.

But now I've noticed that whenever I use the app after a reasonable amount of time without use, the list takes forever to load (if it loads). So for example, it's been 2 days since I last opened the app. I opened it just now and it took 15 seconds for the list to load. I opened it again and now it loads faster.

Since I'm the only tester, it seems that when I use it after an extended period of time, the database "wakes up".

Is the change to "Serverless" causing this lag?


Solution

  • Is the change to "Serverless" causing this lag?

    Yes, almost undoubtedly. Cold starts are a well-known drawback to a serverless style architecture.

    Microsoft documents this pretty ubiquitously in all documentation that specifically relates to their "serverless" service offerings. From the link above:

    The latency to auto-resume and auto-pause a serverless database is generally order of 1 minute to auto-resume and 1-10 minutes after the expiration of the delay period to auto-pause.