- Published on
What is CosmosDB from Azure?
- Authors
- Name
- Rahul Neelakantan
In this post, I’m going to discuss CosmosDB (Azure Service) and its features and basic introduction to its APIs and consistency.
Introduction
Cosmos Database is an offering from Microsoft Azure and is a cloud-based NoSQL database. CosmosDB is sometimes referred to as a serverless database and is available in all Azure regions.
Azure’s NoSQL database service, which launched in 2015 and is now morphing into Cosmos DB
Microsoft Azure Cosmos DB .NET SDK Version 3 is the client library for C# for connecting to the database.
Features
- Linearly Scalable – It is the ability to handle the increased load by adding more servers to the cluster.
- Schema-Agnostic Indexing – Automatically indexes all the data without requiring schema and index management.
- Multi-Model – Can be used as Key-value Pair, Document-based, Graph-based, Column Family-based databases.
- Multi-API and Multi-Language Support – Its supports many programming languages – Java, .NET, Python, also supports many APIs SQL, Table, MongoDB, etc.
- Multi-Consistency Support – It supports 5 consistency levels
- Indexes Data Automatically – Indexes all the fields automatically
- High Availability – 99.99% availability
- Guaranteed Low Latency – 10 milliseconds latency guaranty
- Multi-Master Support – We can choose which all data servers that act as write servers.
Additional Features
- Complete service and ready to use
- Multi-API (Supports single API at build time)
- Number of consistency levels (Clients can override default consistency level)
- Latency
Competition
- DynamoDB (Amazon)
- Oracle NoSQL
- Cloud Bigtable (Google)
- MongoDB
- Couchbase
Consistency Levels in Cosmos DB
It has 5 consistency levels, we can choose the default consistency level for our application, the client application can override the default value.
- Eventual – Data is written to primary node & is propagated to read-only secondary nodes, eventually.
- Consistent Prefix – Clients read the data in the same order that is inserted
- Session – Committed users can see the data they have committed, however other geolocations will not get data immediately, i.e. they have to wait for replication to happen.
- Bounded Staleness – We can set the staleness value for data, by almost “K” versions of item or “T” time interval whichever is reached first.
- Strong – Always guarantees the latest copy of data. Only supports single region.
API Supported
While creation of CosmosDB, we must stick to a single model, if we need to change in-between we have to migrate all the data from Azure DocumentDB Data Migration Tool to a new API model. Regardless of which data model you use, the core content model of the CosmosDB engine is based on ARS (Atom-Record-Sequence).
- SQL (SQL Model)
- MongoDB (Document Data Model)
- Cassandra (Column-Family Data Model)
- Germlin (Graph Data Model)
- Table (Key Value Pair Model)
Conclusion
CosmosDB is a highly versatile database offering from Azure. It can support a wide range of database requirements, consistency levels, replication, etc. CosmosDB makes it easy for migrating from any type of database structure.
If you’re planning on migrating you’re in premise database to Azure, then Azure CosmosDB might be the right choice.