Azure Cosmos DB Price calculator for database operations

Janki Depala
2 min readJul 11, 2021

What is Cosmos DB?

Multi-model database, no schema, horizontally scalable NoSQL database. Cosmos DB’s core features like partitioning and global distribution.

Latency vs Throughput
Latency
— The time taken for a packet to be transferred across a network. You can measure this as one-way to its destination or as a round trip.

Throughput — The quantity of data being sent and received within a unit of time

www.comparitech.com defines Latency and Throughput

The time it takes for a packet to travel from the source to its destination is referred to as latency. Latency indicates how long it takes for packets to reach their destination. Throughput is the term given to the number of packets that are processed within a specific period of time. Throughput and latency have a direct relationship in the way they work within a network.

Throughput is specified in Request Units (RUs) per second.

The cost to read a 1 KB item is 1 Request Unit (or 1 RU). Select by ‘id’ operations consume lower number of RUs compared to Delete, Update, and Insert operations for the same document.

2 types of Database operations:

  1. Provisioned Throughput: Provisioned throughput (also called reserved throughput) provides high performance at any scale. You specify the throughput that you need in Request Units per second (RU/s), and Azure Cosmos DB dedicates the resources required to provide the configured throughput. You can provision throughput on either a database or a container. Based on your workload needs, you can scale throughput up/down at any time or use autoscale (although there is a minimum throughput required on a database or a container to guarantee the SLAs). You are billed hourly for the maximum provisioned throughput for a given hour.

2. Serverless: In serverless mode, you don’t have to provision any throughput when creating resources in your Azure Cosmos account. At the end of your billing period, you get billed for the amount of Request Units that has been consumed by your database operations.

Storage: You are billed a flat rate for the total amount of storage (in GBs) consumed by your data and indexes for a given hour. Storage is billed on a consumption basis, so you don’t have to reserve any storage in advance. You are billed only for the storage you consume.

--

--