What is CosmosDB from Azure?
Published on

What is CosmosDB from Azure?

Authors

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

  1. Linearly Scalable – It is the ability to handle the increased load by adding more servers to the cluster.
  2. Schema-Agnostic Indexing – Automatically indexes all the data without requiring schema and index management.
  3. Multi-Model – Can be used as Key-value Pair, Document-based, Graph-based, Column Family-based databases.
  4. Multi-API and Multi-Language Support – Its supports many programming languages – Java, .NET, Python, also supports many APIs SQL, Table, MongoDB, etc.
  5. Multi-Consistency Support – It supports 5 consistency levels
  6. Indexes Data Automatically – Indexes all the fields automatically
  7. High Availability – 99.99% availability
  8. Guaranteed Low Latency – 10 milliseconds latency guaranty
  9. Multi-Master Support – We can choose which all data servers that act as write servers.

Additional Features

  1. Complete service and ready to use
  2. Multi-API (Supports single API at build time)
  3. Number of consistency levels (Clients can override default consistency level)
  4. Latency

Competition

  1. DynamoDB (Amazon)
  2. Oracle NoSQL
  3. Cloud Bigtable (Google)
  4. MongoDB
  5. 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.

  1. Eventual – Data is written to primary node & is propagated to read-only secondary nodes, eventually.
  2. Consistent Prefix – Clients read the data in the same order that is inserted
  3. 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.
  4. Bounded Staleness – We can set the staleness value for data, by almost “K” versions of item or “T” time interval whichever is reached first.
  5. Strong – Always guarantees the latest copy of data. Only supports single region.
CosmosDb Consistency

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).

  1. SQL (SQL Model)
  2. MongoDB (Document Data Model)
  3. Cassandra (Column-Family Data Model)
  4. Germlin (Graph Data Model)
  5. 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.