Azure Cosmos DB is a fully managed NoSQL database offering from the Microsoft Azure platform. It can store and process enormous volumes of structured and unstructured data in Cosmos DB and support large-scale operational and transactional applications with millisecond response times.
Cosmos DB gives a broader business perspective to adapt and innovate faster by grabbing opportunities and converting them into strategic advantages. Here are eight reasons you should consider using Cosmos DB for your next project:
1. Azure Cosmos DB data can be replicated globally:
Azure Cosmos DB can replicate the data globally because it is classified as a foundational service, which allows you to replicate data to as many data centers in as many regions as you wish.
We can select the region where we want to replicate the data globally. We must click to select the region on the map. We can also prioritize the regions where it should failover in case of a disaster.
2. Azure Cosmos DB Data Migration tool
We can easily migrate the data to Cosmos DB with the Azure Cosmos DB Data Migration tool. You can import data from a variety of sources to Azure Cosmos DB, including:
- JSON files
- SQL Server
- CSV files
- Azure Cosmos DB collections
3. We have five consistencies to choose from
Azure Cosmos DB contains five consistency models. Each consistency level provides availability and performance tradeoffs to help you decide which consistency matches your scenario.
Azure Cosmos DB offers five well-defined levels. The levels are:
- Bounded staleness
- Consistent prefix
The following image shows the different consistency levels range and performance/availability:
When creating our Azure Cosmos DB, we can choose the default consistency from those consistency levels. A different consistency level can be specified every time you read from the database.
In most scenarios, we use session consistency as a default consistency. We can also change the default consistency based on our requirements.
4. Azure Cosmos DB has multi-API support
Azure Cosmos DB supports five types of APIs.
- Table API
- Gremlin API
- Cassandra API
- MongoDB API
- SQL API
Table API provides Key-Value store, Gremlin provides Graph-based storage, Cassandra provides columnar storage, MongoDB provides Bson type of storage, and SQL provides Json type of storage.
Cosmos DB supports Stored Procedures, User Defined Functions, and Triggers.
5. Partitioning in Azure Cosmos DB
Partitioning is essential and a huge topic in Azure Cosmos DB. Here is an overview.
In Azure Cosmos DB, we can scale a large amount of data using partitioning, not just in terms of storage but also throughput. You create a container in your database and let Cosmos DB partition the data you store in that container.
This means when working with a single container as a single logic resource where you store data, the container handles the data at the backend by creating dynamic partitions to accommodate the data.
6. Azure Cosmos DB has incredibly low latency
Azure Cosmos DB guarantees low latency where we can read in less than 10ms and 15ms latency for writes.
The data is written, committed, replicated, and indexed, all this in less than 15 milliseconds.
The data will be replicated according to the selected consistency model from a local region.
7. Azure Cosmos DB indexes automatically
Cosmos DB does not need any schema or secondary indexes. It handles indexing automatically. It uses Bw-trees instead of B-trees. Bw-trees does not use latches. It makes use of multi-core technology and never updates a memory page in place to avoid cache invalidations, and it uses flash storage.
Even though it takes care of indexing automatically, it still allows developers to implement a custom indexing policy.
8. Azure Cosmos DB Pricing
Cosmos Db is a PaaS offering, where it gets additional features ahead, meaning it will improve continuously with additional applications and features.
Pricing is based on the storage consumed and the data throughput:
Data throughput is measured in request units per second. You need to pay $0.008 per hour. Meanwhile, we must pay 25 cents per GB used every month.
The key advantage is that Microsoft Azure ensures that your data gets there fast at a reasonable price point. Microsoft says it is potentially five to ten times more affordable than other services. It is more cost-effective than DynamoDB when it comes to high volumes of workloads.