Skip to main content

Windows Azure Storage and Read-Access Geo Redundant Feature

The end this year brought to me a great news. Azure team announced that we have support for Read Access of Geo Redundant Storage.
Until now, we could activate geo redundant feature, that guaranty us that all the content would be duplicated to another data center and in case of a disaster, Azure would be able to recover our content from the storage. But until the recovery would be made and so on we would not be able to access the content until the cluster failover storage recovery mechanism would be triggered.
Read Access of Geo Redundant Storage is a long and complicate name. But more important than name is what the feature offer to us. From now, if we activate it and the data center used by to store our data goes down, we will be able to use the second one (that is used for geo-redundancy) to access our content. We’ll not be able to write content, but we can read content for it – in read only mode. For application that store updates, configuration or resources this is a crucial thing.
Activating this feature is very simple. Additionally to Locally Redundant and Geo Redundant we have a new option called Read Access Geo-Redundancy (RA-GRS). We need to switch to this 3rd options and we are ready to go.

What other things we should know?
First of all, you should know that you cannot control what the secondary location is for RA-GRS. The same thing happen for Geo Redundant feature. There is a list of predefined data centers that are paired (usually the paired one is on the same continent).
Once you activate this feature, you can access it using “fooAccount-secondary…”. “-secondary” is the key world in this case. The accounts keys are the same as for the primary account. Basically all the access rules and keys are duplicated from the primary account to the secondary account.
The switching between the primary accounts to the secondary account is made automatically when a failover action is triggered by the “matrix”. In that moment all the DNS are updated from the primary account to the second one.  Based on this pattern we don’t need to change from our application the storage URL. When the storage from the primary node will be recover the DNS will be updated again. If you want you could do this from the code because you know the address of the secondary account – but be aware you will respond this actions and take into account the synchronization latency.
All the request of type add/update/delete on the second node will trigger a 403 error code.
We have a field in our storage services that tell us when the last synchronization was made. This field is called “Last Sync Time”.

Specific API
On the second account we have a service API that can be used to get the “Last Sync Time” and find the status of the replication action. The API is called “GetServiceStats()” and can be used for all storage services (Table, Queue and Blob). The response of this service will contain the last sync time and the status of geo-replication. The status can be:

  • Live 
  • Bootstrap – initialize phase, when we change the replication option we can have this status
  • Unavailable – last sync time cannot be calculated because a problem occurred

Also you will notice that there are new metrics that provide us information related to the transaction and synchronization status.
When we are in C#, we can switch the storage client between the primary and the secondary one very easily by changing the value of “LocationMode” property to “LocationMode.SecondaryOnly”. When you are make this switch you will hit and use the secondary storage. This is pretty cool, we don’t need to edit the connection string by our self (10+). If you want to execute write actions on the secondary account a Storage Exception will be throw.
This enum has another 2 values available:

  • PrimaryOnly – all the actions/requests are made only on the first one
  • PrimaryThenSecondary – by default actions/requests hit the primary account. If something happen with him (404) than all the read requests are redirected to the secondary one
  • SecondaryOnly – (already presented) the read request are redirected to the second account

From the cost perceive we will pay for all the storage that we used on the secondary account and all the transactions that are made between this two storage.
Don’t forget that this feature is in preview for now and you need to sign in for the preview using the following link https://account.windowsazure.com/PreviewFeatures.
In the next post we will see how we can set the retry policy in a way that the secondary account will be used when we set the location mode property to “PrimaryThenSecondary”.

Comments

Popular posts from this blog

Windows Docker Containers can make WIN32 API calls, use COM and ASP.NET WebForms

After the last post , I received two interesting questions related to Docker and Windows. People were interested if we do Win32 API calls from a Docker container and if there is support for COM. WIN32 Support To test calls to WIN32 API, let’s try to populate SYSTEM_INFO class. [StructLayout(LayoutKind.Sequential)] public struct SYSTEM_INFO { public uint dwOemId; public uint dwPageSize; public uint lpMinimumApplicationAddress; public uint lpMaximumApplicationAddress; public uint dwActiveProcessorMask; public uint dwNumberOfProcessors; public uint dwProcessorType; public uint dwAllocationGranularity; public uint dwProcessorLevel; public uint dwProcessorRevision; } ... [DllImport("kernel32")] static extern void GetSystemInfo(ref SYSTEM_INFO pSI); ... SYSTEM_INFO pSI = new SYSTEM_INFO(...

How to audit an Azure Cosmos DB

In this post, we will talk about how we can audit an Azure Cosmos DB database. Before jumping into the problem let us define the business requirement: As an Administrator I want to be able to audit all changes that were done to specific collection inside my Azure Cosmos DB. The requirement is simple, but can be a little tricky to implement fully. First of all when you are using Azure Cosmos DB or any other storage solution there are 99% odds that you’ll have more than one system that writes data to it. This means that you have or not have control on the systems that are doing any create/update/delete operations. Solution 1: Diagnostic Logs Cosmos DB allows us activate diagnostics logs and stream the output a storage account for achieving to other systems like Event Hub or Log Analytics. This would allow us to have information related to who, when, what, response code and how the access operation to our Cosmos DB was done. Beside this there is a field that specifies what was th...

Cloud Myths: Cloud is Cheaper (Pill 1 of 5 / Cloud Pills)

Cloud Myths: Cloud is Cheaper (Pill 1 of 5 / Cloud Pills) The idea that moving to the cloud reduces the costs is a common misconception. The cloud infrastructure provides flexibility, scalability, and better CAPEX, but it does not guarantee lower costs without proper optimisation and management of the cloud services and infrastructure. Idle and unused resources, overprovisioning, oversize databases, and unnecessary data transfer can increase running costs. The regional pricing mode, multi-cloud complexity, and cost variety add extra complexity to the cost function. Cloud adoption without a cost governance strategy can result in unexpected expenses. Improper usage, combined with a pay-as-you-go model, can result in a nightmare for business stakeholders who cannot track and manage the monthly costs. Cloud-native services such as AI services, managed databases, and analytics platforms are powerful, provide out-of-the-shelve capabilities, and increase business agility and innovation. H...