AZ

Azure Cosmos DB

NoSQL partitioning, RU/s scaling, and consistency levels

Details

Language / Topic
azure-cloudMicrosoft Azure
Category
Architecture

Rules

balanced
- Choose a highly variant partition key to distribute Request Units (RU/s) evenly across logical partitions.
- Understand and explicitly set appropriate consistency levels (Session vs Strong).
- Carefully select a partition key with high cardinality. A poor partition key results in "hot partitions" which throttle RU/s exponentially.
- Use Point Reads (ID + Partition Key) instead of arbitrary SQL Queries whenever possible; Point Reads consume exactly 1 RU.
- Default to "Session" consistency for almost all applications; reserve "Strong" consistency for strictly regulated financial ledgers.
- Consider utilizing the relatively new Serverless mode if your traffic is highly sporadic to avoid baseline provisioned costs.