Azure SQL Server Startup Timeout

Matt Dorsey 151 Reputation points
2022-07-14T17:19:20.09+00:00

My web app is connected to azure sql and every morning when I start it I experience a long delay resulting it the first couple of api calls timing out. I understand this is because of the tier plan I purchase and that it can be resolved if I upgrade. For the near term the application will only be used by my client and I'm having a hard time justifying the added expense. Is there a workaround I can implement so that my client won't have to manually refresh the page before the sql server wakes up? Examples are appreciated!

Thanks,
Matt

220808-screen-shot-2022-07-14-at-120943-pm.png

Azure SQL Database
Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,911 questions
0 comments No comments
{count} votes

Accepted answer
  1. Bjoern Peters 8,921 Reputation points
    2022-07-14T17:29:34.097+00:00

    If you know when your client is normally/earliest starting to use the application create an automated task that first calls that API in order to wake up that database.

    e.g. create a windows tasks which runs every day at 7:00 and wakes up the database by calling your API.

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Ronen Ariely 15,206 Reputation points
    2022-07-15T00:22:59.863+00:00

    Hi @Matt Dorsey and welcome to the QNA forums

    You are using several tags which related to different product and you description does not clarify it and well.

    The tag "sql-server-general" is for on-premises SQL Server

    The tag "azure-sql-database" is for a Azure service named Azure SQL Database.

    You speak about "sql server wakes up" which does not fit the Azure SQL Database since the Azure SQL Server is just a virtual server - meaning an application which gives you the feeling and usage like you are using a real SQL Server. The databases in the Azure SQL Virtual Server can be in fact attached to different servers on different machines. Moreover, you can have different types of databases virtually managed under this "server".

    My assumption is that you are using Azure SQL Database and what actually wake up is the database service and this can be related to using serverless Azure SQL Database with auto-pause configured.

    In the Azure Serverless architecture, the database automatically pauses if it is inactive during the specified duration. By default, it is enabled and set to 1 hour (3600 seconds).

    You can change this value as you need, but you cannot complain that it behaves as you configured it to behave

    220923-image.png

    Note! if you connect to the database then it resumes. You do not have to execute any complex query.

    If you want to schedule a time to wake up the database then You can use Azure Elastic Jobs or Azure Logic Apps to wake up the database. I do not recommend to do so using external apps as it is less reliable. Your client might want to use the database not only from your app.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.