Skip to content

Latest commit

 

History

History
44 lines (30 loc) · 2.88 KB

tutorial-global-distribution.md

File metadata and controls

44 lines (30 loc) · 2.88 KB
title description author ms.author ms.service ms.subservice ms.topic ms.date ms.reviewer
Azure Cosmos DB global distribution tutorial for API for Table
Learn how global distribution works in Azure Cosmos DB for Table accounts and how to configure the preferred list of regions
seesharprun
sidandrews
cosmos-db
table
tutorial
01/30/2020
mjbrown

Set up Azure Cosmos DB global distribution using the API for Table

[!INCLUDETable]

This article covers the following tasks:

[!div class="checklist"]

  • Configure global distribution using the Azure portal
  • Configure global distribution using the API for Table

[!INCLUDE cosmos-db-tutorial-global-distribution-portal]

Connecting to a preferred region using the API for Table

In order to take advantage of the global distribution, client applications should specify the current location where their application is running. This is done by setting the CosmosExecutorConfiguration.CurrentRegion property. The CurrentRegion property should contain a single location. Each client instance can specify their own region for low latency reads. The region must be named by using their display names such as "West US".

The Azure Cosmos DB for Table SDK automatically picks the best endpoint to communicate with based on the account configuration and current regional availability. It prioritizes the closest region to provide better latency to clients. After you set the current CurrentRegion property, read and write requests are directed as follows:

  • Read requests: All read requests are sent to the configured CurrentRegion. Based on the proximity, the SDK automatically selects a fallback geo-replicated region for high availability.

  • Write requests: The SDK automatically sends all write requests to the current write region. In an account with multi-region writes, current region will serve the writes requests as well. Based on the proximity, the SDK automatically selects a fallback geo-replicated region for high availability.

If you don't specify the CurrentRegion property, the SDK uses the current write region for all operations.

For example, if an Azure Cosmos DB account is in "West US" and "East US" regions. If "West US" is the write region and the application is present in "East US". If the CurrentRegion property is not configured, all the read and write requests are always directed to the "West US" region. If the CurrentRegion property is configured, all the read requests are served from "East US" region.

Next steps

In this tutorial, you've done the following:

[!div class="checklist"]

  • Configure global distribution using the Azure portal
  • Configure global distribution using the Azure Cosmos DB Table APIs