Azure CosmosDB

Azure Cosmos DB is a globally distributed, multi-model database service that enables you to store and manage data with low latency, high availability, and automatic scaling.
  • Azure Cosmos DB is a fully managed NoSQL database
  • Single-digit response time
  • Automatic scaling
  • Multi-region data distribution
  • Automatic patching and updates (fully managed service)

Cosmos DB APIs

Azure Cosmos DB supports multiple APIs. When you provision a new Cosmos DB instance, you select the API that you want to use. The choice of API depends on many factors including, the type of data to be stored, the need to support existing applications.

Core (SQL) API

The native API in Cosmos DB manages data in JSON document format, and despite being a NoSQL data storage solution, uses SQL syntax to work with the data.

MongoDB API

MongoDB is a popular open source database in which data is stored in Binary JSON (BSON) format. The Azure Cosmos DB MongoDB API enables developers to use MongoDB client libraries to and code to work with data in Azure Cosmos DB. MongoDB Query Language (MQL) uses a compact, object-oriented syntax in which developers use objects to call methods.

Table API

The Table API is used to work with data in key-value tables, similar to Azure Table Storage. The Azure Cosmos DB Table API offers greater scalability and performance than Azure Table Storage.

Cassandra API

The Cassandra API is compatible with Apache Cassandra, which is a popular open source database that uses a column-family storage structure. Column families are tables, similar to those in a relational database, with the exception that it’s not mandatory for every row to have the same columns.

Gremlin API

The Gremlin API is used with data in a graph structure; in which entities are defined as vertices that form nodes in connected graph.

Pricing

Azure Cosmos DB pricing is based on the amount of data stored, the provisioned throughput (request units per second), and the region where the data is stored. There are several pricing tiers available, including a free tier for the SQL API that provides up to 5 GB of storage and 400 RU/s of throughput. The pricing model is designed to be flexible and elastic, allowing you to scale up or down as your application needs change. You can also choose to pay for reserved capacity in advance to save money on long-term usage.

Provisioned Throughout is a pricing model in Azure Cosmos DB where you pre-allocate a certain amount of throughput (measured in request units per second, or RU/s) for your database account or container (table). This means that you pay a fixed price based on the provisioned throughput, regardless of the actual usage. With provisioned throughput, you have the ability to specify the amount of throughput needed to support your application’s performance requirements and ensure consistent performance.

With Azure Cosmos DB free tier, you will get the first 1000 RU/s and 25 GB of storage for free in an account. You can enable free tier on up to one account per subscription. Estimated $64/month discount per account.

Serverless is a pricing model in Azure Cosmos DB where you pay only for the actual throughput consumed by your application, without pre-provisioning any throughput. This means that you only pay for the requests that are processed by the database, and the cost is based on the actual usage. With serverless, you don’t need to worry about provisioning and managing the throughput capacity, as the service automatically scales up or down based on the demand.

Global Distribution

Global distribution in Azure Cosmos DB means that your data is automatically replicated to multiple geographic regions worldwide, allowing you to provide low-latency access to your data from anywhere in the world. With global distribution, you can store your data close to your users and provide them with a fast and responsive experience while ensuring high availability and disaster recovery.

Global distribution in Azure Cosmos DB is transparent to the application, meaning you don’t need to write any code to handle the replication or synchronization of data across regions. The service automatically takes care of replication, consistency, and failover, allowing you to focus on building your application.

When your application sends a request to Azure Cosmos DB, the SDK or REST API automatically determines the nearest available region based on the user’s location and the availability of the regions. The request is then sent to the closest available region for processing, which helps to minimize latency and provide a fast and responsive experience for the user.

References

Azure Cosmos DB

Cosmos DB APIs

How to choose between provisioned throughput and serverless

Last modified July 21, 2024: update (e2ae86c)