Configure throughput for Azure Cosmos DB for NoSQL with the Azure portal
One of the most important things to wrap your head around is configuring throughput in Azure Cosmos DB for NoSQL. To create an Azure Cosmos DB for NoSQL container, you must first create an account and then a database; in that order.
In this lab, you will provision throughput using various methods in the Data Explorer. You will provision throughput either manually or using autoscale, at the database and the container level.
Create a serverless account
Let’s start simple by creating a serverless account. There’s not much to configure here since everything is serverless. When we create our database and container, we don’t have to provision throughput at all. You will see all of that as we step into creating this account.
-
In a new web browser window or tab, navigate to the Azure portal (
portal.azure.com
). -
Sign into the portal using the Microsoft credentials associated with your subscription.
-
Within the Azure services category, select Create a resource, and then select Azure Cosmos DB.
💡 Alternatively; expand the ≡ menu, select All Services, in the Databases category, select Azure Cosmos DB, and then select Create.
-
In the Select API option pane, select the Create option within the Azure Cosmos DB for NoSQL section.
-
Within the Create Azure Cosmos DB Account pane, observe the Basics tab.
-
On the Basics tab, enter the following values for each setting:
Setting Value Subscription Use your existing Azure subscription. All resources must belong to a resource group. Every resource group must belong to a subscription. Resource Group Use existing or create a new resource group. All resources must belong to a resource group. Account Name Enter any globally unique name. The globally unique account name. This name will be used as part of the DNS address for requests. The portal will check the name in real time. Location Choose any available region. Select the geographical region from which your database will initially be hosted. Capacity mode Select Serverless -
Select Review + Create to navigate to the Review + Create tab, and then select Create.
📝 It can take 10-15 minutes for the Azure Cosmos DB for NoSQL account to be ready for use.
-
Observe the Deployment pane. When the deployment is complete, the pane will update with a Deployment successful message.
-
Still within the Deployment pane, select Go to resource.
-
From within the Azure Cosmos DB account pane, select Data Explorer from the resource menu.
-
In the Data Explorer pane, expand New Container and then select New Database.
-
In the New Database popup, enter the following values for each setting, and then select OK:
Setting Value Database id cosmicworks
-
Back in the Data Explorer pane, observe the cosmicworks database node within the hierarchy.
-
In the Data Explorer pane, select New Container.
-
In the New Container popup, enter the following values for each setting, and then select OK:
Setting Value Database id Use existing | cosmicworks Container id products
Partition key /categoryId
-
Back in the Data Explorer pane, expand the cosmicworks database node and then observe the products container node within the hierarchy.
-
Return to the Home of the Azure portal.
Create a provisioned account
Now, we are going to create a provisioned throughput account with more traditional configuration options. This type of account will open up a world of configuration options for us which can be a bit overwhelming. We are going to walk through a few examples of database and container pairings that are possible here.
-
Within the Azure services category, select Create a resource, and then select Azure Cosmos DB.
💡 Alternatively; expand the ≡ menu, select All Services, in the Databases category, select Azure Cosmos DB, and then select Create.
-
In the Select API option pane, select the Create option within the Azure Cosmos DB for NoSQL section.
-
Within the Create Azure Cosmos DB Account pane, observe the Basics tab.
-
On the Basics tab, enter the following values for each setting:
Setting Value Subscription Use your existing Azure subscription. All resources must belong to a resource group. Every resource group must belong to a subscription. Resource Group Use existing or create a new resource group. All resources must belong to a resource group. Account Name Enter any globally unique name. The globally unique account name. This name will be used as part of the DNS address for requests. The portal will check the name in real time. Location Choose any available region. Select the geographical region from which your database will initially be hosted. Capacity mode Provisioned throughput Apply Free Tier Discount Do Not Apply Limit the total amount of throughput that can be provisioned on this account Unchecked -
Select Review + Create to navigate to the Review + Create tab, and then select Create.
📝 It can take 10-15 minutes for the Azure Cosmos DB for NoSQL account to be ready for use.
-
Observe the Deployment pane. When the deployment is complete, the pane will update with a Deployment successful message.
-
Still within the Deployment pane, select Go to resource.
-
From within the Azure Cosmos DB account pane, select Data Explorer from the resource menu.
-
In the Data Explorer pane, expand New Container and then select New Database.
-
In the New Database popup, enter the following values for each setting, and then select OK:
Setting Value Database id nothroughputdb
Provision throughput Unchecked -
Back in the Data Explorer pane, observe the nothroughputdb database node within the hierarchy.
-
In the Data Explorer pane, select New Container.
-
In the New Container popup, enter the following values for each setting, and then select OK:
Setting Value Database id Use existing | nothroughputdb Container id requiredthroughputcontainer
Partition key /primarykey
Container throughput Manual RU/s 400
-
Back in the Data Explorer pane, expand the nothroughputdb database node and then observe the requiredthroughputcontainer container node within the hierarchy.
-
In the Data Explorer pane, expand New Container and then select New Database.
-
In the New Database popup, enter the following values for each setting, and then select OK:
Setting Value Database id manualthroughputdb
Provision throughput Checked Database throughput Manual RU/s 400
-
Back in the Data Explorer pane, observe the manualthroughputdb database node within the hierarchy.
-
In the Data Explorer pane, select New Container.
-
In the New Container popup, enter the following values for each setting, and then select OK:
Setting Value Database id Use existing | manualthroughputdb Container id childcontainer
Partition key /primarykey
Provision dedicated throughput for this container Checked Container throughput Manual RU/s 1000
-
Back in the Data Explorer pane, expand the manualthroughputdb database node and then observe the childcontainer container node within the hierarchy.