What is Azure Cosmos DB? A Basic Overview

Tarik ShaikhTarik Shaikh
3 min read

In this article we will get a very high-level understanding of what Azure Cosmos DB is. When learning some new tech as a beginner, it is very crucial to first understand the theory before diving into practical :)

As Cosmos DB is part of Azure, we will not be focusing much on the pricing of it but rather on the technical side, what problem it solves.

So, let's get started.

Overview

To start with, Azure Cosmos DB is a NoSQL database. To read more, you can check out Introduction to NoSQL.

It is fully managed by Azure, which means that it's a NoSQL database on cloud. It's a globally distributed database for high availability and low latency.

It has all the characteristics of a NoSQL database, like supporting JSON documents as Items along with feature rich capabilities of Azure.

Resource hierarchy

Resource hierarchy means the resources we need to create in Azure in order to get a Cosmos DB instance created. Below are the Azure resources:

  • Azure Cosmos DB Account

    • Databases

      • Containers

        • Items

Just like any other Azure resource, a Cosmos DB Account is an Azure resource which lets us host and work with our databases. A Database has Containers which in turn has a list of Items. In an SQL world, Containers can be thought of as Tables and Items as Rows. But the difference here would be due to Cosmos DB being a NoSQL database, it doesn't have a defined structure.

API support

Cosmos DB supports a number of APIs which can be thought of as different flavors of working with Cosmos DB. Below is the list:

  • SQL

  • Cassandra

  • MongoDB

  • Gremlin

  • Azure Table Storage

SQL API allows the use of SQL like queries to work with Cosmos DB which makes it easier for developers who has an SQL background (Am sure most of us fall in this category ;)). The APIs act as a wrapper around Cosmos DB and makes it comfortable for the developer to work with the API of their choice.

Request Units

RUs are basically the unit on which Azure determines Cosmos DB usage for a client and charges accordingly. As an administrator, RUs should be in control to reduce the cloud costs which we will incur due to Cosmos DB resource on Azure.

Consistency Levels

In the SQL world, ACID properties were defined to take care of data integrity as a whole. But that doesn't apply in case of Azure Cosmos DB.

Consistency in Cosmos DB

Azure Cosmos DB provides a range of Consistency levels to choose from based on the appropriate need of the client. This article from Microsoft explains in depth about each level and its characteristics. Below are all the 5 levels offered.

  • Strong

  • Bounded Staleness

  • Session

  • Consistent Prefix

  • Eventual

References:

0
Subscribe to my newsletter

Read articles from Tarik Shaikh directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Tarik Shaikh
Tarik Shaikh

As a software engineer by profession, I am here to share my knowledge and experience.