Updated February 27, 2023
What is Azure COSMOS DB?
Microsoft Azure Cosmos Db is not a traditional relational database and is a type of NoSQL database. In today’s world data generated is massive and to handle this unstructured massive data big data technologies are used. Cosmos Db is used to store this massive data by partitioning. This stores data by distributing it over global data centers and data can be accessed fast so that it provides low latency. So we can say that Azure Cosmos db is a distributed database spread globally and has multi-modal information services.
Structure of Azure COSMOS DB
Microsoft Azure cosmos db has a structure such that it can create multiple cosmos databases in a single account offered by azure subscription.
Here is the structure of the same contains database account, container and items:
- Database: Azure users can create more than one cosmos databases using the single database account asper the storage requirement. This database manages users , permissions and containers.
- Azure Cosmos Account: It is the basic unit of scalability and high availability of the cosmos db. Users have virtual storage systems of unlimited capacity on the container, and this data is distributed on worldwide data-center of Microsofts. Based on the incoming data users modify the azure regions by adding or removing.
- Container: It is the unit of scalability for provisioned throughput and storage and it helps in partitioning and duplicating data on different regions. Item added to the container and throughput on it is distributed using logical partitions based on the partition key.
How Azure COSMOS DB work?
Azure cosmos db works differently than our relational databases as it has to provide fast access to data and to achieve fast access to data or content from multiple regions of azure distance between users and data should be less, hence cosmos db global distribution of plays an important role in cosmos db, here we will see how the azure cosmos db works as it is global distributed database:
Global Distribution and Partitioning
To achieve faster response and high availability data needs to be stored in data centers which are closer to the users. typically azure deploys applications on multiple data centers distributed across the world and is often called as global distribution. Cosmos db uses this global distribution concept to store the data in its NoSQL databases structure. In cosmos db containers are used to store items, this items can be partitioned based on partition key so that particular items with partition key can be stored in one partition this partitions are also called as logical partition but are stored in a physical partition.
A container in the cosmos db can have millions or billions of rows or items inside and these are divided using the concept of logical partition based on logical partition key. Cosmos db handles the partition and other operations like splitting the data, replicating and deleting from different regions.
How to Create Azure COSMOS DB?
Below are the steps to create:
Step 1: Login into the Azure Portal using the below URL:
Step 2: From a Menu Page click on Create a Resource.
Step 3: Now from the resources page, click on Databases on the right pane and select Azure Cosmos Db from left pane:
Step 4: On the page “Create Azure Cosmos DB Account” enter the project and instance details:
Step 5: If the needed user can select Network Connectivity from the networking page as below:
Step 6: Click on Review + create a button to validate the entered detail is valid or not:
Step 7: Now click on the Create button to create the cosmos database:
Step 8: Once the deployment is completed portal will navigate to the screen with the below message as: “Deployment is completed.”
Advantages of Azure COSMOS DB
Below are the advantages of the same:
- This creates applications which are highly available and has low latency all over the world by replicating the data closer to the user.
- Cosmos db has high scalability as data increases it can be scaled to handle millions of reading and writing requests per second from all over the world.
- As it is a NoSQL database there is no need to keep schema of data and users can store structure or unstructured data as per requirement.
- It is already tested by other services offered by Microsoft like Skype, Xbox, Azure, etc, so the database durability is already tested.
- It can be used with Apache Spark for Analytical and data processing purposes.
We can conclude that can be used for any type of data and retrieving data from this database is also faster due to low latency. Creating a cosmos db from the Azure portal is also simple as a user as no coding experience is required and as Microsoft has paid as you go service so as data increases users can scale up the storage service and save money.
This is a guide to Azure COSMOS DB. Here we discuss an introduction to Azure COSMOS DB, structures, steps to create and advantages for the same. You can also go through our other related articles to learn more –