Exploring the Fundamentals of Azure Cosmos DB

Sewvandi Wickramasinghe
ADL Blog
Published in
4 min readJun 25, 2024

Azure Cosmos DB

Microsoft’s Azure Cosmos DB service is a massively distributed, multi-model database. It allows for elastic and autonomous scaling of throughput. It also has storage in all of Azure’s global territories. Throughput, latency, affordability, and performance assurances are all covered by Cosmos DB’s service level agreements.

For modern app creation, Azure Cosmos DB is a completely maintained NoSQL database. The speed, at any rate, is guaranteed by single-digit millisecond response times and automatic and immediate scalability

Entity Hierarchy in Cosmos DB

Cosmos DB accounts, databases, containers, and items all have separate entities. Stored protocols, user specified tasks, causes, and disputes are some of the other entities found in Cosmos DB.

Databases

Under your username, you can build one or more Azure Cosmos databases. A namespace is similar to a dictionary. A database is a management unit for a group of Azure Cosmos containers.

One or more databases may be added to a Cosmos DB account.

Containers

A container can be horizontally partitioned using a partition key, and the data can then be distributed through Azure regions. A container will scale flexibly depending on whether private or shared throughput settings are used.

Multiple containers may exist in a database. For both provisioned throughput and storage, the Azure Cosmos DB container is a scalability unit.

One of the most distinguishing features of containers is the lack of schema handling. You can build objects of different schemas in a container. By default, all objects you add to a container are instantly indexed, so there’s no need to handle indexes or schemas.

You may also set a timer on an object or a container to delete them after a certain amount of time has passed. When an item expires, Azure Cosmos DB deletes it immediately. It also ensures that a check on the container does not return expired objects within a predetermined time frame.

For your Azure Cosmos container, you can register stored procedures, causes, user-defined functions (UDFs), and merge procedures.

On your Azure Cosmos container, you should define a special key restriction. You may guarantee the uniqueness of one or more values per logical partition key by designing a special key policy. No new or modified objects with values that repeat the values defined by the specific key restriction can be generated if you create a container with a unique key policy.

The system properties of each container are listed below.

Items

A document in a collection, a row in a table, or a node or edge in a graph may all be represented by an Azure Cosmos item, depending on the API you use.

To connect items to the container, you can use any of the APIs. Any item in the container has properties that are either created by the system or specified by the user. User defined properties are the properties required for your application.

Any Key Benefits?

Speed Guarantee at any scale

  • SLA-backed real-time connectivity with fast read and write latencies around the world, as well as throughput and accuracy.
  • With a single click, multi-region writes and data distribution can be sent to any Azure region.
  • Size storage and throughput through Azure regions in a flexible and independent manner.

Simple application development

  • Choose from multiple database APIs including the native Core (SQL) API, API for MongoDB, Cassandra API, Gremlin API, and Table API.
  • Azure Functions, IoT Hub, AKS (Azure Kubernetes Service), App Service, and other Azure services used in current (cloud-native) app creation are all deeply embedded.
  • The schema-less service in Azure Cosmos DB instantly indexes all of your files, regardless of the data model, so you can get blazing fast queries.

Mission-critical

  • Azure Cosmos DB comes with a robust set of SLAs, including industry-leading global availability.
  • Role-based access management in Azure keeps the data secure and gives you more control.
  • With automated data replication, you can easily disperse data to any Azure area. When using multi-region writes or RPO 0 there would be no downtime. Consistency is essential.

Absolutely self-managed and cost-effective

  • Database infrastructure that is fully operated. Maintenance, patching, and updates are all automated, saving developers time and resources.
  • Developers can get underway quickly without having to schedule or maintain capacity with these cost-effective solutions for irregular or intermittent workloads of any size or scale.
  • The serverless model provides an automated and responsive service for spiky workloads to handle traffic bursts on request.

--

--