You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/storage/blobs/storage-retry-policy.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,11 +6,11 @@ author: pauljewellmsft
6
6
ms.author: pauljewell
7
7
ms.service: azure-blob-storage
8
8
ms.topic: how-to
9
-
ms.date: 12/14/2022
9
+
ms.date: 09/26/2023
10
10
ms.custom: devx-track-dotnet
11
11
---
12
12
13
-
# Implement a retry policy with the Azure Storage client library for .NET
13
+
# Implement a retry policy with .NET
14
14
15
15
Any application that runs in the cloud or communicates with remote services and resources must be able to handle transient faults. It's common for these applications to experience faults due to a momentary loss of network connectivity, a request timeout when a service or resource is busy, or other factors. Developers should build applications to handle transient faults transparently to improve stability and resiliency.
16
16
@@ -23,26 +23,26 @@ The following table lists the properties of the [RetryOptions](/dotnet/api/azure
23
23
24
24
| Property | Type | Description | Default value |
25
25
| --- | --- | --- | --- |
26
-
|[Delay](/dotnet/api/azure.core.retryoptions.delay)|[TimeSpan](/dotnet/api/system.timespan)| The delay between retry attempts for a fixed approach or the delay on which to base calculations for a backoff-based approach. If the service provides a Retry-After response header, the next retry will be delayed by the duration specified by the header value. | 0.8 second |
27
-
|[MaxDelay](/dotnet/api/azure.core.retryoptions.maxdelay)|[TimeSpan](/dotnet/api/system.timespan)| The maximum permissible delay between retry attempts when the service doesn't provide a Retry-After response header. If the service provides a Retry-After response header, the next retry will be delayed by the duration specified by the header value. | 1 minute |
26
+
|[Delay](/dotnet/api/azure.core.retryoptions.delay)|[TimeSpan](/dotnet/api/system.timespan)| The delay between retry attempts for a fixed approach or the delay on which to base calculations for a backoff-based approach. If the service provides a Retry-After response header, the next retry is delayed by the duration specified by the header value. | 0.8 second |
27
+
|[MaxDelay](/dotnet/api/azure.core.retryoptions.maxdelay)|[TimeSpan](/dotnet/api/system.timespan)| The maximum permissible delay between retry attempts when the service doesn't provide a Retry-After response header. If the service provides a Retry-After response header, the next retry is delayed by the duration specified by the header value. | 1 minute |
28
28
|[MaxRetries](/dotnet/api/azure.core.retryoptions.maxretries)| int | The maximum number of retry attempts before giving up. | 5 |
29
29
|[Mode](/dotnet/api/azure.core.retryoptions.mode)|[RetryMode](/dotnet/api/azure.core.retrymode)| The approach to use for calculating retry delays. | Exponential |
30
30
|[NetworkTimeout](/dotnet/api/azure.core.retryoptions.networktimeout)|[TimeSpan](/dotnet/api/system.timespan)| The timeout applied to an individual network operation. | 100 seconds |
31
31
32
-
In this code example for blob storage, we'll configure the retry options in the `Retry` property of the [BlobClientOptions](/dotnet/api/azure.storage.blobs.blobclientoptions) class. Then, we'll create a client object for the blob service using the retry options.
32
+
In this code example for blob storage, we configure the retry options in the `Retry` property of the [BlobClientOptions](/dotnet/api/azure.storage.blobs.blobclientoptions) class. Then, we create a client object for the blob service using the retry options.
In this example, each service request issued from the `BlobServiceClient` object will use the retry options as defined in the `BlobClientOptions` object. You can configure various retry strategies for service clients based on the needs of your app.
36
+
In this example, each service request issued from the `BlobServiceClient` object uses the retry options as defined in the `BlobClientOptions` object. You can configure various retry strategies for service clients based on the needs of your app.
37
37
38
38
## Use geo-redundancy to improve app resiliency
39
39
If your app requires high availability and greater resiliency against failures, you can leverage Azure Storage geo-redundancy options as part of your retry policy. Storage accounts configured for geo-redundant replication are synchronously replicated in the primary region, and asynchronously replicated to a secondary region that is hundreds of miles away.
40
40
41
41
Azure Storage offers two options for geo-redundant replication: [Geo-redundant storage (GRS)](../common/storage-redundancy.md#geo-redundant-storage) and [Geo-zone-redundant storage (GZRS)](../common/storage-redundancy.md#geo-zone-redundant-storage). In addition to enabling geo-redundancy for your storage account, you also need to configure read access to the data in the secondary region. To learn how to change replication options for your storage account, see [Change how a storage account is replicated](../common/redundancy-migration.md).
42
42
43
-
In this example, we set the `GeoRedundantSecondaryUri` property in `BlobClientOptions`. When this property is set and a read request failure occurs in the primary region, the app will seamlessly switch to perform retries against the secondary region endpoint.
43
+
In this example, we set the [GeoRedundantSecondaryUri](/dotnet/api/azure.storage.blobs.blobclientoptions.georedundantsecondaryuri#azure-storage-blobs-blobclientoptions-georedundantsecondaryuri) property in `BlobClientOptions`. If this property is set, the secondary URI is used for `GET` or `HEAD` requests during retries. If the status of the response from the secondary URI is a 404, then subsequent retries for the request don't use the secondary URI again, as this status code indicates that the resource may not have propagated there yet. Otherwise, subsequent retries alternate back and forth between primary and secondary URI.
Apps that make use of geo-redundancy need to keep in mind some specific design considerations. To learn more, see [Use geo-redundancy to design highly available applications](../common/geo-redundant-design.md).
0 commit comments