Understanding Cosmos DB Resource Hierarchy – Container
  • 23 Nov 2022
  • 1 Minute to read
  • Dark
    Light
  • PDF

Understanding Cosmos DB Resource Hierarchy – Container

  • Dark
    Light
  • PDF

#ServerlessTips - Azure Cosmos DB
Author: Steef-Jan Wiggers Azure MVP

The next level down from the database is a container that holds your data and other items like stored procedures. Containers are the primary scalability unit in Cosmos DB, which service will automatically and transparently partition your data based on the value of the partition key for each individual item. In the screenshot below you, that is what you need to specify, too, next to the database when creating a container.

Picture326

You provide a name for the container and choose the indexing mode, the partition key, any unique keys you like to add, the analytic store (On/Off), and enabling Synapse Link (yes/no). Depending on your scenario, you configure the container accordingly. Note that the important aspect of the container is the partition key. Containers can have many partitioning schemas like single partition keys, hierarchical partition keys, and composite partition keys (Cassandra APO).

About the back-end of CosmosDB. As you know, Cosmos DB is a multi-tenant, shared-nothing, distributed service available in all active Azure regions. Moreover, Cosmos DB is a ‘ring 0’ service in Azure, so as new Azure regions are rolled out, Cosmos DB will always be on the list of available services.

In each region, the database service is divided into multiple logical fault-tolerant groups of servers called clusters. Every cluster contains multiple fault-domain boundaries, and servers within these domains are spread across these domains. The cluster as a whole can survive any failure in a subset of these domains. Within each cluster, your physical partitions for different containers are spread across the other servers in different fault domains. And a single partition has four replicas placed across fault domains for availability and durability.


Was this article helpful?