Troubleshooting transient connection errors to Azure SQL Database
Dear friends, I'm Yogesh. At my work place, I have faced these type of issues at times.
Let us understand what is this transient error?
A transient error has an underlying cause that soon resolves itself. It causes occasionally is when the Azure system quickly shifts hardware resources to better load-balance various workloads. Most of these reconfiguration events finish in less than 60 seconds.
During this reconfiguration time span, you might have connectivity issues to SQL Database. To handle them, implement retry logic in their code instead of surfacing them to users as application errors.
If your client program uses ADO.NET, your program is told about the transient error by the throw of SqlException.
What is the solution? Can Retry logic works?
When your program communicates with SQL Database through third-party middleware, ask the vendor whether the middle ware contains retry logic for transient errors.
Principles for retry (Probably at the Client side)
- If the error is transient, retry to open a connection.
- Establish a fresh connection, and then retry the
SELECT
. - When a SQL
UPDATE
statement fails with a transient error, establish a fresh connection before you retry the UPDATE. The retry logic must ensure that either the entire database transaction finished or that the entire transaction is rolled back.
We will understand the error details from 'Resource Health' of a database in Azure portal.
In activity it will be highlighted as failure in Red color.
I will post a sample picture next time when i get such issue in real time.
Thanks for reading! Do follow my other topics as well.
Export an Azure SQL Database
SQL Azure Backup and Restore
Comments
Post a Comment