Setting Timeouts for Blob Service Operations
Updated: October 20, 2011
Each call to a Blob service API can include a timeout interval, which is used in two different ways.
The Blob service returns an error when the timeout interval elapses while processing the request.
If you are using a storage client, it throws an exception when it does not receive an HTTP status code response from the service within the timeout interval. Timeout only applies to receipt of the status code, and does not apply to receipt of the message body or completion of data transfer to the client.
The default timeout interval is 30 seconds for REST calls to the Blob service. Thirty seconds is also the maximum timeout interval for Blob service operations, with some exceptions noted below. The Blob service reduces larger timeouts to 30 seconds. By default, storage clients specify a 90 second timeout with most Blob service calls. The Blob service will return an error if it cannot prepare a proper response within 30 seconds, and the storage client will wait 90 seconds to throw an exception if it receives no response.
The timeout interval can be set for a single blob request using Microsoft.WindowsAzure.StorageClient.BlobRequestOptions.Timeout, and the default timeout interval for all blob storage clients can be set using Microsoft.WindowsAzure.StorageClient.CloudBlobClient.Timeout.
The following example REST URI sets the timeout interval for the List Containers (REST API) operation to 20 seconds:
The following C# example sets the timeout for the storage client to 5 minutes for a single blob download:
Exceptions to Default Timeout Interval
The following operations implement exceptions to the standard 30 second timeout interval:
Calls to get a blob, get page ranges, or get a block list are permitted 2 minutes per megabyte to complete. If an operation is taking longer than 2 minutes per megabyte on average, it will timeout.
Calls to write a blob, write a block, or write a page are permitted 10 minutes per megabyte to complete. If an operation is taking longer than 10 minutes per megabyte on average, it will timeout.
The maximum timeout to write a block list is 60 seconds.
A container that was recently deleted cannot be recreated until all of its blobs are deleted. Depending on how much data was stored within the container, complete deletion can take seconds or minutes. If you try to create a container of the same name during this cleanup period, your call returns an error immediately.