CosmosDB Terminology and concepts

CosmosDB container = MongoDB collection = SQL tables

CosmosBD stores documents into containers.

  1. Partition Key:
    • Each item (document) in a Cosmos DB container is associated with a partition key.
    • The partition key is a property chosen by the user, and it determines the logical partition to which the item belongs.
  2. Physical Partitions:
    • Cosmos DB distributes the data across physical partitions to achieve scalability.
    • Each physical partition is a unit of throughput and storage capacity.
  3. Partition Key Range:
    • A partition key range is a contiguous range of partition key values.
    • Each physical partition contains one or more partition key ranges.
    • The partition key ranges collectively cover the entire range of possible partition key values for a given container.
  4. Routing:
    • Cosmos DB uses a mechanism called “range partitioning” to route requests to the correct physical partition based on the partition key.
    • The partition key ranges help in efficiently routing requests to the appropriate physical partition.
  5. Scalability:
    • Partition key ranges play a vital role in achieving horizontal scalability.
    • As the volume of data increases, Cosmos DB can split or merge partition key ranges to balance the load across physical partitions.
  6. Query Performance:
    • Well-distributed and evenly sized partition key ranges contribute to optimal query performance.
    • Poorly chosen partition key values can lead to “hot partitions,” where a single partition key range receives a disproportionate amount of traffic.
  7. Throughput:
    • Throughput (Request Units per Second, or RU/s) is provisioned at the level of physical partitions.
    • Adjustments to throughput impact all partition key ranges within a physical partition.

Autoscaling

When using autoscale, Cosmos DB only scales the RU/s to the maximum when the RU consumption is 100%, for a continuous period of time in a 5 second interval. 

More: link

Powered by BetterDocs

Leave a Reply