Reputation: 1
I recently set up some analytics for my Azure SQL DB, using Azure SQL Analytics. (https://learn.microsoft.com/en-us/azure/azure-monitor/insights/azure-sql)
One of the metrics that is measured is Timeouts. I have logging in my application, and I'm not seeing any blocking or deadlocks, and I don't see anything where a query is actually failing.
My question is this -- what is considered a Timeout?
As a bonus question, most of the time I'm seeing four timeouts together. This is a node.js application, and I use a tedious driver to interact with the database. Is there something in tedious where it is retrying the queries four times, etc.?
Upvotes: 0
Views: 7114
Reputation: 15702
Connection timeouts occur because the application can't connect to the server. A possible reason may be the max number of milliseconds period elapsed during the post-login phase. The connection could have timed out while waiting for server to complete the login process and respond; Or it could have timed out while attempting to create multiple active connections.
Azure SQL Database will close idle connections of more than 30 minutes. Excerpt: "For example, if you are connected to your database through SQL Server Management Studio for longer than 30 minutes without having any active request your session will timeout and because there are no active requests SQL Azure can’t return an error". Source is here.
When trying connections to Azure SQL Database you need a retry logic. My suggestion is use tedious connection pool since the pool retry connections.
Set the retryDelay parameter. This parameter is the number of milliseconds to wait after a connection fails, before trying again. Default = 5000.
The idleTimeout parameter is the number of milliseconds before closing an unused connection. Default = 300000 which is enough for Azure SQL connections.
Upvotes: 1