- Introduction to Azure Cosmos DB
- Consistency Model of Azure Cosmos DB
- Cosmos DB Multi-Model Capabilities
In today’s highly active world, applications are required to operate at the same pace as their users. Thus, applications need to be responsive 24/7, achieve low latency, and be constantly online. To do this, the application data centers need to be closer to the user. Furthermore, applications must react in real-time to enormous variations in usage in peak hours, and they must be able to store large data volumes along with making this data readily accessible for users in a matter of milliseconds.
Microsoft introduced Azure Cosmos DB as a globally distributed, multi-model database service that enabled the user to flexibly and autonomously scale data and storage throughout unlimited Azure regions across the globe with one simple click! Users could now take full advantage of their preferred API, such as SQL, MongoDB, Cassandra, etc. Unlike other services, Cosmos DB offers comprehensive service level agreements (SLAs) for throughput, latency, availability, and consistency guarantees.
To learn more about the history, progress, features and use cases of Azure Cosmos DB, click here.
Microsoft states in their official documentation that “Distributed databases that rely on replication for high availability, low latency, or both, make the fundamental tradeoff between the read consistency vs. availability, latency, and throughput.” – Microsoft Official Documentation, 2020
In most cases, the market available distributed databases allow the developers to select from two extreme consistency models, one being a strong consistency and the other being an eventual consistency. The strong consistency model is also known as linearizability, and it is basically the star when it comes to data programmability. However, it does add the cost of increased latency when it is in a stable condition and decreased accessibility during times of failures. The eventual consistency presents higher availability and better performance, but programming applications is rather challenging in this form of consistency.
Unlike commercially available databases, Azure Cosmos DB does not consider data consistency to be a limited choice between two extremes. Instead, it offers a continuum of options for its users. While strong and eventual consistency bookmark this continuum, there is a wide range of available consistencies inside it. This allows developers to make accurate selections and granulated balances in terms of accessibility and performance.
Azure Cosmos DB allows developers to select from 5 consistency models on the consistency spectrum. The models consist of strong, bounded staleness, session, consistent prefix, and eventual consistency. All the models are elaborate and instinctive and can be incorporated in real-world situations.
If you would like more detailed information on the different consistency levels provided by Azure Cosmos DB and if you want to know how each of them can be used in different scenarios to make an optimal tradeoff between consistency, latency, and throughput, click here.
Azure Cosmos DB empowers users with multi-model databases that store various kinds of data for numerous commercial use cases. Irrespective of the selected model, Cosmos DB, saves the data as an Atom-Record-Sequence (ARS) under the hood.
This means that every API has its own sets of benefits. The Cosmos DB premium features, however, such as geo-replication and data retrieval in milliseconds, remain common to all. Currently. There are 5 models that Azure Cosmos DB supports. The following image provides a summarized breakdown of the APIs per programming knowledge.
If you want to find more detailed information on how Cosmos DB supports these different APIs and if you want more information on the various APIs, click here.