SQL Azure and support for retries

Topics: Building and extending application blocks, Data Access Application Block
Oct 21, 2010 at 2:39 AM

Hi,

We use the Entlib data access block in our Azure application. We have had the odd request fail and to achieve high reliability the need to retry selected errors has been documented in several places e.g.

http://blogs.msdn.com/b/sqlazure/archive/2010/05/11/10011247.aspx

http://sqlcat.com/technicalnotes/archive/2010/06/17/best-practices-for-building-reliable-sql-azure-database-client-applications.aspx

There has also been discussion about this functionality being baked into future releases of the Entlib and I was wondering if there was any indication of when this might happen?

I have rolled my own ExecuteNonQueryWithRetries etc. but would be quite keen on replacing it with something off the shelf.

Thanks

Bryn





Oct 21, 2010 at 2:55 AM

There's currently no information yet on what will be included in the next release or when that might be.  The EntLib team usually conduct a public consultation regarding on what they want for the next release.  In the meantime, you can log this as a feature request in the Issue Tracker.

 

Sarah Urmeneta
Global Technology & Solutions
Avande, Inc.
entlib.support@avanade.com

Aug 15, 2012 at 5:03 PM

This has been added to the Enterprise Library and shipped as a part of the Integration Pack for Windows Azure.

The new Transient Fault Handling Application Block provides an extensible collection of retry strategies including:

  • Incremental
  • Fixed interval
  • Exponential back-off

It also includes a collection of error detection strategies for cloud-based services.

For more information see this chapter of the Developer's Guide.

Available via NuGet (search for 'topaz').

Grigori

Oct 10, 2012 at 5:13 PM

I am using this architecture with ADO.NET Entity Framework and have read several posts on how to accomplish this, but I still have questions on exactly when I need to wrap my calls in the retry block.  Can you please answer the following question:

1) If I have the code below, which statements should be wrapped within the retry block?  The Linq query, or the 1st call using the result set of the Linq query, or both?  I am concerned about when it actually goes to the DB (Lazy Loading)

var ResultSet = from persons in Conn.Persons where persons.Gender == “Male” select persons;
int iPersonsCount = ResultSet.Count();

2) Do all calls using the result set need to be wrapped with retry blocks?  Again this is a concern due to Lazy Loading, and when it goes to the DB.

3) If I am using ADO.NET entity framework, should I also over load the “OnContextCreated()” method, to wrap the connection object in a retry?

Oct 14, 2012 at 2:16 AM

You need to use a retry policy for all interactions with the database.  As you say LINQ offers deferred execution so you should ensure that the query is being executed when applying a retry policy.

The article, SQL Azure and Entity Framework Connection Fault Handling, gives some Entity Framework examples (the article is actually in reference to the predecessor of the Trasient Fault Handling Application Block but should still apply).  You don't need to use OnContextCreated since the block will check for EntityExceptions and apply the policy on the inner SqlException.

--
Randy Levy
Enterprise Library support engineer
entlib.support@live.com