Introduction

In this article, we will understand the business model and requirement and create Cosmos DB and collection accordingly with the use of the portal as well as .NET Code.

Please go through my previous articles of this series,

Business Model

There is a product-based company in India that provides value-added services (VAS), like mobile recharge, bill payment, and so on. The entire recharge process covers the following procedure,

  1. The end user (who wants to recharge his mobile) visits the recharge store and asks the store-keeper to make a recharge, for example, a Vodafone top-up of Rs. 100.
  2. The storekeeper sends a request to this company.
  3. The company sends a request to the service provider (Cyberplat).
  4. The service provider (Cyberplat) sends a request to the provider (Vodafone).
  5. The provider (Vodafone) makes a recharge and sends the response back to the service provider (Cyberplat).
  6. Service Provider (Cyberplat) sends the same response to the company and the company reverts to the recharge store and finally sends it to the end user.

Requirement

As mobile is very common for individuals, hence the volume of recharge transactions also will be high and it requires high storage to persist all the transactions and it should be accessible without latency.

So let's see how we can create database and collection for the same.

Step 1

Step 2

Step 3

Step 4

In the third step, we have seen throughput (400 - 10000 RU/s) and we kept 1000 as it is which is by default selected. The question is what is 'RU/s' and how can we calculate for our requirement.

RU/s means Request Units per Second. On an average how many requests we expect for our Cosmos DB irrespective of Create, Read, Update and Delete. We do not need to worry as we have online calculator through which we can get throughput value.

Go to the below link,

https://www.documentdb.com/capacityplanner

Step 1

Step 2

The number of documents - As per our business analysis, we assume that max 100000 transactions need to be captured.

Azure Cosmos DB

Step 3

Expecting max 100 requests we will get per second to write in the collection,

Azure Cosmos DB

Step 4

Expecting max 500 requests to read for report or query purpose,

Azure Cosmos DB

Step 5

Expecting max 10 documents needs to be updated per second,

Azure Cosmos DB

Step 6

Upload the same Transaction.json to consider update document size, as we are going to change only value, not the entire document, we can select the same JSON document.

Azure Cosmos DB

Step 7

The same thing i.e creation of database and collection which we have created, you want to create through .net code or say through your application.

Step 1

Step 2

Step 3

In the next article, we will see document creation through portal as well as through .NETapplication.