Skip to content

Commit 8dd9e10

Browse files
Initial doc
1 parent 32403f3 commit 8dd9e10

File tree

1 file changed

+29
-31
lines changed

1 file changed

+29
-31
lines changed

articles/storage/blobs/storage-retry-policy.md

Lines changed: 29 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,9 @@ ms.date: 08/23/2022
99
ms.custom: template-how-to
1010
---
1111

12-
<!--
13-
Remove all the comments in this template before you sign-off or merge to the
14-
main branch.
15-
-->
16-
17-
<!--
18-
This template provides the basic structure of a how-to article.
19-
See the [how-to guidance](contribute-how-to-write-howto.md) in the contributor guide.
20-
21-
To provide feedback on this template contact
22-
[the templates workgroup](mailto:[email protected]).
23-
-->
24-
25-
<!-- 1. H1
26-
Required. Start your H1 with a verb. Pick an H1 that clearly conveys the task the
27-
user will complete.
28-
-->
29-
3012
# Implement a retry policy for Azure Storage services
3113

32-
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 cloud applications and services to experience faults due to a momentary loss of network connectivity, a request timeout when a service or resource is busy, or a number of other factors. Developers should build applications to handle transient faults transparently to improve stability and resiliency.
14+
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 cloud applications and services 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.
3315

3416
This article shows you how to set up a basic retry strategy for an application that connects to Azure blob storage. This strategy is one element to consider as part of a broader retry policy for your application.
3517

@@ -50,17 +32,33 @@ Required. A how-to article explains how to do a task. The bulk of each H2 should
5032
a procedure.
5133
-->
5234

53-
## [Section 1 heading]
54-
Retry policies are configured programmatically.
55-
1. <!-- Step 1 -->
56-
1. <!-- Step 2 -->
57-
1. <!-- Step n -->
35+
## Configure retry options
36+
Retry policies for Azure storage services are configured programmatically, offering control over how retry options are applied to various services and scenarios. It's important to note that any retry policy should be tuned to match the business requirements of the application and that nature of the failure.
37+
38+
In this example for blob storage, we'll define the retry options in the `Retry` property of the `BlobClientOptions` class.
39+
40+
:::code language="csharp" source="~/azure-storage-snippets/blobs/howto/dotnet/dotnet-v12/Retry.cs" id="Snippet_RetryOptions":::
41+
42+
Next, we'll create a client object for the blob service with the retry options defined above.
43+
44+
:::code language="csharp" source="~/azure-storage-snippets/blobs/howto/dotnet/dotnet-v12/Retry.cs" id="Snippet_RetryOptionsCreateClient":::
45+
46+
This method of instantiating `blobServiceClient` means that each service request issued from the client will use the retry options as defined in the parameter `blobOptions`. You can configure various retry strategies and service clients based on the needs of your app.
47+
48+
## Use geo-redundancy to improve app resiliency
49+
If your app requires high availability and greater resiliency against failures, you can leverage Azure Storage geo-redundancy options. 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.
50+
51+
Azure Storage offers two options for geo-redundant replication: [Geo-redundant storage (GRS)](storage-redundancy.md#geo-redundant-storage) and [Geo-zone-redundant storage (GZRS)](storage-redundancy.md#geo-zone-redundant-storage). To make use of geo-redundancy options in your app, make sure that your storage account is configured for read-access geo-redundant storage (RA-GRS) or read-access geo-zone-redundant storage (RA-GZRS). If it's not, you can learn more about how to [change your storage account replication type](redundancy-migration.md).
52+
53+
In this example, we set the `GeoRedundantSecondaryUri` property in `BlobClientOptions`. When this property is set, read request failures in the primary region will seamlessly switch to perform retries against the secondary region endpoint.
54+
55+
:::code language="csharp" source="~/azure-storage-snippets/blobs/howto/dotnet/dotnet-v12/Retry.cs" id="Snippet_RetryOptionsGRS":::
56+
57+
Next, we'll create a client object for the blob service with the options defined in `blobOptionsGRS`.
58+
59+
:::code language="csharp" source="~/azure-storage-snippets/blobs/howto/dotnet/dotnet-v12/Retry.cs" id="Snippet_RetryOptionsCreateClientGRS":::
60+
5861

59-
## [Section 2 heading]
60-
<!-- Introduction paragraph -->
61-
1. <!-- Step 1 -->
62-
1. <!-- Step 2 -->
63-
1. <!-- Step n -->
6462

6563
## [Section n heading]
6664
<!-- Introduction paragraph -->
@@ -75,8 +73,8 @@ context so the customer can determine why they would click the link.
7573

7674
## Next steps
7775
<!-- Add a context sentence for the following links -->
78-
- For architectural guidance and general best practices around retry policies, please see [Transient fault handling](/azure/architecture/best-practices/transient-faults).
79-
- [Links](links-how-to.md)
76+
- For architectural guidance and general best practices around retry policies, see [Transient fault handling](/azure/architecture/best-practices/transient-faults).
77+
- For guidance on implementing a retry pattern for transient failures, see [Retry pattern](/azure/architecture/patterns/retry).
8078

8179
<!--
8280
Remove all the comments in this template before you sign-off or merge to the

0 commit comments

Comments
 (0)