Friday, February 22, 2013

Specifying Timeout for Azure Storage data retrieval

Graceful Degradation - handling Windows Azure Storage retrieval failures

Windows Azure storage can go down any time, as is shown in the worldwide outage today. Luckily this is a very rare event.

FYI - here's the link to the Windows Azure Service Dashboard:

However, in such a situation, any requests from a website that retrieves blob data from the service (images or documents, for example) will cause the website to wait a long time for Azure Storage to respond. As a result, it will take humongous amounts of time before the browser renders the page fully (although with missing images etc). Unacceptable, from a user's point of view.

In this scenario, we need to gracefully degrade the service from our website. Given the scenario, the best handling we can do is to time-out the Azure Storage request, and then supply an alternative image or other suitable filler. Here's how to time-out the request.

Timing out a Windows Azure Storage blob request

  // Create a timeout for the blob request
  BlobRequestOptions blobRequestOptions = 
      new BlobRequestOptions();
  blobRequestOptions.Timeout = TimeSpan.FromMilliseconds(1000);

  // Retrieve the requested image
  returnContent = File(

In the above code, we set a timeout of 1000 milliseconds (1 second). If the Azure Storage service fails to respond within that time, our program will stop waiting, leaving us free to take alternative actions such as serve up a placeholder image. (1 second seems to work with most image files but may still need to be tweaked).

This way, the website will remain responsive to the user.

Happy coding!


  1. nice information well done your information is helping alot thanks for valuable windows azure training in hyderabad

  2. The series explores the impression of downside playing on communities of shade and the extent to which states provide money for downside playing therapy. McCaffery said he was unaware of the slot machines on bases however pledged to provide his attention to the matter and how it it} “links to a few of [Sen. Warren’s] issues concerning playing dysfunction.” He then committed to enforcing the NDAA provision. Clinician Jessica Vance pointed to her computer display screen level out|to indicate} the questions counselors ask, including whether or not callers are 로스트아크 in danger for suicide.