How to use Azure Cosmos DB
· Category: Cloud Computing
Short answer
Azure Cosmos DB is a fully managed NoSQL database with turnkey global distribution and multi-model APIs.
Steps
- Create a Cosmos DB account in the Azure portal.
- Choose an API (SQL, MongoDB, Cassandra, Gremlin, Table).
- Create a database and container with a partition key.
- Configure throughput (manual or autoscale).
- Enable global replication to additional regions.
Tips
- Choose partition keys with high cardinality for even data distribution.
- Use consistency levels (strong, bounded staleness, session, eventual) based on app needs.
- Request units (RUs) govern throughput and cost.
Common issues
- Hot partitions from poor partition key choice throttle performance.
- Cross-region writes increase latency and RU cost.