What is Cosmos DB? Microsoft Azure Cosmos DB Explained.

Azure is rapidly building a highly scalable Cosmos DB (Formerly known as document DB) driven public cloud, with strategic investments in tools and hires. It’s also running fast, launching new tools and services on a regular basis. At first, Azure was catching up with Amazon Web Services based Dynamo DB, but the release of the new Azure Cosmos DB globally distributed, multi model database leapfrogs Amazon. As per MS the new COSMOS DB enables customer’s the elastically and independently scale throughput and storage across any number of Azure’s geographic regions. It offers throughput, latency, availability, and consistency guarantees with comprehensive service level agreements (SLAs), something no other database service can offer at the moment.

Credit: “Royalty Free” photo from www.pexels.com

But before I explain more on this, I must tell you that a Cosmos DB is nothing but a highly scalable document database only, available as a service in the Azure Cloud. Although the document database is here for last few years and I am assuming many of you very well knows about it, however for few people who are from the world of relational database may still require to know what a document database is and would be happy to know on what is difference between a document database and a relational database. So here are few lines of information about the document db.

What is a Document Database?

A document database is designed to store semi-structured data as documents, typically in JSON or XML format. Unlike traditional relational databases, the schema for each non-relational (NoSQL) document can vary, giving Developers, Database Administrators, and IT Professionals more flexibility in organizing and storing application data and reducing storage required for optional values.

JSON document support makes it easier for Developers to serialize and load objects containing relevant properties and data. NoSQL Databases or the document DB’s are designed to scale “out” using distributed clusters of low-cost hardware to increase throughput without increasing latency.

NoSQL is a term used to describe high-performance, non-relational databases. NoSQL databases utilize a variety of data models, including document, graph, key-value, and columnar. NoSQL databases are widely recognized for ease of development, scalable performance, high availability, and resilience. Below are several resources to help you get started using NoSQL databases.

If you think the above information is little complex let me explain it in simple words also.

In very simple words…….

A document is typically a Json object

In this document databases the data is stored in documents

The database indexes the properties of the document and allow to run queries against them

Basic difference between a document DB and relational database is as follows:

Document DB

Relational Database

De-normalize data Normalized data
Referential integrity NOT enforced Referential integrity FORCED through normalization and relationship
Mixed data in collection Uniform data in tables
Flexible schema Schema is set-through can be changed
SQL like language as well as Java scipt SQL

Pricing Model of Cosmos DB

Microsoft has clearly outlined the pricing model of the COSMOS DB and it can be found here.

Creation of a sample Cosmos DB

A cosmos DB can be created with a click of a button. Choosing the API is important while you create the COSMOS DB. There are four API available which you can find in the drop down list.

You need to choose the best option which you need for your development.

Once you click on create, you will see the following

Once it’s created you’ll able to see this screen

Regional Configuration of Cosmos DB – Replication of database with just click of a button.

This is what I call the master stroke by Microsoft, as you can see once the COSMOS DB which I just created in the east US region is showing in the below map, however I can easily replicate it to a different regions with click of a button.

The cosmos DB when created initially looks like this.

This is the configuration where I have decided to replicate the COSMOS DB globally to six different Azure data center.

So in the above case the write region of the cosmos DB is still the US East data center however there are multiple read regions which I have chosen to replicate the read only data. As you can see below.

Monitoring of Cosmos DB

Azure has inbuilt monitoring setup for the COSMOS DB where you can monitor the Throughput, Storage, Availability, Latency and Consistency. And you can setup alert rule like you can do for all other resources.

Future of Cosmos DB

Microsoft’s commitment to Azure COSMOS DB makes a lot of sense, especially if you consider it as part of a migration away from expensive and resource-hungry IaaS models to something that’s a lot more in line with Azure’s roots as a platform. COSMOS DB running in a PaaS are a logical step towards this goal.

With Azure managing COSMOS DB scaling and DB deployment, there’s really not much point to spending time building and managing complex virtual infrastructures yourself. So, your focus shifts to understanding how to construct and manage the database objects, and to working with the development to link COSMOS DB into an application. Building code that works in this new environment might be more complex to start with, but using COSMOS DB as your main deployment mode can simplify updates, as well as scaling.


Up to now, Microsoft’s been a fast follower on the NoSQL DB path, with MongoDB as the leader however with new release of COSMOS DB and building the community around the development of COSMOS DB based applications it’s fast gaining the market share on the NoSQL DB market. The use of the data migration tool also makes the import of data from other database to COSMOS DB lots easy. COSMOS DB is here to stay and a very good offering from Microsoft, let’s see what’s coming up next, stay tuned!!!